]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Merge remote-tracking branch 'upstream/pull/6170'
[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: (a4, b3) => (typeof require !== "undefined" ? require : a4)[b3]
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, options) {
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     options = options || {};
255     var body = options.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 (!options.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 = options.credentials || this.credentials || "same-origin";
276     if (options.headers || !this.headers) {
277       this.headers = new Headers(options.headers);
278     }
279     this.method = normalizeMethod(options.method || this.method || "GET");
280     this.mode = options.mode || this.mode || null;
281     this.signal = options.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 (options.cache === "no-store" || options.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, options) {
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 (!options) {
340       options = {};
341     }
342     this.type = "default";
343     this.status = options.status === void 0 ? 200 : options.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 = options.statusText === void 0 ? "" : "" + options.statusText;
349     this.headers = new Headers(options.headers);
350     this.url = options.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 options = {
365           statusText: xhr.statusText,
366           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
367         };
368         if (request3.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
369           options.status = 200;
370         } else {
371           options.status = xhr.status;
372         }
373         options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
374         var body = "response" in xhr ? xhr.response : xhr.responseText;
375         setTimeout(function() {
376           resolve(new Response(body, options));
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, a4) {
585           (null == a4 || a4 > r2.length) && (a4 = r2.length);
586           for (var e3 = 0, n3 = Array(a4); e3 < a4; 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(a4, n3) {
597           if (!(a4 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, F3 = function() {
616               };
617               return {
618                 s: F3,
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: F3
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, a4 = true, u2 = false;
636           return {
637             s: function() {
638               t2 = t2.call(r2);
639             },
640             n: function() {
641               var r3 = t2.next();
642               return a4 = r3.done, r3;
643             },
644             e: function(r3) {
645               u2 = true, o2 = r3;
646             },
647             f: function() {
648               try {
649                 a4 || 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, a4) {
727           if (r2) {
728             if ("string" == typeof r2) return _arrayLikeToArray(r2, a4);
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, a4) : 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, options) {
794               if (!(type2 in this.listeners)) {
795                 this.listeners[type2] = [];
796               }
797               this.listeners[type2].push({
798                 callback,
799                 options
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(_3, 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, options) {
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(([k3, v3]) => {
1204             return allTags[k3] && (v3 === "*" || allTags[k3] === v3);
1205           })
1206         )) {
1207           return value;
1208         }
1209       }
1210       if (key === "incline" && numeric.test(value)) {
1211         return value.replace(numeric, function(_3, sign2) {
1212           return sign2 === "-" ? "" : "-";
1213         });
1214       } else if (options && options.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(a4, b3) {
1294     return a4 == null || b3 == null ? NaN : a4 < b3 ? -1 : a4 > b3 ? 1 : a4 >= b3 ? 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(a4, b3) {
1303     return a4 == null || b3 == null ? NaN : b3 < a4 ? -1 : b3 > a4 ? 1 : b3 >= a4 ? 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(a4, x2, lo = 0, hi = a4.length) {
1323       if (lo < hi) {
1324         if (compare1(x2, x2) !== 0) return hi;
1325         do {
1326           const mid = lo + hi >>> 1;
1327           if (compare2(a4[mid], x2) < 0) lo = mid + 1;
1328           else hi = mid;
1329         } while (lo < hi);
1330       }
1331       return lo;
1332     }
1333     function right(a4, x2, lo = 0, hi = a4.length) {
1334       if (lo < hi) {
1335         if (compare1(x2, x2) !== 0) return hi;
1336         do {
1337           const mid = lo + hi >>> 1;
1338           if (compare2(a4[mid], x2) <= 0) lo = mid + 1;
1339           else hi = mid;
1340         } while (lo < hi);
1341       }
1342       return lo;
1343     }
1344     function center(a4, x2, lo = 0, hi = a4.length) {
1345       const i3 = left(a4, x2, lo, hi - 1);
1346       return i3 > lo && delta(a4[i3 - 1], x2) > -delta(a4[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 j3 = 0; j3 < this._n && j3 < 32; j3++) {
1413             const y2 = p2[j3], 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 (a4, b3) => {
1450       const x2 = compare2(a4, b3);
1451       if (x2 || x2 === 0) return x2;
1452       return (compare2(b3, b3) === 0) - (compare2(a4, a4) === 0);
1453     };
1454   }
1455   function ascendingDefined(a4, b3) {
1456     return (a4 == null || !(a4 >= a4)) - (b3 == null || !(b3 >= b3)) || (a4 < b3 ? -1 : a4 > b3 ? 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, k3, left = 0, right = Infinity, compare2) {
1569     k3 = Math.floor(k3);
1570     left = Math.floor(Math.max(0, left));
1571     right = Math.floor(Math.min(array2.length - 1, right));
1572     if (!(left <= k3 && k3 <= 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 m3 = k3 - left + 1;
1578         const z3 = Math.log(n3);
1579         const s2 = 0.5 * Math.exp(2 * z3 / 3);
1580         const sd = 0.5 * Math.sqrt(z3 * s2 * (n3 - s2) / n3) * (m3 - n3 / 2 < 0 ? -1 : 1);
1581         const newLeft = Math.max(left, Math.floor(k3 - m3 * s2 / n3 + sd));
1582         const newRight = Math.min(right, Math.floor(k3 + (n3 - m3) * s2 / n3 + sd));
1583         quickselect(array2, k3, newLeft, newRight, compare2);
1584       }
1585       const t2 = array2[k3];
1586       let i3 = left;
1587       let j3 = right;
1588       swap(array2, left, k3);
1589       if (compare2(array2[right], t2) > 0) swap(array2, left, right);
1590       while (i3 < j3) {
1591         swap(array2, i3, j3), ++i3, --j3;
1592         while (compare2(array2[i3], t2) < 0) ++i3;
1593         while (compare2(array2[j3], t2) > 0) --j3;
1594       }
1595       if (compare2(array2[left], t2) === 0) swap(array2, left, j3);
1596       else ++j3, swap(array2, j3, right);
1597       if (j3 <= k3) left = j3 + 1;
1598       if (k3 <= j3) right = j3 - 1;
1599     }
1600     return array2;
1601   }
1602   function swap(array2, i3, j3) {
1603     const t2 = array2[i3];
1604     array2[i3] = array2[j3];
1605     array2[j3] = 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(a4, b3) {
1668     return [a4, b3];
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), k3 = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k3 * cos(adLambda), v3 = k3 * sdLambda * sin(adLambda);
1834     areaRingSum.add(atan2(v3, 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(a4, b3) {
1881     return a4[0] * b3[0] + a4[1] * b3[1] + a4[2] * b3[2];
1882   }
1883   function cartesianCross(a4, b3) {
1884     return [a4[1] * b3[2] - a4[2] * b3[1], a4[2] * b3[0] - a4[0] * b3[2], a4[0] * b3[1] - a4[1] * b3[0]];
1885   }
1886   function cartesianAddInPlace(a4, b3) {
1887     a4[0] += b3[0], a4[1] += b3[1], a4[2] += b3[2];
1888   }
1889   function cartesianScale(vector, k3) {
1890     return [vector[0] * k3, vector[1] * k3, vector[2] * k3];
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(a4, b3) {
1982     return a4[0] - b3[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, a4, b3, 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, a4 = ranges[0], merged = [a4]; i3 < n3; ++i3) {
1995         b3 = ranges[i3];
1996         if (rangeContains(a4, b3[0]) || rangeContains(a4, b3[1])) {
1997           if (angle(a4[0], b3[1]) > angle(a4[0], a4[1])) a4[1] = b3[1];
1998           if (angle(b3[0], a4[1]) > angle(a4[0], a4[1])) a4[0] = b3[0];
1999         } else {
2000           merged.push(a4 = b3);
2001         }
2002       }
2003       for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a4 = merged[n3]; i3 <= n3; a4 = b3, ++i3) {
2004         b3 = merged[i3];
2005         if ((delta = angle(a4[1], b3[0])) > deltaMax) deltaMax = delta, lambda02 = b3[0], lambda1 = a4[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(a4, b3) {
2049     function compose(x2, y2) {
2050       return x2 = a4(x2, y2), b3(x2[0], x2[1]);
2051     }
2052     if (a4.invert && b3.invert) compose.invert = function(x2, y2) {
2053       return x2 = b3.invert(x2, y2), x2 && a4.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, z3 = sin(phi), k3 = z3 * cosDeltaPhi + x2 * sinDeltaPhi;
2086       return [
2087         atan2(y2 * cosDeltaGamma - k3 * sinDeltaGamma, x2 * cosDeltaPhi - z3 * sinDeltaPhi),
2088         asin(k3 * cosDeltaGamma + y2 * sinDeltaGamma)
2089       ];
2090     }
2091     rotation.invert = function(lambda, phi) {
2092       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z3 = sin(phi), k3 = z3 * cosDeltaGamma - y2 * sinDeltaGamma;
2093       return [
2094         atan2(y2 * cosDeltaGamma + z3 * sinDeltaGamma, x2 * cosDeltaPhi + k3 * sinDeltaPhi),
2095         asin(k3 * 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, m3) {
2155         line.push([x2, y2, m3]);
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(a4, b3) {
2180     return abs(a4[0] - b3[0]) < epsilon && abs(a4[1] - b3[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, other, entry) {
2190     this.x = point;
2191     this.z = points;
2192     this.o = other;
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, a4 = array2[0], b3;
2257     while (++i3 < n3) {
2258       a4.n = b3 = array2[i3];
2259       b3.p = a4;
2260       a4 = b3;
2261     }
2262     a4.n = b3 = array2[0];
2263     b3.p = a4;
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 (!(m3 = (ring = polygon2[i3]).length)) continue;
2283       var ring, m3, point0 = ring[m3 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
2284       for (var j3 = 0; j3 < m3; ++j3, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
2285         var point1 = ring[j3], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k3 = sinPhi03 * sinPhi1;
2286         sum.add(atan2(k3 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k3 * 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, m3, 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 ((m3 = segment.length - 1) > 0) {
2384             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2385             sink.lineStart();
2386             for (i3 = 0; i3 < m3; ++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(a4, b3) {
2401     return ((a4 = a4.x)[0] < 0 ? a4[1] - halfPi - epsilon : halfPi - a4[1]) - ((b3 = b3.x)[0] < 0 ? b3[1] - halfPi - epsilon : halfPi - b3[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, v3 = visible(lambda, phi), c2 = smallRadius ? v3 ? 0 : code(lambda, phi) : v3 ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
2514           if (!point0 && (v00 = v0 = v3)) stream.lineStart();
2515           if (v3 !== v0) {
2516             point2 = intersect2(point0, point1);
2517             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
2518               point1[2] = 1;
2519           }
2520           if (v3 !== v0) {
2521             clean2 = 0;
2522             if (v3) {
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 ^ v3) {
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 (v3 && (!point0 || !pointEqual_default(point0, point1))) {
2550             stream.point(point1[0], point1[1]);
2551           }
2552           point0 = point1, v0 = v3, 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(a4, b3, two) {
2566       var pa = cartesian(a4), pb = cartesian(b3);
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 && a4;
2569       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A3 = cartesianScale(n1, c1), B3 = cartesianScale(n22, c2);
2570       cartesianAddInPlace(A3, B3);
2571       var u2 = n1xn2, w3 = cartesianDot(A3, u2), uu = cartesianDot(u2, u2), t2 = w3 * w3 - uu * (cartesianDot(A3, A3) - 1);
2572       if (t2 < 0) return;
2573       var t3 = sqrt(t2), q3 = cartesianScale(u2, (-w3 - t3) / uu);
2574       cartesianAddInPlace(q3, A3);
2575       q3 = spherical(q3);
2576       if (!two) return q3;
2577       var lambda04 = a4[0], lambda12 = b3[0], phi02 = a4[1], phi12 = b3[1], z3;
2578       if (lambda12 < lambda04) z3 = lambda04, lambda04 = lambda12, lambda12 = z3;
2579       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
2580       if (!polar && phi12 < phi02) z3 = phi02, phi02 = phi12, phi12 = z3;
2581       if (meridian ? polar ? phi02 + phi12 > 0 ^ q3[1] < (abs(q3[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q3[1] && q3[1] <= phi12 : delta2 > pi ^ (lambda04 <= q3[0] && q3[0] <= lambda12)) {
2582         var q1 = cartesianScale(u2, (-w3 + t3) / uu);
2583         cartesianAddInPlace(q1, A3);
2584         return [q3, 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(a4, b3, x05, y05, x12, y12) {
2609     var ax = a4[0], ay = a4[1], bx = b3[0], by = b3[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) a4[0] = ax + t02 * dx, a4[1] = ay + t02 * dy;
2651     if (t12 < 1) b3[0] = ax + t12 * dx, b3[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 a4 = 0, a1 = 0;
2666       if (from == null || (a4 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
2667         do
2668           stream.point(a4 === 0 || a4 === 3 ? x05 : x12, a4 > 1 ? y12 : y05);
2669         while ((a4 = (a4 + 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(a4, b3) {
2678       return comparePoint(a4.x, b3.x);
2679     }
2680     function comparePoint(a4, b3) {
2681       var ca = corner(a4, 1), cb = corner(b3, 1);
2682       return ca !== cb ? ca - cb : ca === 0 ? b3[1] - a4[1] : ca === 1 ? a4[0] - b3[0] : ca === 2 ? a4[1] - b3[1] : b3[0] - a4[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], j3 = 1, m3 = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j3 < m3; ++j3) {
2700             a0 = b0, a1 = b1, point2 = ring2[j3], 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 v3 = visible(x2, y2);
2747         if (polygon2) ring.push([x2, y2]);
2748         if (first) {
2749           x__ = x2, y__ = y2, v__ = v3;
2750           first = false;
2751           if (v3) {
2752             activeStream.lineStart();
2753             activeStream.point(x2, y2);
2754           }
2755         } else {
2756           if (v3 && v_) activeStream.point(x2, y2);
2757           else {
2758             var a4 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b3 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))];
2759             if (line_default(a4, b3, x05, y05, x12, y12)) {
2760               if (!v_) {
2761                 activeStream.lineStart();
2762                 activeStream.point(a4[0], a4[1]);
2763               }
2764               activeStream.point(b3[0], b3[1]);
2765               if (!v3) activeStream.lineEnd();
2766               clean2 = false;
2767             } else if (v3) {
2768               activeStream.lineStart();
2769               activeStream.point(x2, y2);
2770               clean2 = false;
2771             }
2772           }
2773         }
2774         x_ = x2, y_ = y2, v_ = v3;
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, z3 = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
2808     lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z3));
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, z3 = sqrt(dx * dx + dy * dy);
2934     X1 += z3 * (x03 + x2) / 2;
2935     Y1 += z3 * (y03 + y2) / 2;
2936     Z1 += z3;
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, z3 = sqrt(dx * dx + dy * dy);
2954     X1 += z3 * (x03 + x2) / 2;
2955     Y1 += z3 * (y03 + y2) / 2;
2956     Z1 += z3;
2957     z3 = y03 * x2 - x03 * y2;
2958     X2 += z3 * (x03 + x2);
2959     Y2 += z3 * (y03 + y2);
2960     Z2 += z3 * 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(_3) {
3010           return this._radius = _3, 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 j3 = strings.length; i3 < j3; ++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 k3 = 10 ** d2;
3104       cacheDigits = d2;
3105       cacheAppend = function append2(strings) {
3106         let i3 = 1;
3107         this._ += strings[0];
3108         for (const j3 = strings.length; i3 < j3; ++i3) {
3109           this._ += Math.round(arguments[i3] * k3) / k3 + 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(_3) {
3125           this._radius = +_3;
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(_3) {
3205       if (!arguments.length) return projection2;
3206       projectionStream = _3 == null ? (projection2 = null, identity_default) : (projection2 = _3).stream;
3207       return path;
3208     };
3209     path.context = function(_3) {
3210       if (!arguments.length) return context;
3211       contextStream = _3 == null ? (context = null, new PathString(digits)) : new PathContext(context = _3);
3212       if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
3213       return path;
3214     };
3215     path.pointRadius = function(_3) {
3216       if (!arguments.length) return pointRadius;
3217       pointRadius = typeof _3 === "function" ? _3 : (contextStream.pointRadius(+_3), +_3);
3218       return path;
3219     };
3220     path.digits = function(_3) {
3221       if (!arguments.length) return digits;
3222       if (_3 == null) digits = null;
3223       else {
3224         const d2 = Math.floor(_3);
3225         if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_3}`);
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(b3) {
3300       var w3 = extent[1][0] - extent[0][0], h3 = extent[1][1] - extent[0][1], k3 = Math.min(w3 / (b3[1][0] - b3[0][0]), h3 / (b3[1][1] - b3[0][1])), x2 = +extent[0][0] + (w3 - k3 * (b3[1][0] + b3[0][0])) / 2, y2 = +extent[0][1] + (h3 - k3 * (b3[1][1] + b3[0][1])) / 2;
3301       projection2.scale(150 * k3).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(b3) {
3309       var w3 = +width, k3 = w3 / (b3[1][0] - b3[0][0]), x2 = (w3 - k3 * (b3[1][0] + b3[0][0])) / 2, y2 = -k3 * b3[0][1];
3310       projection2.scale(150 * k3).translate([x2, y2]);
3311     }, object);
3312   }
3313   function fitHeight(projection2, height, object) {
3314     return fit(projection2, function(b3) {
3315       var h3 = +height, k3 = h3 / (b3[1][1] - b3[0][1]), x2 = -k3 * b3[0][0], y2 = (h3 - k3 * (b3[1][1] + b3[0][1])) / 2;
3316       projection2.scale(150 * k3).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 a4 = a0 + a1, b3 = b0 + b1, c2 = c0 + c1, m3 = sqrt(a4 * a4 + b3 * b3 + c2 * c2), phi2 = asin(c2 /= m3), lambda22 = abs(abs(c2) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b3, a4), 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, a4 /= m3, b3 /= m3, c2, depth, stream);
3345           stream.point(x2, y2);
3346           resampleLineTo(x2, y2, lambda22, a4, b3, 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(k3, dx, dy, sx, sy) {
3421     function transform2(x2, y2) {
3422       x2 *= sx;
3423       y2 *= sy;
3424       return [dx + k3 * x2, dy - k3 * y2];
3425     }
3426     transform2.invert = function(x2, y2) {
3427       return [(x2 - dx) / k3 * sx, (dy - y2) / k3 * sy];
3428     };
3429     return transform2;
3430   }
3431   function scaleTranslateRotate(k3, dx, dy, sx, sy, alpha) {
3432     if (!alpha) return scaleTranslate(k3, dx, dy, sx, sy);
3433     var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a4 = cosAlpha * k3, b3 = sinAlpha * k3, ai = cosAlpha / k3, bi = sinAlpha / k3, ci = (sinAlpha * dy - cosAlpha * dx) / k3, fi = (sinAlpha * dx + cosAlpha * dy) / k3;
3434     function transform2(x2, y2) {
3435       x2 *= sx;
3436       y2 *= sy;
3437       return [a4 * x2 - b3 * y2 + dx, dy - b3 * x2 - a4 * 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, k3 = 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(_3) {
3462       return arguments.length ? (preclip = _3, theta = void 0, reset()) : preclip;
3463     };
3464     projection2.postclip = function(_3) {
3465       return arguments.length ? (postclip = _3, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3466     };
3467     projection2.clipAngle = function(_3) {
3468       return arguments.length ? (preclip = +_3 ? circle_default(theta = _3 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
3469     };
3470     projection2.clipExtent = function(_3) {
3471       return arguments.length ? (postclip = _3 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_3[0][0], y05 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3472     };
3473     projection2.scale = function(_3) {
3474       return arguments.length ? (k3 = +_3, recenter()) : k3;
3475     };
3476     projection2.translate = function(_3) {
3477       return arguments.length ? (x2 = +_3[0], y2 = +_3[1], recenter()) : [x2, y2];
3478     };
3479     projection2.center = function(_3) {
3480       return arguments.length ? (lambda = _3[0] % 360 * radians, phi = _3[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
3481     };
3482     projection2.rotate = function(_3) {
3483       return arguments.length ? (deltaLambda = _3[0] % 360 * radians, deltaPhi = _3[1] % 360 * radians, deltaGamma = _3.length > 2 ? _3[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
3484     };
3485     projection2.angle = function(_3) {
3486       return arguments.length ? (alpha = _3 % 360 * radians, recenter()) : alpha * degrees;
3487     };
3488     projection2.reflectX = function(_3) {
3489       return arguments.length ? (sx = _3 ? -1 : 1, recenter()) : sx < 0;
3490     };
3491     projection2.reflectY = function(_3) {
3492       return arguments.length ? (sy = _3 ? -1 : 1, recenter()) : sy < 0;
3493     };
3494     projection2.precision = function(_3) {
3495       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _3 * _3), 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(k3, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k3, 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 m3 = projection(project), center = m3.center, scale = m3.scale, translate = m3.translate, clipExtent = m3.clipExtent, x05 = null, y05, x12, y12;
3557     m3.scale = function(_3) {
3558       return arguments.length ? (scale(_3), reclip()) : scale();
3559     };
3560     m3.translate = function(_3) {
3561       return arguments.length ? (translate(_3), reclip()) : translate();
3562     };
3563     m3.center = function(_3) {
3564       return arguments.length ? (center(_3), reclip()) : center();
3565     };
3566     m3.clipExtent = function(_3) {
3567       return arguments.length ? (_3 == null ? x05 = y05 = x12 = y12 = null : (x05 = +_3[0][0], y05 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3568     };
3569     function reclip() {
3570       var k3 = pi * scale(), t2 = m3(rotation_default(m3.rotate()).invert([0, 0]));
3571       return clipExtent(x05 == null ? [[t2[0] - k3, t2[1] - k3], [t2[0] + k3, t2[1] + k3]] : project === mercatorRaw ? [[Math.max(t2[0] - k3, x05), y05], [Math.min(t2[0] + k3, x12), y12]] : [[x05, Math.max(t2[1] - k3, y05)], [x12, Math.min(t2[1] + k3, 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 k3 = 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 = k3 * sx;
3596       ky = k3 * 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(_3) {
3622       return arguments.length ? (postclip = _3, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3623     };
3624     projection2.clipExtent = function(_3) {
3625       return arguments.length ? (postclip = _3 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_3[0][0], y05 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3626     };
3627     projection2.scale = function(_3) {
3628       return arguments.length ? (k3 = +_3, reset()) : k3;
3629     };
3630     projection2.translate = function(_3) {
3631       return arguments.length ? (tx = +_3[0], ty = +_3[1], reset()) : [tx, ty];
3632     };
3633     projection2.angle = function(_3) {
3634       return arguments.length ? (alpha = _3 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
3635     };
3636     projection2.reflectX = function(_3) {
3637       return arguments.length ? (sx = _3 ? -1 : 1, reset()) : sx < 0;
3638     };
3639     projection2.reflectY = function(_3) {
3640       return arguments.length ? (sy = _3 ? -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(m3) {
3702     return m3 / (TAU * POLAR_RADIUS / 360);
3703   }
3704   function geoMetersToLon(m3, atLat) {
3705     return Math.abs(atLat) >= 90 ? 0 : m3 / (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(a4, b3) {
3722     var x2 = geoLonToMeters(a4[0] - b3[0], (a4[1] + b3[1]) / 2);
3723     var y2 = geoLatToMeters(a4[1] - b3[1]);
3724     return Math.sqrt(x2 * x2 + y2 * y2);
3725   }
3726   function geoScaleToZoom(k3, tileSize) {
3727     tileSize = tileSize || 256;
3728     var log2ts = Math.log(tileSize) * Math.LOG2E;
3729     return Math.log(k3 * TAU) / Math.LN2 - log2ts;
3730   }
3731   function geoZoomToScale(z3, tileSize) {
3732     tileSize = tileSize || 256;
3733     return tileSize * Math.pow(2, z3) / 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 a22 = this.area();
3841           if (a1 === Infinity || a22 === Infinity) {
3842             return 0;
3843           } else if (a1 === 0 || a22 === 0) {
3844             if (obj.contains(this)) {
3845               return 1;
3846             }
3847             return 0;
3848           } else {
3849             return a1 / a22;
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, a4, b3 = polygon2[n3 - 1], area = 0;
3879     while (++i3 < n3) {
3880       a4 = b3;
3881       b3 = polygon2[i3];
3882       area += a4[1] * b3[0] - a4[0] * b3[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, a4, b3 = polygon2[n3 - 1], c2, k3 = 0;
3894     while (++i3 < n3) {
3895       a4 = b3;
3896       b3 = polygon2[i3];
3897       k3 += c2 = a4[0] * b3[1] - b3[0] * a4[1];
3898       x2 += (a4[0] + b3[0]) * c2;
3899       y2 += (a4[1] + b3[1]) * c2;
3900     }
3901     return k3 *= 3, [x2 / k3, y2 / k3];
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(a4, b3, c2) {
3910     return (b3[0] - a4[0]) * (c2[1] - a4[1]) - (b3[1] - a4[1]) * (c2[0] - a4[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(a4, b3) {
3919     return a4[0] - b3[0] || a4[1] - b3[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(a4, b3, epsilon3) {
3976     if (epsilon3) {
3977       return Math.abs(a4[0] - b3[0]) <= epsilon3 && Math.abs(a4[1] - b3[1]) <= epsilon3;
3978     } else {
3979       return a4[0] === b3[0] && a4[1] === b3[1];
3980     }
3981   }
3982   function geoVecAdd(a4, b3) {
3983     return [a4[0] + b3[0], a4[1] + b3[1]];
3984   }
3985   function geoVecSubtract(a4, b3) {
3986     return [a4[0] - b3[0], a4[1] - b3[1]];
3987   }
3988   function geoVecScale(a4, mag) {
3989     return [a4[0] * mag, a4[1] * mag];
3990   }
3991   function geoVecFloor(a4) {
3992     return [Math.floor(a4[0]), Math.floor(a4[1])];
3993   }
3994   function geoVecInterp(a4, b3, t2) {
3995     return [
3996       a4[0] + (b3[0] - a4[0]) * t2,
3997       a4[1] + (b3[1] - a4[1]) * t2
3998     ];
3999   }
4000   function geoVecLength(a4, b3) {
4001     return Math.sqrt(geoVecLengthSquare(a4, b3));
4002   }
4003   function geoVecLengthSquare(a4, b3) {
4004     b3 = b3 || [0, 0];
4005     var x2 = a4[0] - b3[0];
4006     var y2 = a4[1] - b3[1];
4007     return x2 * x2 + y2 * y2;
4008   }
4009   function geoVecNormalize(a4) {
4010     var length2 = Math.sqrt(a4[0] * a4[0] + a4[1] * a4[1]);
4011     if (length2 !== 0) {
4012       return geoVecScale(a4, 1 / length2);
4013     }
4014     return [0, 0];
4015   }
4016   function geoVecAngle(a4, b3) {
4017     return Math.atan2(b3[1] - a4[1], b3[0] - a4[0]);
4018   }
4019   function geoVecDot(a4, b3, origin) {
4020     origin = origin || [0, 0];
4021     var p2 = geoVecSubtract(a4, origin);
4022     var q3 = geoVecSubtract(b3, origin);
4023     return p2[0] * q3[0] + p2[1] * q3[1];
4024   }
4025   function geoVecNormalizedDot(a4, b3, origin) {
4026     origin = origin || [0, 0];
4027     var p2 = geoVecNormalize(geoVecSubtract(a4, origin));
4028     var q3 = geoVecNormalize(geoVecSubtract(b3, origin));
4029     return geoVecDot(p2, q3);
4030   }
4031   function geoVecCross(a4, b3, origin) {
4032     origin = origin || [0, 0];
4033     var p2 = geoVecSubtract(a4, origin);
4034     var q3 = geoVecSubtract(b3, origin);
4035     return p2[0] * q3[1] - p2[1] * q3[0];
4036   }
4037   function geoVecProject(a4, 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 v3 = geoVecSubtract(a4, o2);
4045       var proj = geoVecDot(v3, 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, a4);
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(a4, b3, projection2) {
4093     return geoVecAngle(projection2(a4.loc), projection2(b3.loc));
4094   }
4095   function geoEdgeEqual(a4, b3) {
4096     return a4[0] === b3[0] && a4[1] === b3[1] || a4[0] === b3[1] && a4[1] === b3[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 v3 = geoVecSubtract(point, o2);
4123       var proj = geoVecDot(v3, 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 j3, k3, n1, n22, segment;
4149     for (j3 = 0; j3 < activeNodes.length - 1; j3++) {
4150       n1 = activeNodes[j3];
4151       n22 = activeNodes[j3 + 1];
4152       segment = [n1.loc, n22.loc];
4153       if (n1.id === activeID || n22.id === activeID) {
4154         actives.push(segment);
4155       }
4156     }
4157     for (j3 = 0; j3 < inactiveNodes.length - 1; j3++) {
4158       n1 = inactiveNodes[j3];
4159       n22 = inactiveNodes[j3 + 1];
4160       segment = [n1.loc, n22.loc];
4161       inactives.push(segment);
4162     }
4163     for (j3 = 0; j3 < actives.length; j3++) {
4164       for (k3 = 0; k3 < inactives.length; k3++) {
4165         var p2 = actives[j3];
4166         var q3 = inactives[k3];
4167         var hit = geoLineIntersection(p2, q3);
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 j3, k3;
4179     for (j3 = 0; j3 < nodes.length - 1; j3++) {
4180       var n1 = nodes[j3];
4181       var n22 = nodes[j3 + 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 (j3 = 0; j3 < actives.length; j3++) {
4190       for (k3 = 0; k3 < inactives.length; k3++) {
4191         var p2 = actives[j3];
4192         var q3 = inactives[k3];
4193         if (geoVecEqual(p2[1], q3[0]) || geoVecEqual(p2[0], q3[1]) || geoVecEqual(p2[0], q3[0]) || geoVecEqual(p2[1], q3[1])) {
4194           continue;
4195         }
4196         var hit = geoLineIntersection(p2, q3);
4197         if (hit) {
4198           var epsilon3 = 1e-8;
4199           if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q3[1], hit, epsilon3) || geoVecEqual(q3[0], hit, epsilon3)) {
4200             continue;
4201           } else {
4202             return true;
4203           }
4204         }
4205       }
4206     }
4207     return false;
4208   }
4209   function geoLineIntersection(a4, b3) {
4210     var p2 = [a4[0][0], a4[0][1]];
4211     var p22 = [a4[1][0], a4[1][1]];
4212     var q3 = [b3[0][0], b3[0][1]];
4213     var q22 = [b3[1][0], b3[1][1]];
4214     var r2 = geoVecSubtract(p22, p2);
4215     var s2 = geoVecSubtract(q22, q3);
4216     var uNumerator = geoVecCross(geoVecSubtract(q3, p2), r2);
4217     var denominator = geoVecCross(r2, s2);
4218     if (uNumerator && denominator) {
4219       var u2 = uNumerator / denominator;
4220       var t2 = geoVecCross(geoVecSubtract(q3, 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 j3 = 0; j3 < path2.length - 1; j3++) {
4231         var a4 = [path1[i3], path1[i3 + 1]];
4232         var b3 = [path2[j3], path2[j3 + 1]];
4233         var hit = geoLineIntersection(a4, b3);
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 j3 = 0; j3 < path2.length - 1; j3++) {
4244         var a4 = [path1[i3], path1[i3 + 1]];
4245         var b3 = [path2[j3], path2[j3 + 1]];
4246         var hit = geoLineIntersection(a4, b3);
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, j3 = polygon2.length - 1; i3 < polygon2.length; j3 = i3++) {
4259       var xi = polygon2[i3][0];
4260       var yi = polygon2[i3][1];
4261       var xj = polygon2[j3][0];
4262       var yj = polygon2[j3][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, _3 = {}, t2; i3 < n3; ++i3) {
4349       if (!(t2 = arguments[i3] + "") || t2 in _3 || /[\s.]/.test(t2)) throw new Error("illegal type: " + t2);
4350       _3[t2] = [];
4351     }
4352     return new Dispatch(_3);
4353   }
4354   function Dispatch(_3) {
4355     this._ = _3;
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 _3 = this._, T3 = parseTypenames(typename + "", _3), t2, i3 = -1, n3 = T3.length;
4391           if (arguments.length < 2) {
4392             while (++i3 < n3) if ((t2 = (typename = T3[i3]).type) && (t2 = get(_3[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 = T3[i3]).type) _3[t2] = set(_3[t2], typename.name, callback);
4398             else if (callback == null) for (t2 in _3) _3[t2] = set(_3[t2], typename.name, null);
4399           }
4400           return this;
4401         },
4402         copy: function() {
4403           var copy2 = {}, _3 = this._;
4404           for (var t2 in _3) copy2[t2] = _3[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, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4495       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = 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, m3 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m3; ++j3) {
4544       for (var group = groups[j3], 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, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4621       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], 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(parent2, datum2) {
4650     this.ownerDocument = parent2.ownerDocument;
4651     this.namespaceURI = parent2.namespaceURI;
4652     this._next = null;
4653     this._parent = parent2;
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(parent2, 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(parent2, data[i3]);
4698       }
4699     }
4700     for (; i3 < groupLength; ++i3) {
4701       if (node = group[i3]) {
4702         exit[i3] = node;
4703       }
4704     }
4705   }
4706   function bindKey(parent2, 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(parent2, 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(parent2, 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 m3 = groups.length, update = new Array(m3), enter = new Array(m3), exit = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4742       var parent2 = parents[j3], group = groups[j3], groupLength = group.length, data = arraylike(value.call(parent2, parent2 && parent2.__data__, j3, parents)), dataLength = data.length, enterGroup = enter[j3] = new Array(dataLength), updateGroup = update[j3] = new Array(dataLength), exitGroup = exit[j3] = new Array(groupLength);
4743       bind(parent2, 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, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) {
4805       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge3 = merges[j3] = 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 (; j3 < m0; ++j3) {
4812       merges[j3] = groups0[j3];
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, j3 = -1, m3 = groups.length; ++j3 < m3; ) {
4825       for (var group = groups[j3], 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(a4, b3) {
4843       return a4 && b3 ? compare2(a4.__data__, b3.__data__) : !a4 - !b3;
4844     }
4845     for (var groups = this._groups, m3 = groups.length, sortgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4846       for (var group = groups[j3], n3 = group.length, sortgroup = sortgroups[j3] = 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(a4, b3) {
4856     return a4 < b3 ? -1 : a4 > b3 ? 1 : a4 >= b3 ? 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, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
4888       for (var group = groups[j3], 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, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
4923       for (var group = groups[j3], 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 v3 = value.apply(this, arguments);
4958       if (v3 == null) this.removeAttribute(name);
4959       else this.setAttribute(name, v3);
4960     };
4961   }
4962   function attrFunctionNS(fullname, value) {
4963     return function() {
4964       var v3 = value.apply(this, arguments);
4965       if (v3 == null) this.removeAttributeNS(fullname.space, fullname.local);
4966       else this.setAttributeNS(fullname.space, fullname.local, v3);
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 v3 = value.apply(this, arguments);
5006       if (v3 == null) this.style.removeProperty(name);
5007       else this.style.setProperty(name, v3, 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 v3 = value.apply(this, arguments);
5036       if (v3 == null) delete this[name];
5037       else this[name] = v3;
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 list = classList(node), i3 = -1, n3 = names.length;
5061     while (++i3 < n3) list.add(names[i3]);
5062   }
5063   function classedRemove(node, names) {
5064     var list = classList(node), i3 = -1, n3 = names.length;
5065     while (++i3 < n3) list.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 list = classList(this.node()), i3 = -1, n3 = names.length;
5086       while (++i3 < n3) if (!list.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 v3 = value.apply(this, arguments);
5127       this.textContent = v3 == null ? "" : v3;
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 v3 = value.apply(this, arguments);
5150       this.innerHTML = v3 == null ? "" : v3;
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 parent2 = this.parentNode;
5218     if (parent2) parent2.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), parent2 = this.parentNode;
5231     return parent2 ? parent2.insertBefore(clone2, this.nextSibling) : clone2;
5232   }
5233   function selection_cloneDeep() {
5234     var clone2 = this.cloneNode(true), parent2 = this.parentNode;
5235     return parent2 ? parent2.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 j3 = 0, i3 = -1, m3 = on.length, o2; j3 < m3; ++j3) {
5272         if (o2 = on[j3], (!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, options) {
5283     return function() {
5284       var on = this.__on, o2, listener = contextListener(value);
5285       if (on) for (var j3 = 0, m3 = on.length; j3 < m3; ++j3) {
5286         if ((o2 = on[j3]).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 = options);
5289           o2.value = value;
5290           return;
5291         }
5292       }
5293       this.addEventListener(typename.type, listener, options);
5294       o2 = { type: typename.type, name: typename.name, value, listener, options };
5295       if (!on) this.__on = [o2];
5296       else on.push(o2);
5297     };
5298   }
5299   function on_default(typename, value, options) {
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 j3 = 0, m3 = on.length, o2; j3 < m3; ++j3) {
5304         for (i3 = 0, o2 = on[j3]; 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, options));
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, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
5355       for (var group = groups[j3], 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(_3) {
5744       return arguments.length ? (filter2 = typeof _3 === "function" ? _3 : constant_default2(!!_3), drag) : filter2;
5745     };
5746     drag.container = function(_3) {
5747       return arguments.length ? (container = typeof _3 === "function" ? _3 : constant_default2(_3), drag) : container;
5748     };
5749     drag.subject = function(_3) {
5750       return arguments.length ? (subject = typeof _3 === "function" ? _3 : constant_default2(_3), drag) : subject;
5751     };
5752     drag.touchable = function(_3) {
5753       return arguments.length ? (touchable = typeof _3 === "function" ? _3 : constant_default2(!!_3), 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(_3) {
5760       return arguments.length ? (clickDistance2 = (_3 = +_3) * _3, 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(parent2, definition) {
5789     var prototype4 = Object.create(parent2.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 m3, l2;
5815     format2 = (format2 + "").trim().toLowerCase();
5816     return (m3 = reHex.exec(format2)) ? (l2 = m3[1].length, m3 = parseInt(m3[1], 16), l2 === 6 ? rgbn(m3) : l2 === 3 ? new Rgb(m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, (m3 & 15) << 4 | m3 & 15, 1) : l2 === 8 ? rgba(m3 >> 24 & 255, m3 >> 16 & 255, m3 >> 8 & 255, (m3 & 255) / 255) : l2 === 4 ? rgba(m3 >> 12 & 15 | m3 >> 8 & 240, m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, ((m3 & 15) << 4 | m3 & 15) / 255) : null) : (m3 = reRgbInteger.exec(format2)) ? new Rgb(m3[1], m3[2], m3[3], 1) : (m3 = reRgbPercent.exec(format2)) ? new Rgb(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, 1) : (m3 = reRgbaInteger.exec(format2)) ? rgba(m3[1], m3[2], m3[3], m3[4]) : (m3 = reRgbaPercent.exec(format2)) ? rgba(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, m3[4]) : (m3 = reHslPercent.exec(format2)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, 1) : (m3 = reHslaPercent.exec(format2)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, m3[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, b3, a4) {
5822     if (a4 <= 0) r2 = g3 = b3 = NaN;
5823     return new Rgb(r2, g3, b3, a4);
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, b3, opacity) {
5832     return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b3, opacity == null ? 1 : opacity);
5833   }
5834   function Rgb(r2, g3, b3, opacity) {
5835     this.r = +r2;
5836     this.g = +g3;
5837     this.b = +b3;
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 a4 = clampa(this.opacity);
5848     return `${a4 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a4 === 1 ? ")" : `, ${a4})`}`;
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(h3, s2, l2, a4) {
5861     if (a4 <= 0) h3 = s2 = l2 = NaN;
5862     else if (l2 <= 0 || l2 >= 1) h3 = s2 = NaN;
5863     else if (s2 <= 0) h3 = NaN;
5864     return new Hsl(h3, s2, l2, a4);
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, b3 = o2.b / 255, min3 = Math.min(r2, g3, b3), max3 = Math.max(r2, g3, b3), h3 = NaN, s2 = max3 - min3, l2 = (max3 + min3) / 2;
5873     if (s2) {
5874       if (r2 === max3) h3 = (g3 - b3) / s2 + (g3 < b3) * 6;
5875       else if (g3 === max3) h3 = (b3 - r2) / s2 + 2;
5876       else h3 = (r2 - g3) / s2 + 4;
5877       s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
5878       h3 *= 60;
5879     } else {
5880       s2 = l2 > 0 && l2 < 1 ? 0 : h3;
5881     }
5882     return new Hsl(h3, s2, l2, o2.opacity);
5883   }
5884   function hsl(h3, s2, l2, opacity) {
5885     return arguments.length === 1 ? hslConvert(h3) : new Hsl(h3, s2, l2, opacity == null ? 1 : opacity);
5886   }
5887   function Hsl(h3, s2, l2, opacity) {
5888     this.h = +h3;
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(h3, m1, m22) {
5901     return (h3 < 60 ? m1 + (m22 - m1) * h3 / 60 : h3 < 180 ? m22 : h3 < 240 ? m1 + (m22 - m1) * (240 - h3) / 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(k3) {
6086           k3 = k3 == null ? brighter : Math.pow(brighter, k3);
6087           return new Rgb(this.r * k3, this.g * k3, this.b * k3, this.opacity);
6088         },
6089         darker(k3) {
6090           k3 = k3 == null ? darker : Math.pow(darker, k3);
6091           return new Rgb(this.r * k3, this.g * k3, this.b * k3, 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(k3) {
6111           k3 = k3 == null ? brighter : Math.pow(brighter, k3);
6112           return new Hsl(this.h, this.s, this.l * k3, this.opacity);
6113         },
6114         darker(k3) {
6115           k3 = k3 == null ? darker : Math.pow(darker, k3);
6116           return new Hsl(this.h, this.s, this.l * k3, this.opacity);
6117         },
6118         rgb() {
6119           var h3 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h3) || isNaN(this.s) ? 0 : this.s, l2 = this.l, m22 = l2 + (l2 < 0.5 ? l2 : 1 - l2) * s2, m1 = 2 * l2 - m22;
6120           return new Rgb(
6121             hsl2rgb(h3 >= 240 ? h3 - 240 : h3 + 120, m1, m22),
6122             hsl2rgb(h3, m1, m22),
6123             hsl2rgb(h3 < 120 ? h3 + 240 : h3 - 120, m1, m22),
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 a4 = clampa(this.opacity);
6135           return `${a4 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a4 === 1 ? ")" : `, ${a4})`}`;
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, v22, 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) * v22 + 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], v22 = values[i3 + 1], v0 = i3 > 0 ? values[i3 - 1] : 2 * v1 - v22, v3 = i3 < n3 - 1 ? values[i3 + 2] : 2 * v22 - v1;
6157       return basis((t2 - i3 / n3) * n3, v0, v1, v22, 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], v22 = values[(i3 + 1) % n3], v3 = values[(i3 + 2) % n3];
6170       return basis((t2 - i3 / n3) * n3, v0, v1, v22, 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(a4, d2) {
6189     return function(t2) {
6190       return a4 + t2 * d2;
6191     };
6192   }
6193   function exponential(a4, b3, y2) {
6194     return a4 = Math.pow(a4, y2), b3 = Math.pow(b3, y2) - a4, y2 = 1 / y2, function(t2) {
6195       return Math.pow(a4 + t2 * b3, y2);
6196     };
6197   }
6198   function gamma(y2) {
6199     return (y2 = +y2) === 1 ? nogamma : function(a4, b3) {
6200       return b3 - a4 ? exponential(a4, b3, y2) : constant_default3(isNaN(a4) ? b3 : a4);
6201     };
6202   }
6203   function nogamma(a4, b3) {
6204     var d2 = b3 - a4;
6205     return d2 ? linear(a4, d2) : constant_default3(isNaN(a4) ? b3 : a4);
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), b3 = 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         b3[i3] = color2.b || 0;
6222       }
6223       r2 = spline(r2);
6224       g3 = spline(g3);
6225       b3 = spline(b3);
6226       color2.opacity = 1;
6227       return function(t2) {
6228         color2.r = r2(t2);
6229         color2.g = g3(t2);
6230         color2.b = b3(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), b3 = 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 = b3(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(a4, b3) {
6264     if (!b3) b3 = [];
6265     var n3 = a4 ? Math.min(b3.length, a4.length) : 0, c2 = b3.slice(), i3;
6266     return function(t2) {
6267       for (i3 = 0; i3 < n3; ++i3) c2[i3] = a4[i3] * (1 - t2) + b3[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(a4, b3) {
6281     var nb = b3 ? b3.length : 0, na = a4 ? Math.min(nb, a4.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
6282     for (i3 = 0; i3 < na; ++i3) x2[i3] = value_default(a4[i3], b3[i3]);
6283     for (; i3 < nb; ++i3) c2[i3] = b3[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(a4, b3) {
6297     var d2 = /* @__PURE__ */ new Date();
6298     return a4 = +a4, b3 = +b3, function(t2) {
6299       return d2.setTime(a4 * (1 - t2) + b3 * 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(a4, b3) {
6309     return a4 = +a4, b3 = +b3, function(t2) {
6310       return a4 * (1 - t2) + b3 * 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(a4, b3) {
6320     var i3 = {}, c2 = {}, k3;
6321     if (a4 === null || typeof a4 !== "object") a4 = {};
6322     if (b3 === null || typeof b3 !== "object") b3 = {};
6323     for (k3 in b3) {
6324       if (k3 in a4) {
6325         i3[k3] = value_default(a4[k3], b3[k3]);
6326       } else {
6327         c2[k3] = b3[k3];
6328       }
6329     }
6330     return function(t2) {
6331       for (k3 in i3) c2[k3] = i3[k3](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(b3) {
6343     return function() {
6344       return b3;
6345     };
6346   }
6347   function one(b3) {
6348     return function(t2) {
6349       return b3(t2) + "";
6350     };
6351   }
6352   function string_default(a4, b3) {
6353     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q3 = [];
6354     a4 = a4 + "", b3 = b3 + "";
6355     while ((am = reA.exec(a4)) && (bm = reB.exec(b3))) {
6356       if ((bs = bm.index) > bi) {
6357         bs = b3.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         q3.push({ i: i3, x: number_default(am, bm) });
6367       }
6368       bi = reB.lastIndex;
6369     }
6370     if (bi < b3.length) {
6371       bs = b3.slice(bi);
6372       if (s2[i3]) s2[i3] += bs;
6373       else s2[++i3] = bs;
6374     }
6375     return s2.length < 2 ? q3[0] ? one(q3[0].x) : zero2(b3) : (b3 = q3.length, function(t2) {
6376       for (var i4 = 0, o2; i4 < b3; ++i4) s2[(o2 = q3[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(a4, b3) {
6391     var t2 = typeof b3, c2;
6392     return b3 == null || t2 === "boolean" ? constant_default3(b3) : (t2 === "number" ? number_default : t2 === "string" ? (c2 = color(b3)) ? (b3 = c2, rgb_default) : string_default : b3 instanceof color ? rgb_default : b3 instanceof Date ? date_default : isNumberArray(b3) ? numberArray_default : Array.isArray(b3) ? genericArray : typeof b3.valueOf !== "function" && typeof b3.toString !== "function" || isNaN(b3) ? object_default : number_default)(a4, b3);
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(a4, b3) {
6410     return a4 = +a4, b3 = +b3, function(t2) {
6411       return Math.round(a4 * (1 - t2) + b3 * 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(a4, b3, c2, d2, e3, f2) {
6421     var scaleX, scaleY, skewX;
6422     if (scaleX = Math.sqrt(a4 * a4 + b3 * b3)) a4 /= scaleX, b3 /= scaleX;
6423     if (skewX = a4 * c2 + b3 * d2) c2 -= a4 * skewX, d2 -= b3 * skewX;
6424     if (scaleY = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
6425     if (a4 * d2 < b3 * c2) a4 = -a4, b3 = -b3, skewX = -skewX, scaleX = -scaleX;
6426     return {
6427       translateX: e3,
6428       translateY: f2,
6429       rotate: Math.atan2(b3, a4) * 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 m3 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
6453     return m3.isIdentity ? identity : decompose_default(m3.a, m3.b, m3.c, m3.d, m3.e, m3.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, q3) {
6476       if (xa !== xb || ya !== yb) {
6477         var i3 = s2.push("translate(", null, pxComma, null, pxParen);
6478         q3.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(a4, b3, s2, q3) {
6484       if (a4 !== b3) {
6485         if (a4 - b3 > 180) b3 += 360;
6486         else if (b3 - a4 > 180) a4 += 360;
6487         q3.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a4, b3) });
6488       } else if (b3) {
6489         s2.push(pop(s2) + "rotate(" + b3 + degParen);
6490       }
6491     }
6492     function skewX(a4, b3, s2, q3) {
6493       if (a4 !== b3) {
6494         q3.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a4, b3) });
6495       } else if (b3) {
6496         s2.push(pop(s2) + "skewX(" + b3 + degParen);
6497       }
6498     }
6499     function scale(xa, ya, xb, yb, s2, q3) {
6500       if (xa !== xb || ya !== yb) {
6501         var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
6502         q3.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(a4, b3) {
6508       var s2 = [], q3 = [];
6509       a4 = parse(a4), b3 = parse(b3);
6510       translate(a4.translateX, a4.translateY, b3.translateX, b3.translateY, s2, q3);
6511       rotate(a4.rotate, b3.rotate, s2, q3);
6512       skewX(a4.skewX, b3.skewX, s2, q3);
6513       scale(a4.scaleX, a4.scaleY, b3.scaleX, b3.scaleY, s2, q3);
6514       a4 = b3 = null;
6515       return function(t2) {
6516         var i3 = -1, n3 = q3.length, o2;
6517         while (++i3 < n3) s2[(o2 = q3[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, S3;
6549           if (d2 < epsilon22) {
6550             S3 = 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 * S3)
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             S3 = (r1 - r0) / rho;
6561             i3 = function(t2) {
6562               var s2 = t2 * S3, 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 = S3 * 1e3 * rho / Math.SQRT2;
6571           return i3;
6572         }
6573         zoom.rho = function(_3) {
6574           var _1 = Math.max(1e-3, +_3), _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, j3, 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, j3 = -1; i3 < n3; ++i3) {
6813         if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
6814           tween[++j3] = o2;
6815         }
6816       }
6817       tween.length = j3 + 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(a4, b3) {
6958     var c2;
6959     return (typeof b3 === "number" ? number_default : b3 instanceof color ? rgb_default : (c2 = color(b3)) ? (b3 = c2, rgb_default) : string_default)(a4, b3);
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 v3 = value.apply(this, arguments);
7134       if (typeof v3 !== "function") throw new Error();
7135       set2(this, id2).ease = v3;
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, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
7152       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], 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, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) {
7171       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge3 = merges[j3] = 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 (; j3 < m0; ++j3) {
7178       merges[j3] = groups0[j3];
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 parent2 = this.parentNode;
7218       for (var i3 in this.__transition) if (+i3 !== id2) return;
7219       if (parent2) parent2.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, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
7235       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = 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, m3 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m3; ++j3) {
7258       for (var group = groups[j3], 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), k3 = 0, l2 = children2.length; k3 < l2; ++k3) {
7261             if (child = children2[k3]) {
7262               schedule_default(child, name, id2, k3, 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, m3 = groups.length, j3 = 0; j3 < m3; ++j3) {
7423       for (var group = groups[j3], 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, m3 = groups.length, j3 = 0; j3 < m3; ++j3) {
7587       for (var group = groups[j3], 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(k3, x2, y2) {
7661     this.k = k3;
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(k3) {
7675           return k3 === 1 ? this : new Transform(this.k * k3, 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, k3, p2, event) {
7775       zoom.scaleTo(selection2, function() {
7776         var k0 = this.__zoom.k, k1 = typeof k3 === "function" ? k3.apply(this, arguments) : k3;
7777         return k0 * k1;
7778       }, p2, event);
7779     };
7780     zoom.scaleTo = function(selection2, k3, 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 k3 === "function" ? k3.apply(this, arguments) : k3;
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, k3) {
7804       k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k3));
7805       return k3 === transform2.k ? transform2 : new Transform(k3, 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, w3 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a4 = that.__zoom, b3 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a4.invert(p2).concat(w3 / a4.k), b3.invert(p2).concat(w3 / b3.k));
7821         return function(t2) {
7822           if (t2 === 1) t2 = b3;
7823           else {
7824             var l2 = i3(t2), k3 = w3 / l2[2];
7825             t2 = new Transform(k3, p2[0] - l2[0] * k3, p2[1] - l2[1] * k3);
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, k3 = 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 === k3) 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, k3), 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), v3 = 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         v3.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(_3) {
8002       return arguments.length ? (wheelDelta = typeof _3 === "function" ? _3 : constant_default4(+_3), zoom) : wheelDelta;
8003     };
8004     zoom.filter = function(_3) {
8005       return arguments.length ? (filter2 = typeof _3 === "function" ? _3 : constant_default4(!!_3), zoom) : filter2;
8006     };
8007     zoom.touchable = function(_3) {
8008       return arguments.length ? (touchable = typeof _3 === "function" ? _3 : constant_default4(!!_3), zoom) : touchable;
8009     };
8010     zoom.extent = function(_3) {
8011       return arguments.length ? (extent = typeof _3 === "function" ? _3 : constant_default4([[+_3[0][0], +_3[0][1]], [+_3[1][0], +_3[1][1]]]), zoom) : extent;
8012     };
8013     zoom.scaleExtent = function(_3) {
8014       return arguments.length ? (scaleExtent[0] = +_3[0], scaleExtent[1] = +_3[1], zoom) : [scaleExtent[0], scaleExtent[1]];
8015     };
8016     zoom.translateExtent = function(_3) {
8017       return arguments.length ? (translateExtent[0][0] = +_3[0][0], translateExtent[1][0] = +_3[1][0], translateExtent[0][1] = +_3[0][1], translateExtent[1][1] = +_3[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
8018     };
8019     zoom.constrain = function(_3) {
8020       return arguments.length ? (constrain = _3, zoom) : constrain;
8021     };
8022     zoom.duration = function(_3) {
8023       return arguments.length ? (duration = +_3, zoom) : duration;
8024     };
8025     zoom.interpolate = function(_3) {
8026       return arguments.length ? (interpolate = _3, 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(_3) {
8033       return arguments.length ? (clickDistance2 = (_3 = +_3) * _3, zoom) : Math.sqrt(clickDistance2);
8034     };
8035     zoom.tapDistance = function(_3) {
8036       return arguments.length ? (tapDistance = +_3, 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 k3 = 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] * k3 + x2, y2 - point[1] * k3];
8076     }
8077     projection2.invert = function(point) {
8078       point = project.invert((point[0] - x2) / k3, (y2 - point[1]) / k3);
8079       return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
8080     };
8081     projection2.scale = function(_3) {
8082       if (!arguments.length) return k3;
8083       k3 = +_3;
8084       return projection2;
8085     };
8086     projection2.translate = function(_3) {
8087       if (!arguments.length) return [x2, y2];
8088       x2 = +_3[0];
8089       y2 = +_3[1];
8090       return projection2;
8091     };
8092     projection2.clipExtent = function(_3) {
8093       if (!arguments.length) return clipExtent;
8094       clipExtent = _3;
8095       return projection2;
8096     };
8097     projection2.transform = function(obj) {
8098       if (!arguments.length) return identity2.translate(x2, y2).scale(k3);
8099       x2 = +obj.x;
8100       y2 = +obj.y;
8101       k3 = +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(a4, b3, origin) {
8129     if (geoVecEqual(origin, a4) || geoVecEqual(origin, b3)) {
8130       return 1;
8131     }
8132     return geoVecNormalizedDot(a4, b3, 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 last2 = 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 < last2; i3++) {
8156       var a4 = coords[(i3 - 1 + coords.length) % coords.length];
8157       var origin = coords[i3];
8158       var b3 = coords[(i3 + 1) % coords.length];
8159       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a4, b3, 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 last2 = isClosed ? coords.length : coords.length - 1;
8169     for (var i3 = first; i3 < last2; i3++) {
8170       var a4 = coords[(i3 - 1 + coords.length) % coords.length];
8171       var origin = coords[i3];
8172       var b3 = coords[(i3 + 1) % coords.length];
8173       var normalizedDotP = geoOrthoNormalizedDotProduct(a4, b3, 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 last2 = 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 < last2; i3++) {
8189       var a4 = coords[(i3 - 1 + coords.length) % coords.length];
8190       var origin = coords[i3];
8191       var b3 = coords[(i3 + 1) % coords.length];
8192       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a4, b3, 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), tag = 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] = tag;
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 other = typeof value.valueOf == "function" ? value.valueOf() : value;
8526       value = isObject_default(other) ? other + "" : other;
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 tag = baseGetTag_default(value);
8567     return tag == funcTag || tag == genTag || tag == asyncTag || tag == 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/_arrayEach.js
8845   function arrayEach(array2, iteratee) {
8846     var index = -1, length2 = array2 == null ? 0 : array2.length;
8847     while (++index < length2) {
8848       if (iteratee(array2[index], index, array2) === false) {
8849         break;
8850       }
8851     }
8852     return array2;
8853   }
8854   var arrayEach_default;
8855   var init_arrayEach = __esm({
8856     "node_modules/lodash-es/_arrayEach.js"() {
8857       arrayEach_default = arrayEach;
8858     }
8859   });
8860
8861   // node_modules/lodash-es/_isIndex.js
8862   function isIndex(value, length2) {
8863     var type2 = typeof value;
8864     length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
8865     return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
8866   }
8867   var MAX_SAFE_INTEGER, reIsUint, isIndex_default;
8868   var init_isIndex = __esm({
8869     "node_modules/lodash-es/_isIndex.js"() {
8870       MAX_SAFE_INTEGER = 9007199254740991;
8871       reIsUint = /^(?:0|[1-9]\d*)$/;
8872       isIndex_default = isIndex;
8873     }
8874   });
8875
8876   // node_modules/lodash-es/_baseAssignValue.js
8877   function baseAssignValue(object, key, value) {
8878     if (key == "__proto__" && defineProperty_default) {
8879       defineProperty_default(object, key, {
8880         "configurable": true,
8881         "enumerable": true,
8882         "value": value,
8883         "writable": true
8884       });
8885     } else {
8886       object[key] = value;
8887     }
8888   }
8889   var baseAssignValue_default;
8890   var init_baseAssignValue = __esm({
8891     "node_modules/lodash-es/_baseAssignValue.js"() {
8892       init_defineProperty();
8893       baseAssignValue_default = baseAssignValue;
8894     }
8895   });
8896
8897   // node_modules/lodash-es/eq.js
8898   function eq(value, other) {
8899     return value === other || value !== value && other !== other;
8900   }
8901   var eq_default;
8902   var init_eq = __esm({
8903     "node_modules/lodash-es/eq.js"() {
8904       eq_default = eq;
8905     }
8906   });
8907
8908   // node_modules/lodash-es/_assignValue.js
8909   function assignValue(object, key, value) {
8910     var objValue = object[key];
8911     if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) {
8912       baseAssignValue_default(object, key, value);
8913     }
8914   }
8915   var objectProto4, hasOwnProperty3, assignValue_default;
8916   var init_assignValue = __esm({
8917     "node_modules/lodash-es/_assignValue.js"() {
8918       init_baseAssignValue();
8919       init_eq();
8920       objectProto4 = Object.prototype;
8921       hasOwnProperty3 = objectProto4.hasOwnProperty;
8922       assignValue_default = assignValue;
8923     }
8924   });
8925
8926   // node_modules/lodash-es/_copyObject.js
8927   function copyObject(source, props, object, customizer) {
8928     var isNew = !object;
8929     object || (object = {});
8930     var index = -1, length2 = props.length;
8931     while (++index < length2) {
8932       var key = props[index];
8933       var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
8934       if (newValue === void 0) {
8935         newValue = source[key];
8936       }
8937       if (isNew) {
8938         baseAssignValue_default(object, key, newValue);
8939       } else {
8940         assignValue_default(object, key, newValue);
8941       }
8942     }
8943     return object;
8944   }
8945   var copyObject_default;
8946   var init_copyObject = __esm({
8947     "node_modules/lodash-es/_copyObject.js"() {
8948       init_assignValue();
8949       init_baseAssignValue();
8950       copyObject_default = copyObject;
8951     }
8952   });
8953
8954   // node_modules/lodash-es/_overRest.js
8955   function overRest(func, start2, transform2) {
8956     start2 = nativeMax(start2 === void 0 ? func.length - 1 : start2, 0);
8957     return function() {
8958       var args = arguments, index = -1, length2 = nativeMax(args.length - start2, 0), array2 = Array(length2);
8959       while (++index < length2) {
8960         array2[index] = args[start2 + index];
8961       }
8962       index = -1;
8963       var otherArgs = Array(start2 + 1);
8964       while (++index < start2) {
8965         otherArgs[index] = args[index];
8966       }
8967       otherArgs[start2] = transform2(array2);
8968       return apply_default(func, this, otherArgs);
8969     };
8970   }
8971   var nativeMax, overRest_default;
8972   var init_overRest = __esm({
8973     "node_modules/lodash-es/_overRest.js"() {
8974       init_apply();
8975       nativeMax = Math.max;
8976       overRest_default = overRest;
8977     }
8978   });
8979
8980   // node_modules/lodash-es/_baseRest.js
8981   function baseRest(func, start2) {
8982     return setToString_default(overRest_default(func, start2, identity_default3), func + "");
8983   }
8984   var baseRest_default;
8985   var init_baseRest = __esm({
8986     "node_modules/lodash-es/_baseRest.js"() {
8987       init_identity3();
8988       init_overRest();
8989       init_setToString();
8990       baseRest_default = baseRest;
8991     }
8992   });
8993
8994   // node_modules/lodash-es/isLength.js
8995   function isLength(value) {
8996     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
8997   }
8998   var MAX_SAFE_INTEGER2, isLength_default;
8999   var init_isLength = __esm({
9000     "node_modules/lodash-es/isLength.js"() {
9001       MAX_SAFE_INTEGER2 = 9007199254740991;
9002       isLength_default = isLength;
9003     }
9004   });
9005
9006   // node_modules/lodash-es/isArrayLike.js
9007   function isArrayLike(value) {
9008     return value != null && isLength_default(value.length) && !isFunction_default(value);
9009   }
9010   var isArrayLike_default;
9011   var init_isArrayLike = __esm({
9012     "node_modules/lodash-es/isArrayLike.js"() {
9013       init_isFunction();
9014       init_isLength();
9015       isArrayLike_default = isArrayLike;
9016     }
9017   });
9018
9019   // node_modules/lodash-es/_isIterateeCall.js
9020   function isIterateeCall(value, index, object) {
9021     if (!isObject_default(object)) {
9022       return false;
9023     }
9024     var type2 = typeof index;
9025     if (type2 == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type2 == "string" && index in object) {
9026       return eq_default(object[index], value);
9027     }
9028     return false;
9029   }
9030   var isIterateeCall_default;
9031   var init_isIterateeCall = __esm({
9032     "node_modules/lodash-es/_isIterateeCall.js"() {
9033       init_eq();
9034       init_isArrayLike();
9035       init_isIndex();
9036       init_isObject();
9037       isIterateeCall_default = isIterateeCall;
9038     }
9039   });
9040
9041   // node_modules/lodash-es/_createAssigner.js
9042   function createAssigner(assigner) {
9043     return baseRest_default(function(object, sources) {
9044       var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
9045       customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
9046       if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
9047         customizer = length2 < 3 ? void 0 : customizer;
9048         length2 = 1;
9049       }
9050       object = Object(object);
9051       while (++index < length2) {
9052         var source = sources[index];
9053         if (source) {
9054           assigner(object, source, index, customizer);
9055         }
9056       }
9057       return object;
9058     });
9059   }
9060   var createAssigner_default;
9061   var init_createAssigner = __esm({
9062     "node_modules/lodash-es/_createAssigner.js"() {
9063       init_baseRest();
9064       init_isIterateeCall();
9065       createAssigner_default = createAssigner;
9066     }
9067   });
9068
9069   // node_modules/lodash-es/_isPrototype.js
9070   function isPrototype(value) {
9071     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5;
9072     return value === proto;
9073   }
9074   var objectProto5, isPrototype_default;
9075   var init_isPrototype = __esm({
9076     "node_modules/lodash-es/_isPrototype.js"() {
9077       objectProto5 = Object.prototype;
9078       isPrototype_default = isPrototype;
9079     }
9080   });
9081
9082   // node_modules/lodash-es/_baseTimes.js
9083   function baseTimes(n3, iteratee) {
9084     var index = -1, result = Array(n3);
9085     while (++index < n3) {
9086       result[index] = iteratee(index);
9087     }
9088     return result;
9089   }
9090   var baseTimes_default;
9091   var init_baseTimes = __esm({
9092     "node_modules/lodash-es/_baseTimes.js"() {
9093       baseTimes_default = baseTimes;
9094     }
9095   });
9096
9097   // node_modules/lodash-es/_baseIsArguments.js
9098   function baseIsArguments(value) {
9099     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
9100   }
9101   var argsTag, baseIsArguments_default;
9102   var init_baseIsArguments = __esm({
9103     "node_modules/lodash-es/_baseIsArguments.js"() {
9104       init_baseGetTag();
9105       init_isObjectLike();
9106       argsTag = "[object Arguments]";
9107       baseIsArguments_default = baseIsArguments;
9108     }
9109   });
9110
9111   // node_modules/lodash-es/isArguments.js
9112   var objectProto6, hasOwnProperty4, propertyIsEnumerable, isArguments, isArguments_default;
9113   var init_isArguments = __esm({
9114     "node_modules/lodash-es/isArguments.js"() {
9115       init_baseIsArguments();
9116       init_isObjectLike();
9117       objectProto6 = Object.prototype;
9118       hasOwnProperty4 = objectProto6.hasOwnProperty;
9119       propertyIsEnumerable = objectProto6.propertyIsEnumerable;
9120       isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
9121         return arguments;
9122       }()) ? baseIsArguments_default : function(value) {
9123         return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
9124       };
9125       isArguments_default = isArguments;
9126     }
9127   });
9128
9129   // node_modules/lodash-es/stubFalse.js
9130   function stubFalse() {
9131     return false;
9132   }
9133   var stubFalse_default;
9134   var init_stubFalse = __esm({
9135     "node_modules/lodash-es/stubFalse.js"() {
9136       stubFalse_default = stubFalse;
9137     }
9138   });
9139
9140   // node_modules/lodash-es/isBuffer.js
9141   var freeExports, freeModule, moduleExports, Buffer2, nativeIsBuffer, isBuffer, isBuffer_default;
9142   var init_isBuffer = __esm({
9143     "node_modules/lodash-es/isBuffer.js"() {
9144       init_root();
9145       init_stubFalse();
9146       freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
9147       freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
9148       moduleExports = freeModule && freeModule.exports === freeExports;
9149       Buffer2 = moduleExports ? root_default.Buffer : void 0;
9150       nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
9151       isBuffer = nativeIsBuffer || stubFalse_default;
9152       isBuffer_default = isBuffer;
9153     }
9154   });
9155
9156   // node_modules/lodash-es/_baseIsTypedArray.js
9157   function baseIsTypedArray(value) {
9158     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
9159   }
9160   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;
9161   var init_baseIsTypedArray = __esm({
9162     "node_modules/lodash-es/_baseIsTypedArray.js"() {
9163       init_baseGetTag();
9164       init_isLength();
9165       init_isObjectLike();
9166       argsTag2 = "[object Arguments]";
9167       arrayTag = "[object Array]";
9168       boolTag = "[object Boolean]";
9169       dateTag = "[object Date]";
9170       errorTag = "[object Error]";
9171       funcTag2 = "[object Function]";
9172       mapTag = "[object Map]";
9173       numberTag = "[object Number]";
9174       objectTag = "[object Object]";
9175       regexpTag = "[object RegExp]";
9176       setTag = "[object Set]";
9177       stringTag = "[object String]";
9178       weakMapTag = "[object WeakMap]";
9179       arrayBufferTag = "[object ArrayBuffer]";
9180       dataViewTag = "[object DataView]";
9181       float32Tag = "[object Float32Array]";
9182       float64Tag = "[object Float64Array]";
9183       int8Tag = "[object Int8Array]";
9184       int16Tag = "[object Int16Array]";
9185       int32Tag = "[object Int32Array]";
9186       uint8Tag = "[object Uint8Array]";
9187       uint8ClampedTag = "[object Uint8ClampedArray]";
9188       uint16Tag = "[object Uint16Array]";
9189       uint32Tag = "[object Uint32Array]";
9190       typedArrayTags = {};
9191       typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
9192       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;
9193       baseIsTypedArray_default = baseIsTypedArray;
9194     }
9195   });
9196
9197   // node_modules/lodash-es/_baseUnary.js
9198   function baseUnary(func) {
9199     return function(value) {
9200       return func(value);
9201     };
9202   }
9203   var baseUnary_default;
9204   var init_baseUnary = __esm({
9205     "node_modules/lodash-es/_baseUnary.js"() {
9206       baseUnary_default = baseUnary;
9207     }
9208   });
9209
9210   // node_modules/lodash-es/_nodeUtil.js
9211   var freeExports2, freeModule2, moduleExports2, freeProcess, nodeUtil, nodeUtil_default;
9212   var init_nodeUtil = __esm({
9213     "node_modules/lodash-es/_nodeUtil.js"() {
9214       init_freeGlobal();
9215       freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
9216       freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
9217       moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
9218       freeProcess = moduleExports2 && freeGlobal_default.process;
9219       nodeUtil = function() {
9220         try {
9221           var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
9222           if (types) {
9223             return types;
9224           }
9225           return freeProcess && freeProcess.binding && freeProcess.binding("util");
9226         } catch (e3) {
9227         }
9228       }();
9229       nodeUtil_default = nodeUtil;
9230     }
9231   });
9232
9233   // node_modules/lodash-es/isTypedArray.js
9234   var nodeIsTypedArray, isTypedArray, isTypedArray_default;
9235   var init_isTypedArray = __esm({
9236     "node_modules/lodash-es/isTypedArray.js"() {
9237       init_baseIsTypedArray();
9238       init_baseUnary();
9239       init_nodeUtil();
9240       nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
9241       isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
9242       isTypedArray_default = isTypedArray;
9243     }
9244   });
9245
9246   // node_modules/lodash-es/_arrayLikeKeys.js
9247   function arrayLikeKeys(value, inherited) {
9248     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;
9249     for (var key in value) {
9250       if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
9251       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
9252       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
9253       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
9254       isIndex_default(key, length2)))) {
9255         result.push(key);
9256       }
9257     }
9258     return result;
9259   }
9260   var objectProto7, hasOwnProperty5, arrayLikeKeys_default;
9261   var init_arrayLikeKeys = __esm({
9262     "node_modules/lodash-es/_arrayLikeKeys.js"() {
9263       init_baseTimes();
9264       init_isArguments();
9265       init_isArray();
9266       init_isBuffer();
9267       init_isIndex();
9268       init_isTypedArray();
9269       objectProto7 = Object.prototype;
9270       hasOwnProperty5 = objectProto7.hasOwnProperty;
9271       arrayLikeKeys_default = arrayLikeKeys;
9272     }
9273   });
9274
9275   // node_modules/lodash-es/_overArg.js
9276   function overArg(func, transform2) {
9277     return function(arg) {
9278       return func(transform2(arg));
9279     };
9280   }
9281   var overArg_default;
9282   var init_overArg = __esm({
9283     "node_modules/lodash-es/_overArg.js"() {
9284       overArg_default = overArg;
9285     }
9286   });
9287
9288   // node_modules/lodash-es/_nativeKeys.js
9289   var nativeKeys, nativeKeys_default;
9290   var init_nativeKeys = __esm({
9291     "node_modules/lodash-es/_nativeKeys.js"() {
9292       init_overArg();
9293       nativeKeys = overArg_default(Object.keys, Object);
9294       nativeKeys_default = nativeKeys;
9295     }
9296   });
9297
9298   // node_modules/lodash-es/_baseKeys.js
9299   function baseKeys(object) {
9300     if (!isPrototype_default(object)) {
9301       return nativeKeys_default(object);
9302     }
9303     var result = [];
9304     for (var key in Object(object)) {
9305       if (hasOwnProperty6.call(object, key) && key != "constructor") {
9306         result.push(key);
9307       }
9308     }
9309     return result;
9310   }
9311   var objectProto8, hasOwnProperty6, baseKeys_default;
9312   var init_baseKeys = __esm({
9313     "node_modules/lodash-es/_baseKeys.js"() {
9314       init_isPrototype();
9315       init_nativeKeys();
9316       objectProto8 = Object.prototype;
9317       hasOwnProperty6 = objectProto8.hasOwnProperty;
9318       baseKeys_default = baseKeys;
9319     }
9320   });
9321
9322   // node_modules/lodash-es/keys.js
9323   function keys(object) {
9324     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
9325   }
9326   var keys_default;
9327   var init_keys = __esm({
9328     "node_modules/lodash-es/keys.js"() {
9329       init_arrayLikeKeys();
9330       init_baseKeys();
9331       init_isArrayLike();
9332       keys_default = keys;
9333     }
9334   });
9335
9336   // node_modules/lodash-es/_nativeKeysIn.js
9337   function nativeKeysIn(object) {
9338     var result = [];
9339     if (object != null) {
9340       for (var key in Object(object)) {
9341         result.push(key);
9342       }
9343     }
9344     return result;
9345   }
9346   var nativeKeysIn_default;
9347   var init_nativeKeysIn = __esm({
9348     "node_modules/lodash-es/_nativeKeysIn.js"() {
9349       nativeKeysIn_default = nativeKeysIn;
9350     }
9351   });
9352
9353   // node_modules/lodash-es/_baseKeysIn.js
9354   function baseKeysIn(object) {
9355     if (!isObject_default(object)) {
9356       return nativeKeysIn_default(object);
9357     }
9358     var isProto = isPrototype_default(object), result = [];
9359     for (var key in object) {
9360       if (!(key == "constructor" && (isProto || !hasOwnProperty7.call(object, key)))) {
9361         result.push(key);
9362       }
9363     }
9364     return result;
9365   }
9366   var objectProto9, hasOwnProperty7, baseKeysIn_default;
9367   var init_baseKeysIn = __esm({
9368     "node_modules/lodash-es/_baseKeysIn.js"() {
9369       init_isObject();
9370       init_isPrototype();
9371       init_nativeKeysIn();
9372       objectProto9 = Object.prototype;
9373       hasOwnProperty7 = objectProto9.hasOwnProperty;
9374       baseKeysIn_default = baseKeysIn;
9375     }
9376   });
9377
9378   // node_modules/lodash-es/keysIn.js
9379   function keysIn(object) {
9380     return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object);
9381   }
9382   var keysIn_default;
9383   var init_keysIn = __esm({
9384     "node_modules/lodash-es/keysIn.js"() {
9385       init_arrayLikeKeys();
9386       init_baseKeysIn();
9387       init_isArrayLike();
9388       keysIn_default = keysIn;
9389     }
9390   });
9391
9392   // node_modules/lodash-es/_isKey.js
9393   function isKey(value, object) {
9394     if (isArray_default(value)) {
9395       return false;
9396     }
9397     var type2 = typeof value;
9398     if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol_default(value)) {
9399       return true;
9400     }
9401     return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
9402   }
9403   var reIsDeepProp, reIsPlainProp, isKey_default;
9404   var init_isKey = __esm({
9405     "node_modules/lodash-es/_isKey.js"() {
9406       init_isArray();
9407       init_isSymbol();
9408       reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
9409       reIsPlainProp = /^\w*$/;
9410       isKey_default = isKey;
9411     }
9412   });
9413
9414   // node_modules/lodash-es/_nativeCreate.js
9415   var nativeCreate, nativeCreate_default;
9416   var init_nativeCreate = __esm({
9417     "node_modules/lodash-es/_nativeCreate.js"() {
9418       init_getNative();
9419       nativeCreate = getNative_default(Object, "create");
9420       nativeCreate_default = nativeCreate;
9421     }
9422   });
9423
9424   // node_modules/lodash-es/_hashClear.js
9425   function hashClear() {
9426     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
9427     this.size = 0;
9428   }
9429   var hashClear_default;
9430   var init_hashClear = __esm({
9431     "node_modules/lodash-es/_hashClear.js"() {
9432       init_nativeCreate();
9433       hashClear_default = hashClear;
9434     }
9435   });
9436
9437   // node_modules/lodash-es/_hashDelete.js
9438   function hashDelete(key) {
9439     var result = this.has(key) && delete this.__data__[key];
9440     this.size -= result ? 1 : 0;
9441     return result;
9442   }
9443   var hashDelete_default;
9444   var init_hashDelete = __esm({
9445     "node_modules/lodash-es/_hashDelete.js"() {
9446       hashDelete_default = hashDelete;
9447     }
9448   });
9449
9450   // node_modules/lodash-es/_hashGet.js
9451   function hashGet(key) {
9452     var data = this.__data__;
9453     if (nativeCreate_default) {
9454       var result = data[key];
9455       return result === HASH_UNDEFINED ? void 0 : result;
9456     }
9457     return hasOwnProperty8.call(data, key) ? data[key] : void 0;
9458   }
9459   var HASH_UNDEFINED, objectProto10, hasOwnProperty8, hashGet_default;
9460   var init_hashGet = __esm({
9461     "node_modules/lodash-es/_hashGet.js"() {
9462       init_nativeCreate();
9463       HASH_UNDEFINED = "__lodash_hash_undefined__";
9464       objectProto10 = Object.prototype;
9465       hasOwnProperty8 = objectProto10.hasOwnProperty;
9466       hashGet_default = hashGet;
9467     }
9468   });
9469
9470   // node_modules/lodash-es/_hashHas.js
9471   function hashHas(key) {
9472     var data = this.__data__;
9473     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty9.call(data, key);
9474   }
9475   var objectProto11, hasOwnProperty9, hashHas_default;
9476   var init_hashHas = __esm({
9477     "node_modules/lodash-es/_hashHas.js"() {
9478       init_nativeCreate();
9479       objectProto11 = Object.prototype;
9480       hasOwnProperty9 = objectProto11.hasOwnProperty;
9481       hashHas_default = hashHas;
9482     }
9483   });
9484
9485   // node_modules/lodash-es/_hashSet.js
9486   function hashSet(key, value) {
9487     var data = this.__data__;
9488     this.size += this.has(key) ? 0 : 1;
9489     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
9490     return this;
9491   }
9492   var HASH_UNDEFINED2, hashSet_default;
9493   var init_hashSet = __esm({
9494     "node_modules/lodash-es/_hashSet.js"() {
9495       init_nativeCreate();
9496       HASH_UNDEFINED2 = "__lodash_hash_undefined__";
9497       hashSet_default = hashSet;
9498     }
9499   });
9500
9501   // node_modules/lodash-es/_Hash.js
9502   function Hash(entries) {
9503     var index = -1, length2 = entries == null ? 0 : entries.length;
9504     this.clear();
9505     while (++index < length2) {
9506       var entry = entries[index];
9507       this.set(entry[0], entry[1]);
9508     }
9509   }
9510   var Hash_default;
9511   var init_Hash = __esm({
9512     "node_modules/lodash-es/_Hash.js"() {
9513       init_hashClear();
9514       init_hashDelete();
9515       init_hashGet();
9516       init_hashHas();
9517       init_hashSet();
9518       Hash.prototype.clear = hashClear_default;
9519       Hash.prototype["delete"] = hashDelete_default;
9520       Hash.prototype.get = hashGet_default;
9521       Hash.prototype.has = hashHas_default;
9522       Hash.prototype.set = hashSet_default;
9523       Hash_default = Hash;
9524     }
9525   });
9526
9527   // node_modules/lodash-es/_listCacheClear.js
9528   function listCacheClear() {
9529     this.__data__ = [];
9530     this.size = 0;
9531   }
9532   var listCacheClear_default;
9533   var init_listCacheClear = __esm({
9534     "node_modules/lodash-es/_listCacheClear.js"() {
9535       listCacheClear_default = listCacheClear;
9536     }
9537   });
9538
9539   // node_modules/lodash-es/_assocIndexOf.js
9540   function assocIndexOf(array2, key) {
9541     var length2 = array2.length;
9542     while (length2--) {
9543       if (eq_default(array2[length2][0], key)) {
9544         return length2;
9545       }
9546     }
9547     return -1;
9548   }
9549   var assocIndexOf_default;
9550   var init_assocIndexOf = __esm({
9551     "node_modules/lodash-es/_assocIndexOf.js"() {
9552       init_eq();
9553       assocIndexOf_default = assocIndexOf;
9554     }
9555   });
9556
9557   // node_modules/lodash-es/_listCacheDelete.js
9558   function listCacheDelete(key) {
9559     var data = this.__data__, index = assocIndexOf_default(data, key);
9560     if (index < 0) {
9561       return false;
9562     }
9563     var lastIndex = data.length - 1;
9564     if (index == lastIndex) {
9565       data.pop();
9566     } else {
9567       splice.call(data, index, 1);
9568     }
9569     --this.size;
9570     return true;
9571   }
9572   var arrayProto, splice, listCacheDelete_default;
9573   var init_listCacheDelete = __esm({
9574     "node_modules/lodash-es/_listCacheDelete.js"() {
9575       init_assocIndexOf();
9576       arrayProto = Array.prototype;
9577       splice = arrayProto.splice;
9578       listCacheDelete_default = listCacheDelete;
9579     }
9580   });
9581
9582   // node_modules/lodash-es/_listCacheGet.js
9583   function listCacheGet(key) {
9584     var data = this.__data__, index = assocIndexOf_default(data, key);
9585     return index < 0 ? void 0 : data[index][1];
9586   }
9587   var listCacheGet_default;
9588   var init_listCacheGet = __esm({
9589     "node_modules/lodash-es/_listCacheGet.js"() {
9590       init_assocIndexOf();
9591       listCacheGet_default = listCacheGet;
9592     }
9593   });
9594
9595   // node_modules/lodash-es/_listCacheHas.js
9596   function listCacheHas(key) {
9597     return assocIndexOf_default(this.__data__, key) > -1;
9598   }
9599   var listCacheHas_default;
9600   var init_listCacheHas = __esm({
9601     "node_modules/lodash-es/_listCacheHas.js"() {
9602       init_assocIndexOf();
9603       listCacheHas_default = listCacheHas;
9604     }
9605   });
9606
9607   // node_modules/lodash-es/_listCacheSet.js
9608   function listCacheSet(key, value) {
9609     var data = this.__data__, index = assocIndexOf_default(data, key);
9610     if (index < 0) {
9611       ++this.size;
9612       data.push([key, value]);
9613     } else {
9614       data[index][1] = value;
9615     }
9616     return this;
9617   }
9618   var listCacheSet_default;
9619   var init_listCacheSet = __esm({
9620     "node_modules/lodash-es/_listCacheSet.js"() {
9621       init_assocIndexOf();
9622       listCacheSet_default = listCacheSet;
9623     }
9624   });
9625
9626   // node_modules/lodash-es/_ListCache.js
9627   function ListCache(entries) {
9628     var index = -1, length2 = entries == null ? 0 : entries.length;
9629     this.clear();
9630     while (++index < length2) {
9631       var entry = entries[index];
9632       this.set(entry[0], entry[1]);
9633     }
9634   }
9635   var ListCache_default;
9636   var init_ListCache = __esm({
9637     "node_modules/lodash-es/_ListCache.js"() {
9638       init_listCacheClear();
9639       init_listCacheDelete();
9640       init_listCacheGet();
9641       init_listCacheHas();
9642       init_listCacheSet();
9643       ListCache.prototype.clear = listCacheClear_default;
9644       ListCache.prototype["delete"] = listCacheDelete_default;
9645       ListCache.prototype.get = listCacheGet_default;
9646       ListCache.prototype.has = listCacheHas_default;
9647       ListCache.prototype.set = listCacheSet_default;
9648       ListCache_default = ListCache;
9649     }
9650   });
9651
9652   // node_modules/lodash-es/_Map.js
9653   var Map2, Map_default;
9654   var init_Map = __esm({
9655     "node_modules/lodash-es/_Map.js"() {
9656       init_getNative();
9657       init_root();
9658       Map2 = getNative_default(root_default, "Map");
9659       Map_default = Map2;
9660     }
9661   });
9662
9663   // node_modules/lodash-es/_mapCacheClear.js
9664   function mapCacheClear() {
9665     this.size = 0;
9666     this.__data__ = {
9667       "hash": new Hash_default(),
9668       "map": new (Map_default || ListCache_default)(),
9669       "string": new Hash_default()
9670     };
9671   }
9672   var mapCacheClear_default;
9673   var init_mapCacheClear = __esm({
9674     "node_modules/lodash-es/_mapCacheClear.js"() {
9675       init_Hash();
9676       init_ListCache();
9677       init_Map();
9678       mapCacheClear_default = mapCacheClear;
9679     }
9680   });
9681
9682   // node_modules/lodash-es/_isKeyable.js
9683   function isKeyable(value) {
9684     var type2 = typeof value;
9685     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9686   }
9687   var isKeyable_default;
9688   var init_isKeyable = __esm({
9689     "node_modules/lodash-es/_isKeyable.js"() {
9690       isKeyable_default = isKeyable;
9691     }
9692   });
9693
9694   // node_modules/lodash-es/_getMapData.js
9695   function getMapData(map2, key) {
9696     var data = map2.__data__;
9697     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9698   }
9699   var getMapData_default;
9700   var init_getMapData = __esm({
9701     "node_modules/lodash-es/_getMapData.js"() {
9702       init_isKeyable();
9703       getMapData_default = getMapData;
9704     }
9705   });
9706
9707   // node_modules/lodash-es/_mapCacheDelete.js
9708   function mapCacheDelete(key) {
9709     var result = getMapData_default(this, key)["delete"](key);
9710     this.size -= result ? 1 : 0;
9711     return result;
9712   }
9713   var mapCacheDelete_default;
9714   var init_mapCacheDelete = __esm({
9715     "node_modules/lodash-es/_mapCacheDelete.js"() {
9716       init_getMapData();
9717       mapCacheDelete_default = mapCacheDelete;
9718     }
9719   });
9720
9721   // node_modules/lodash-es/_mapCacheGet.js
9722   function mapCacheGet(key) {
9723     return getMapData_default(this, key).get(key);
9724   }
9725   var mapCacheGet_default;
9726   var init_mapCacheGet = __esm({
9727     "node_modules/lodash-es/_mapCacheGet.js"() {
9728       init_getMapData();
9729       mapCacheGet_default = mapCacheGet;
9730     }
9731   });
9732
9733   // node_modules/lodash-es/_mapCacheHas.js
9734   function mapCacheHas(key) {
9735     return getMapData_default(this, key).has(key);
9736   }
9737   var mapCacheHas_default;
9738   var init_mapCacheHas = __esm({
9739     "node_modules/lodash-es/_mapCacheHas.js"() {
9740       init_getMapData();
9741       mapCacheHas_default = mapCacheHas;
9742     }
9743   });
9744
9745   // node_modules/lodash-es/_mapCacheSet.js
9746   function mapCacheSet(key, value) {
9747     var data = getMapData_default(this, key), size = data.size;
9748     data.set(key, value);
9749     this.size += data.size == size ? 0 : 1;
9750     return this;
9751   }
9752   var mapCacheSet_default;
9753   var init_mapCacheSet = __esm({
9754     "node_modules/lodash-es/_mapCacheSet.js"() {
9755       init_getMapData();
9756       mapCacheSet_default = mapCacheSet;
9757     }
9758   });
9759
9760   // node_modules/lodash-es/_MapCache.js
9761   function MapCache(entries) {
9762     var index = -1, length2 = entries == null ? 0 : entries.length;
9763     this.clear();
9764     while (++index < length2) {
9765       var entry = entries[index];
9766       this.set(entry[0], entry[1]);
9767     }
9768   }
9769   var MapCache_default;
9770   var init_MapCache = __esm({
9771     "node_modules/lodash-es/_MapCache.js"() {
9772       init_mapCacheClear();
9773       init_mapCacheDelete();
9774       init_mapCacheGet();
9775       init_mapCacheHas();
9776       init_mapCacheSet();
9777       MapCache.prototype.clear = mapCacheClear_default;
9778       MapCache.prototype["delete"] = mapCacheDelete_default;
9779       MapCache.prototype.get = mapCacheGet_default;
9780       MapCache.prototype.has = mapCacheHas_default;
9781       MapCache.prototype.set = mapCacheSet_default;
9782       MapCache_default = MapCache;
9783     }
9784   });
9785
9786   // node_modules/lodash-es/memoize.js
9787   function memoize(func, resolver) {
9788     if (typeof func != "function" || resolver != null && typeof resolver != "function") {
9789       throw new TypeError(FUNC_ERROR_TEXT);
9790     }
9791     var memoized = function() {
9792       var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
9793       if (cache.has(key)) {
9794         return cache.get(key);
9795       }
9796       var result = func.apply(this, args);
9797       memoized.cache = cache.set(key, result) || cache;
9798       return result;
9799     };
9800     memoized.cache = new (memoize.Cache || MapCache_default)();
9801     return memoized;
9802   }
9803   var FUNC_ERROR_TEXT, memoize_default;
9804   var init_memoize = __esm({
9805     "node_modules/lodash-es/memoize.js"() {
9806       init_MapCache();
9807       FUNC_ERROR_TEXT = "Expected a function";
9808       memoize.Cache = MapCache_default;
9809       memoize_default = memoize;
9810     }
9811   });
9812
9813   // node_modules/lodash-es/_memoizeCapped.js
9814   function memoizeCapped(func) {
9815     var result = memoize_default(func, function(key) {
9816       if (cache.size === MAX_MEMOIZE_SIZE) {
9817         cache.clear();
9818       }
9819       return key;
9820     });
9821     var cache = result.cache;
9822     return result;
9823   }
9824   var MAX_MEMOIZE_SIZE, memoizeCapped_default;
9825   var init_memoizeCapped = __esm({
9826     "node_modules/lodash-es/_memoizeCapped.js"() {
9827       init_memoize();
9828       MAX_MEMOIZE_SIZE = 500;
9829       memoizeCapped_default = memoizeCapped;
9830     }
9831   });
9832
9833   // node_modules/lodash-es/_stringToPath.js
9834   var rePropName, reEscapeChar, stringToPath, stringToPath_default;
9835   var init_stringToPath = __esm({
9836     "node_modules/lodash-es/_stringToPath.js"() {
9837       init_memoizeCapped();
9838       rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
9839       reEscapeChar = /\\(\\)?/g;
9840       stringToPath = memoizeCapped_default(function(string) {
9841         var result = [];
9842         if (string.charCodeAt(0) === 46) {
9843           result.push("");
9844         }
9845         string.replace(rePropName, function(match, number3, quote, subString) {
9846           result.push(quote ? subString.replace(reEscapeChar, "$1") : number3 || match);
9847         });
9848         return result;
9849       });
9850       stringToPath_default = stringToPath;
9851     }
9852   });
9853
9854   // node_modules/lodash-es/toString.js
9855   function toString(value) {
9856     return value == null ? "" : baseToString_default(value);
9857   }
9858   var toString_default;
9859   var init_toString = __esm({
9860     "node_modules/lodash-es/toString.js"() {
9861       init_baseToString();
9862       toString_default = toString;
9863     }
9864   });
9865
9866   // node_modules/lodash-es/_castPath.js
9867   function castPath(value, object) {
9868     if (isArray_default(value)) {
9869       return value;
9870     }
9871     return isKey_default(value, object) ? [value] : stringToPath_default(toString_default(value));
9872   }
9873   var castPath_default;
9874   var init_castPath = __esm({
9875     "node_modules/lodash-es/_castPath.js"() {
9876       init_isArray();
9877       init_isKey();
9878       init_stringToPath();
9879       init_toString();
9880       castPath_default = castPath;
9881     }
9882   });
9883
9884   // node_modules/lodash-es/_toKey.js
9885   function toKey(value) {
9886     if (typeof value == "string" || isSymbol_default(value)) {
9887       return value;
9888     }
9889     var result = value + "";
9890     return result == "0" && 1 / value == -INFINITY2 ? "-0" : result;
9891   }
9892   var INFINITY2, toKey_default;
9893   var init_toKey = __esm({
9894     "node_modules/lodash-es/_toKey.js"() {
9895       init_isSymbol();
9896       INFINITY2 = 1 / 0;
9897       toKey_default = toKey;
9898     }
9899   });
9900
9901   // node_modules/lodash-es/_baseGet.js
9902   function baseGet(object, path) {
9903     path = castPath_default(path, object);
9904     var index = 0, length2 = path.length;
9905     while (object != null && index < length2) {
9906       object = object[toKey_default(path[index++])];
9907     }
9908     return index && index == length2 ? object : void 0;
9909   }
9910   var baseGet_default;
9911   var init_baseGet = __esm({
9912     "node_modules/lodash-es/_baseGet.js"() {
9913       init_castPath();
9914       init_toKey();
9915       baseGet_default = baseGet;
9916     }
9917   });
9918
9919   // node_modules/lodash-es/_arrayPush.js
9920   function arrayPush(array2, values) {
9921     var index = -1, length2 = values.length, offset = array2.length;
9922     while (++index < length2) {
9923       array2[offset + index] = values[index];
9924     }
9925     return array2;
9926   }
9927   var arrayPush_default;
9928   var init_arrayPush = __esm({
9929     "node_modules/lodash-es/_arrayPush.js"() {
9930       arrayPush_default = arrayPush;
9931     }
9932   });
9933
9934   // node_modules/lodash-es/_isFlattenable.js
9935   function isFlattenable(value) {
9936     return isArray_default(value) || isArguments_default(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9937   }
9938   var spreadableSymbol, isFlattenable_default;
9939   var init_isFlattenable = __esm({
9940     "node_modules/lodash-es/_isFlattenable.js"() {
9941       init_Symbol();
9942       init_isArguments();
9943       init_isArray();
9944       spreadableSymbol = Symbol_default ? Symbol_default.isConcatSpreadable : void 0;
9945       isFlattenable_default = isFlattenable;
9946     }
9947   });
9948
9949   // node_modules/lodash-es/_baseFlatten.js
9950   function baseFlatten(array2, depth, predicate, isStrict, result) {
9951     var index = -1, length2 = array2.length;
9952     predicate || (predicate = isFlattenable_default);
9953     result || (result = []);
9954     while (++index < length2) {
9955       var value = array2[index];
9956       if (depth > 0 && predicate(value)) {
9957         if (depth > 1) {
9958           baseFlatten(value, depth - 1, predicate, isStrict, result);
9959         } else {
9960           arrayPush_default(result, value);
9961         }
9962       } else if (!isStrict) {
9963         result[result.length] = value;
9964       }
9965     }
9966     return result;
9967   }
9968   var baseFlatten_default;
9969   var init_baseFlatten = __esm({
9970     "node_modules/lodash-es/_baseFlatten.js"() {
9971       init_arrayPush();
9972       init_isFlattenable();
9973       baseFlatten_default = baseFlatten;
9974     }
9975   });
9976
9977   // node_modules/lodash-es/flatten.js
9978   function flatten2(array2) {
9979     var length2 = array2 == null ? 0 : array2.length;
9980     return length2 ? baseFlatten_default(array2, 1) : [];
9981   }
9982   var flatten_default;
9983   var init_flatten = __esm({
9984     "node_modules/lodash-es/flatten.js"() {
9985       init_baseFlatten();
9986       flatten_default = flatten2;
9987     }
9988   });
9989
9990   // node_modules/lodash-es/_flatRest.js
9991   function flatRest(func) {
9992     return setToString_default(overRest_default(func, void 0, flatten_default), func + "");
9993   }
9994   var flatRest_default;
9995   var init_flatRest = __esm({
9996     "node_modules/lodash-es/_flatRest.js"() {
9997       init_flatten();
9998       init_overRest();
9999       init_setToString();
10000       flatRest_default = flatRest;
10001     }
10002   });
10003
10004   // node_modules/lodash-es/_getPrototype.js
10005   var getPrototype, getPrototype_default;
10006   var init_getPrototype = __esm({
10007     "node_modules/lodash-es/_getPrototype.js"() {
10008       init_overArg();
10009       getPrototype = overArg_default(Object.getPrototypeOf, Object);
10010       getPrototype_default = getPrototype;
10011     }
10012   });
10013
10014   // node_modules/lodash-es/isPlainObject.js
10015   function isPlainObject(value) {
10016     if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag2) {
10017       return false;
10018     }
10019     var proto = getPrototype_default(value);
10020     if (proto === null) {
10021       return true;
10022     }
10023     var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
10024     return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
10025   }
10026   var objectTag2, funcProto3, objectProto12, funcToString3, hasOwnProperty10, objectCtorString, isPlainObject_default;
10027   var init_isPlainObject = __esm({
10028     "node_modules/lodash-es/isPlainObject.js"() {
10029       init_baseGetTag();
10030       init_getPrototype();
10031       init_isObjectLike();
10032       objectTag2 = "[object Object]";
10033       funcProto3 = Function.prototype;
10034       objectProto12 = Object.prototype;
10035       funcToString3 = funcProto3.toString;
10036       hasOwnProperty10 = objectProto12.hasOwnProperty;
10037       objectCtorString = funcToString3.call(Object);
10038       isPlainObject_default = isPlainObject;
10039     }
10040   });
10041
10042   // node_modules/lodash-es/_baseSlice.js
10043   function baseSlice(array2, start2, end) {
10044     var index = -1, length2 = array2.length;
10045     if (start2 < 0) {
10046       start2 = -start2 > length2 ? 0 : length2 + start2;
10047     }
10048     end = end > length2 ? length2 : end;
10049     if (end < 0) {
10050       end += length2;
10051     }
10052     length2 = start2 > end ? 0 : end - start2 >>> 0;
10053     start2 >>>= 0;
10054     var result = Array(length2);
10055     while (++index < length2) {
10056       result[index] = array2[index + start2];
10057     }
10058     return result;
10059   }
10060   var baseSlice_default;
10061   var init_baseSlice = __esm({
10062     "node_modules/lodash-es/_baseSlice.js"() {
10063       baseSlice_default = baseSlice;
10064     }
10065   });
10066
10067   // node_modules/lodash-es/_basePropertyOf.js
10068   function basePropertyOf(object) {
10069     return function(key) {
10070       return object == null ? void 0 : object[key];
10071     };
10072   }
10073   var basePropertyOf_default;
10074   var init_basePropertyOf = __esm({
10075     "node_modules/lodash-es/_basePropertyOf.js"() {
10076       basePropertyOf_default = basePropertyOf;
10077     }
10078   });
10079
10080   // node_modules/lodash-es/_baseClamp.js
10081   function baseClamp(number3, lower2, upper) {
10082     if (number3 === number3) {
10083       if (upper !== void 0) {
10084         number3 = number3 <= upper ? number3 : upper;
10085       }
10086       if (lower2 !== void 0) {
10087         number3 = number3 >= lower2 ? number3 : lower2;
10088       }
10089     }
10090     return number3;
10091   }
10092   var baseClamp_default;
10093   var init_baseClamp = __esm({
10094     "node_modules/lodash-es/_baseClamp.js"() {
10095       baseClamp_default = baseClamp;
10096     }
10097   });
10098
10099   // node_modules/lodash-es/clamp.js
10100   function clamp(number3, lower2, upper) {
10101     if (upper === void 0) {
10102       upper = lower2;
10103       lower2 = void 0;
10104     }
10105     if (upper !== void 0) {
10106       upper = toNumber_default(upper);
10107       upper = upper === upper ? upper : 0;
10108     }
10109     if (lower2 !== void 0) {
10110       lower2 = toNumber_default(lower2);
10111       lower2 = lower2 === lower2 ? lower2 : 0;
10112     }
10113     return baseClamp_default(toNumber_default(number3), lower2, upper);
10114   }
10115   var clamp_default;
10116   var init_clamp = __esm({
10117     "node_modules/lodash-es/clamp.js"() {
10118       init_baseClamp();
10119       init_toNumber();
10120       clamp_default = clamp;
10121     }
10122   });
10123
10124   // node_modules/lodash-es/_stackClear.js
10125   function stackClear() {
10126     this.__data__ = new ListCache_default();
10127     this.size = 0;
10128   }
10129   var stackClear_default;
10130   var init_stackClear = __esm({
10131     "node_modules/lodash-es/_stackClear.js"() {
10132       init_ListCache();
10133       stackClear_default = stackClear;
10134     }
10135   });
10136
10137   // node_modules/lodash-es/_stackDelete.js
10138   function stackDelete(key) {
10139     var data = this.__data__, result = data["delete"](key);
10140     this.size = data.size;
10141     return result;
10142   }
10143   var stackDelete_default;
10144   var init_stackDelete = __esm({
10145     "node_modules/lodash-es/_stackDelete.js"() {
10146       stackDelete_default = stackDelete;
10147     }
10148   });
10149
10150   // node_modules/lodash-es/_stackGet.js
10151   function stackGet(key) {
10152     return this.__data__.get(key);
10153   }
10154   var stackGet_default;
10155   var init_stackGet = __esm({
10156     "node_modules/lodash-es/_stackGet.js"() {
10157       stackGet_default = stackGet;
10158     }
10159   });
10160
10161   // node_modules/lodash-es/_stackHas.js
10162   function stackHas(key) {
10163     return this.__data__.has(key);
10164   }
10165   var stackHas_default;
10166   var init_stackHas = __esm({
10167     "node_modules/lodash-es/_stackHas.js"() {
10168       stackHas_default = stackHas;
10169     }
10170   });
10171
10172   // node_modules/lodash-es/_stackSet.js
10173   function stackSet(key, value) {
10174     var data = this.__data__;
10175     if (data instanceof ListCache_default) {
10176       var pairs2 = data.__data__;
10177       if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
10178         pairs2.push([key, value]);
10179         this.size = ++data.size;
10180         return this;
10181       }
10182       data = this.__data__ = new MapCache_default(pairs2);
10183     }
10184     data.set(key, value);
10185     this.size = data.size;
10186     return this;
10187   }
10188   var LARGE_ARRAY_SIZE, stackSet_default;
10189   var init_stackSet = __esm({
10190     "node_modules/lodash-es/_stackSet.js"() {
10191       init_ListCache();
10192       init_Map();
10193       init_MapCache();
10194       LARGE_ARRAY_SIZE = 200;
10195       stackSet_default = stackSet;
10196     }
10197   });
10198
10199   // node_modules/lodash-es/_Stack.js
10200   function Stack(entries) {
10201     var data = this.__data__ = new ListCache_default(entries);
10202     this.size = data.size;
10203   }
10204   var Stack_default;
10205   var init_Stack = __esm({
10206     "node_modules/lodash-es/_Stack.js"() {
10207       init_ListCache();
10208       init_stackClear();
10209       init_stackDelete();
10210       init_stackGet();
10211       init_stackHas();
10212       init_stackSet();
10213       Stack.prototype.clear = stackClear_default;
10214       Stack.prototype["delete"] = stackDelete_default;
10215       Stack.prototype.get = stackGet_default;
10216       Stack.prototype.has = stackHas_default;
10217       Stack.prototype.set = stackSet_default;
10218       Stack_default = Stack;
10219     }
10220   });
10221
10222   // node_modules/lodash-es/_baseAssign.js
10223   function baseAssign(object, source) {
10224     return object && copyObject_default(source, keys_default(source), object);
10225   }
10226   var baseAssign_default;
10227   var init_baseAssign = __esm({
10228     "node_modules/lodash-es/_baseAssign.js"() {
10229       init_copyObject();
10230       init_keys();
10231       baseAssign_default = baseAssign;
10232     }
10233   });
10234
10235   // node_modules/lodash-es/_baseAssignIn.js
10236   function baseAssignIn(object, source) {
10237     return object && copyObject_default(source, keysIn_default(source), object);
10238   }
10239   var baseAssignIn_default;
10240   var init_baseAssignIn = __esm({
10241     "node_modules/lodash-es/_baseAssignIn.js"() {
10242       init_copyObject();
10243       init_keysIn();
10244       baseAssignIn_default = baseAssignIn;
10245     }
10246   });
10247
10248   // node_modules/lodash-es/_cloneBuffer.js
10249   function cloneBuffer(buffer, isDeep) {
10250     if (isDeep) {
10251       return buffer.slice();
10252     }
10253     var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
10254     buffer.copy(result);
10255     return result;
10256   }
10257   var freeExports3, freeModule3, moduleExports3, Buffer3, allocUnsafe, cloneBuffer_default;
10258   var init_cloneBuffer = __esm({
10259     "node_modules/lodash-es/_cloneBuffer.js"() {
10260       init_root();
10261       freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports;
10262       freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module;
10263       moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
10264       Buffer3 = moduleExports3 ? root_default.Buffer : void 0;
10265       allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0;
10266       cloneBuffer_default = cloneBuffer;
10267     }
10268   });
10269
10270   // node_modules/lodash-es/_arrayFilter.js
10271   function arrayFilter(array2, predicate) {
10272     var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
10273     while (++index < length2) {
10274       var value = array2[index];
10275       if (predicate(value, index, array2)) {
10276         result[resIndex++] = value;
10277       }
10278     }
10279     return result;
10280   }
10281   var arrayFilter_default;
10282   var init_arrayFilter = __esm({
10283     "node_modules/lodash-es/_arrayFilter.js"() {
10284       arrayFilter_default = arrayFilter;
10285     }
10286   });
10287
10288   // node_modules/lodash-es/stubArray.js
10289   function stubArray() {
10290     return [];
10291   }
10292   var stubArray_default;
10293   var init_stubArray = __esm({
10294     "node_modules/lodash-es/stubArray.js"() {
10295       stubArray_default = stubArray;
10296     }
10297   });
10298
10299   // node_modules/lodash-es/_getSymbols.js
10300   var objectProto13, propertyIsEnumerable2, nativeGetSymbols, getSymbols, getSymbols_default;
10301   var init_getSymbols = __esm({
10302     "node_modules/lodash-es/_getSymbols.js"() {
10303       init_arrayFilter();
10304       init_stubArray();
10305       objectProto13 = Object.prototype;
10306       propertyIsEnumerable2 = objectProto13.propertyIsEnumerable;
10307       nativeGetSymbols = Object.getOwnPropertySymbols;
10308       getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
10309         if (object == null) {
10310           return [];
10311         }
10312         object = Object(object);
10313         return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
10314           return propertyIsEnumerable2.call(object, symbol);
10315         });
10316       };
10317       getSymbols_default = getSymbols;
10318     }
10319   });
10320
10321   // node_modules/lodash-es/_copySymbols.js
10322   function copySymbols(source, object) {
10323     return copyObject_default(source, getSymbols_default(source), object);
10324   }
10325   var copySymbols_default;
10326   var init_copySymbols = __esm({
10327     "node_modules/lodash-es/_copySymbols.js"() {
10328       init_copyObject();
10329       init_getSymbols();
10330       copySymbols_default = copySymbols;
10331     }
10332   });
10333
10334   // node_modules/lodash-es/_getSymbolsIn.js
10335   var nativeGetSymbols2, getSymbolsIn, getSymbolsIn_default;
10336   var init_getSymbolsIn = __esm({
10337     "node_modules/lodash-es/_getSymbolsIn.js"() {
10338       init_arrayPush();
10339       init_getPrototype();
10340       init_getSymbols();
10341       init_stubArray();
10342       nativeGetSymbols2 = Object.getOwnPropertySymbols;
10343       getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object) {
10344         var result = [];
10345         while (object) {
10346           arrayPush_default(result, getSymbols_default(object));
10347           object = getPrototype_default(object);
10348         }
10349         return result;
10350       };
10351       getSymbolsIn_default = getSymbolsIn;
10352     }
10353   });
10354
10355   // node_modules/lodash-es/_copySymbolsIn.js
10356   function copySymbolsIn(source, object) {
10357     return copyObject_default(source, getSymbolsIn_default(source), object);
10358   }
10359   var copySymbolsIn_default;
10360   var init_copySymbolsIn = __esm({
10361     "node_modules/lodash-es/_copySymbolsIn.js"() {
10362       init_copyObject();
10363       init_getSymbolsIn();
10364       copySymbolsIn_default = copySymbolsIn;
10365     }
10366   });
10367
10368   // node_modules/lodash-es/_baseGetAllKeys.js
10369   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
10370     var result = keysFunc(object);
10371     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
10372   }
10373   var baseGetAllKeys_default;
10374   var init_baseGetAllKeys = __esm({
10375     "node_modules/lodash-es/_baseGetAllKeys.js"() {
10376       init_arrayPush();
10377       init_isArray();
10378       baseGetAllKeys_default = baseGetAllKeys;
10379     }
10380   });
10381
10382   // node_modules/lodash-es/_getAllKeys.js
10383   function getAllKeys(object) {
10384     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
10385   }
10386   var getAllKeys_default;
10387   var init_getAllKeys = __esm({
10388     "node_modules/lodash-es/_getAllKeys.js"() {
10389       init_baseGetAllKeys();
10390       init_getSymbols();
10391       init_keys();
10392       getAllKeys_default = getAllKeys;
10393     }
10394   });
10395
10396   // node_modules/lodash-es/_getAllKeysIn.js
10397   function getAllKeysIn(object) {
10398     return baseGetAllKeys_default(object, keysIn_default, getSymbolsIn_default);
10399   }
10400   var getAllKeysIn_default;
10401   var init_getAllKeysIn = __esm({
10402     "node_modules/lodash-es/_getAllKeysIn.js"() {
10403       init_baseGetAllKeys();
10404       init_getSymbolsIn();
10405       init_keysIn();
10406       getAllKeysIn_default = getAllKeysIn;
10407     }
10408   });
10409
10410   // node_modules/lodash-es/_DataView.js
10411   var DataView2, DataView_default;
10412   var init_DataView = __esm({
10413     "node_modules/lodash-es/_DataView.js"() {
10414       init_getNative();
10415       init_root();
10416       DataView2 = getNative_default(root_default, "DataView");
10417       DataView_default = DataView2;
10418     }
10419   });
10420
10421   // node_modules/lodash-es/_Promise.js
10422   var Promise2, Promise_default;
10423   var init_Promise = __esm({
10424     "node_modules/lodash-es/_Promise.js"() {
10425       init_getNative();
10426       init_root();
10427       Promise2 = getNative_default(root_default, "Promise");
10428       Promise_default = Promise2;
10429     }
10430   });
10431
10432   // node_modules/lodash-es/_Set.js
10433   var Set2, Set_default;
10434   var init_Set = __esm({
10435     "node_modules/lodash-es/_Set.js"() {
10436       init_getNative();
10437       init_root();
10438       Set2 = getNative_default(root_default, "Set");
10439       Set_default = Set2;
10440     }
10441   });
10442
10443   // node_modules/lodash-es/_getTag.js
10444   var mapTag2, objectTag3, promiseTag, setTag2, weakMapTag2, dataViewTag2, dataViewCtorString, mapCtorString, promiseCtorString, setCtorString, weakMapCtorString, getTag, getTag_default;
10445   var init_getTag = __esm({
10446     "node_modules/lodash-es/_getTag.js"() {
10447       init_DataView();
10448       init_Map();
10449       init_Promise();
10450       init_Set();
10451       init_WeakMap();
10452       init_baseGetTag();
10453       init_toSource();
10454       mapTag2 = "[object Map]";
10455       objectTag3 = "[object Object]";
10456       promiseTag = "[object Promise]";
10457       setTag2 = "[object Set]";
10458       weakMapTag2 = "[object WeakMap]";
10459       dataViewTag2 = "[object DataView]";
10460       dataViewCtorString = toSource_default(DataView_default);
10461       mapCtorString = toSource_default(Map_default);
10462       promiseCtorString = toSource_default(Promise_default);
10463       setCtorString = toSource_default(Set_default);
10464       weakMapCtorString = toSource_default(WeakMap_default);
10465       getTag = baseGetTag_default;
10466       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) {
10467         getTag = function(value) {
10468           var result = baseGetTag_default(value), Ctor = result == objectTag3 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
10469           if (ctorString) {
10470             switch (ctorString) {
10471               case dataViewCtorString:
10472                 return dataViewTag2;
10473               case mapCtorString:
10474                 return mapTag2;
10475               case promiseCtorString:
10476                 return promiseTag;
10477               case setCtorString:
10478                 return setTag2;
10479               case weakMapCtorString:
10480                 return weakMapTag2;
10481             }
10482           }
10483           return result;
10484         };
10485       }
10486       getTag_default = getTag;
10487     }
10488   });
10489
10490   // node_modules/lodash-es/_initCloneArray.js
10491   function initCloneArray(array2) {
10492     var length2 = array2.length, result = new array2.constructor(length2);
10493     if (length2 && typeof array2[0] == "string" && hasOwnProperty11.call(array2, "index")) {
10494       result.index = array2.index;
10495       result.input = array2.input;
10496     }
10497     return result;
10498   }
10499   var objectProto14, hasOwnProperty11, initCloneArray_default;
10500   var init_initCloneArray = __esm({
10501     "node_modules/lodash-es/_initCloneArray.js"() {
10502       objectProto14 = Object.prototype;
10503       hasOwnProperty11 = objectProto14.hasOwnProperty;
10504       initCloneArray_default = initCloneArray;
10505     }
10506   });
10507
10508   // node_modules/lodash-es/_Uint8Array.js
10509   var Uint8Array2, Uint8Array_default;
10510   var init_Uint8Array = __esm({
10511     "node_modules/lodash-es/_Uint8Array.js"() {
10512       init_root();
10513       Uint8Array2 = root_default.Uint8Array;
10514       Uint8Array_default = Uint8Array2;
10515     }
10516   });
10517
10518   // node_modules/lodash-es/_cloneArrayBuffer.js
10519   function cloneArrayBuffer(arrayBuffer) {
10520     var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
10521     new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer));
10522     return result;
10523   }
10524   var cloneArrayBuffer_default;
10525   var init_cloneArrayBuffer = __esm({
10526     "node_modules/lodash-es/_cloneArrayBuffer.js"() {
10527       init_Uint8Array();
10528       cloneArrayBuffer_default = cloneArrayBuffer;
10529     }
10530   });
10531
10532   // node_modules/lodash-es/_cloneDataView.js
10533   function cloneDataView(dataView, isDeep) {
10534     var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer;
10535     return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
10536   }
10537   var cloneDataView_default;
10538   var init_cloneDataView = __esm({
10539     "node_modules/lodash-es/_cloneDataView.js"() {
10540       init_cloneArrayBuffer();
10541       cloneDataView_default = cloneDataView;
10542     }
10543   });
10544
10545   // node_modules/lodash-es/_cloneRegExp.js
10546   function cloneRegExp(regexp) {
10547     var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
10548     result.lastIndex = regexp.lastIndex;
10549     return result;
10550   }
10551   var reFlags, cloneRegExp_default;
10552   var init_cloneRegExp = __esm({
10553     "node_modules/lodash-es/_cloneRegExp.js"() {
10554       reFlags = /\w*$/;
10555       cloneRegExp_default = cloneRegExp;
10556     }
10557   });
10558
10559   // node_modules/lodash-es/_cloneSymbol.js
10560   function cloneSymbol(symbol) {
10561     return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
10562   }
10563   var symbolProto2, symbolValueOf, cloneSymbol_default;
10564   var init_cloneSymbol = __esm({
10565     "node_modules/lodash-es/_cloneSymbol.js"() {
10566       init_Symbol();
10567       symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
10568       symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
10569       cloneSymbol_default = cloneSymbol;
10570     }
10571   });
10572
10573   // node_modules/lodash-es/_cloneTypedArray.js
10574   function cloneTypedArray(typedArray, isDeep) {
10575     var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer;
10576     return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
10577   }
10578   var cloneTypedArray_default;
10579   var init_cloneTypedArray = __esm({
10580     "node_modules/lodash-es/_cloneTypedArray.js"() {
10581       init_cloneArrayBuffer();
10582       cloneTypedArray_default = cloneTypedArray;
10583     }
10584   });
10585
10586   // node_modules/lodash-es/_initCloneByTag.js
10587   function initCloneByTag(object, tag, isDeep) {
10588     var Ctor = object.constructor;
10589     switch (tag) {
10590       case arrayBufferTag2:
10591         return cloneArrayBuffer_default(object);
10592       case boolTag2:
10593       case dateTag2:
10594         return new Ctor(+object);
10595       case dataViewTag3:
10596         return cloneDataView_default(object, isDeep);
10597       case float32Tag2:
10598       case float64Tag2:
10599       case int8Tag2:
10600       case int16Tag2:
10601       case int32Tag2:
10602       case uint8Tag2:
10603       case uint8ClampedTag2:
10604       case uint16Tag2:
10605       case uint32Tag2:
10606         return cloneTypedArray_default(object, isDeep);
10607       case mapTag3:
10608         return new Ctor();
10609       case numberTag2:
10610       case stringTag2:
10611         return new Ctor(object);
10612       case regexpTag2:
10613         return cloneRegExp_default(object);
10614       case setTag3:
10615         return new Ctor();
10616       case symbolTag2:
10617         return cloneSymbol_default(object);
10618     }
10619   }
10620   var boolTag2, dateTag2, mapTag3, numberTag2, regexpTag2, setTag3, stringTag2, symbolTag2, arrayBufferTag2, dataViewTag3, float32Tag2, float64Tag2, int8Tag2, int16Tag2, int32Tag2, uint8Tag2, uint8ClampedTag2, uint16Tag2, uint32Tag2, initCloneByTag_default;
10621   var init_initCloneByTag = __esm({
10622     "node_modules/lodash-es/_initCloneByTag.js"() {
10623       init_cloneArrayBuffer();
10624       init_cloneDataView();
10625       init_cloneRegExp();
10626       init_cloneSymbol();
10627       init_cloneTypedArray();
10628       boolTag2 = "[object Boolean]";
10629       dateTag2 = "[object Date]";
10630       mapTag3 = "[object Map]";
10631       numberTag2 = "[object Number]";
10632       regexpTag2 = "[object RegExp]";
10633       setTag3 = "[object Set]";
10634       stringTag2 = "[object String]";
10635       symbolTag2 = "[object Symbol]";
10636       arrayBufferTag2 = "[object ArrayBuffer]";
10637       dataViewTag3 = "[object DataView]";
10638       float32Tag2 = "[object Float32Array]";
10639       float64Tag2 = "[object Float64Array]";
10640       int8Tag2 = "[object Int8Array]";
10641       int16Tag2 = "[object Int16Array]";
10642       int32Tag2 = "[object Int32Array]";
10643       uint8Tag2 = "[object Uint8Array]";
10644       uint8ClampedTag2 = "[object Uint8ClampedArray]";
10645       uint16Tag2 = "[object Uint16Array]";
10646       uint32Tag2 = "[object Uint32Array]";
10647       initCloneByTag_default = initCloneByTag;
10648     }
10649   });
10650
10651   // node_modules/lodash-es/_initCloneObject.js
10652   function initCloneObject(object) {
10653     return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {};
10654   }
10655   var initCloneObject_default;
10656   var init_initCloneObject = __esm({
10657     "node_modules/lodash-es/_initCloneObject.js"() {
10658       init_baseCreate();
10659       init_getPrototype();
10660       init_isPrototype();
10661       initCloneObject_default = initCloneObject;
10662     }
10663   });
10664
10665   // node_modules/lodash-es/_baseIsMap.js
10666   function baseIsMap(value) {
10667     return isObjectLike_default(value) && getTag_default(value) == mapTag4;
10668   }
10669   var mapTag4, baseIsMap_default;
10670   var init_baseIsMap = __esm({
10671     "node_modules/lodash-es/_baseIsMap.js"() {
10672       init_getTag();
10673       init_isObjectLike();
10674       mapTag4 = "[object Map]";
10675       baseIsMap_default = baseIsMap;
10676     }
10677   });
10678
10679   // node_modules/lodash-es/isMap.js
10680   var nodeIsMap, isMap, isMap_default;
10681   var init_isMap = __esm({
10682     "node_modules/lodash-es/isMap.js"() {
10683       init_baseIsMap();
10684       init_baseUnary();
10685       init_nodeUtil();
10686       nodeIsMap = nodeUtil_default && nodeUtil_default.isMap;
10687       isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default;
10688       isMap_default = isMap;
10689     }
10690   });
10691
10692   // node_modules/lodash-es/_baseIsSet.js
10693   function baseIsSet(value) {
10694     return isObjectLike_default(value) && getTag_default(value) == setTag4;
10695   }
10696   var setTag4, baseIsSet_default;
10697   var init_baseIsSet = __esm({
10698     "node_modules/lodash-es/_baseIsSet.js"() {
10699       init_getTag();
10700       init_isObjectLike();
10701       setTag4 = "[object Set]";
10702       baseIsSet_default = baseIsSet;
10703     }
10704   });
10705
10706   // node_modules/lodash-es/isSet.js
10707   var nodeIsSet, isSet, isSet_default;
10708   var init_isSet = __esm({
10709     "node_modules/lodash-es/isSet.js"() {
10710       init_baseIsSet();
10711       init_baseUnary();
10712       init_nodeUtil();
10713       nodeIsSet = nodeUtil_default && nodeUtil_default.isSet;
10714       isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default;
10715       isSet_default = isSet;
10716     }
10717   });
10718
10719   // node_modules/lodash-es/_baseClone.js
10720   function baseClone(value, bitmask, customizer, key, object, stack) {
10721     var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
10722     if (customizer) {
10723       result = object ? customizer(value, key, object, stack) : customizer(value);
10724     }
10725     if (result !== void 0) {
10726       return result;
10727     }
10728     if (!isObject_default(value)) {
10729       return value;
10730     }
10731     var isArr = isArray_default(value);
10732     if (isArr) {
10733       result = initCloneArray_default(value);
10734       if (!isDeep) {
10735         return copyArray_default(value, result);
10736       }
10737     } else {
10738       var tag = getTag_default(value), isFunc = tag == funcTag3 || tag == genTag2;
10739       if (isBuffer_default(value)) {
10740         return cloneBuffer_default(value, isDeep);
10741       }
10742       if (tag == objectTag4 || tag == argsTag3 || isFunc && !object) {
10743         result = isFlat || isFunc ? {} : initCloneObject_default(value);
10744         if (!isDeep) {
10745           return isFlat ? copySymbolsIn_default(value, baseAssignIn_default(result, value)) : copySymbols_default(value, baseAssign_default(result, value));
10746         }
10747       } else {
10748         if (!cloneableTags[tag]) {
10749           return object ? value : {};
10750         }
10751         result = initCloneByTag_default(value, tag, isDeep);
10752       }
10753     }
10754     stack || (stack = new Stack_default());
10755     var stacked = stack.get(value);
10756     if (stacked) {
10757       return stacked;
10758     }
10759     stack.set(value, result);
10760     if (isSet_default(value)) {
10761       value.forEach(function(subValue) {
10762         result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
10763       });
10764     } else if (isMap_default(value)) {
10765       value.forEach(function(subValue, key2) {
10766         result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
10767       });
10768     }
10769     var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default;
10770     var props = isArr ? void 0 : keysFunc(value);
10771     arrayEach_default(props || value, function(subValue, key2) {
10772       if (props) {
10773         key2 = subValue;
10774         subValue = value[key2];
10775       }
10776       assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
10777     });
10778     return result;
10779   }
10780   var CLONE_DEEP_FLAG, CLONE_FLAT_FLAG, CLONE_SYMBOLS_FLAG, argsTag3, arrayTag2, boolTag3, dateTag3, errorTag2, funcTag3, genTag2, mapTag5, numberTag3, objectTag4, regexpTag3, setTag5, stringTag3, symbolTag3, weakMapTag3, arrayBufferTag3, dataViewTag4, float32Tag3, float64Tag3, int8Tag3, int16Tag3, int32Tag3, uint8Tag3, uint8ClampedTag3, uint16Tag3, uint32Tag3, cloneableTags, baseClone_default;
10781   var init_baseClone = __esm({
10782     "node_modules/lodash-es/_baseClone.js"() {
10783       init_Stack();
10784       init_arrayEach();
10785       init_assignValue();
10786       init_baseAssign();
10787       init_baseAssignIn();
10788       init_cloneBuffer();
10789       init_copyArray();
10790       init_copySymbols();
10791       init_copySymbolsIn();
10792       init_getAllKeys();
10793       init_getAllKeysIn();
10794       init_getTag();
10795       init_initCloneArray();
10796       init_initCloneByTag();
10797       init_initCloneObject();
10798       init_isArray();
10799       init_isBuffer();
10800       init_isMap();
10801       init_isObject();
10802       init_isSet();
10803       init_keys();
10804       init_keysIn();
10805       CLONE_DEEP_FLAG = 1;
10806       CLONE_FLAT_FLAG = 2;
10807       CLONE_SYMBOLS_FLAG = 4;
10808       argsTag3 = "[object Arguments]";
10809       arrayTag2 = "[object Array]";
10810       boolTag3 = "[object Boolean]";
10811       dateTag3 = "[object Date]";
10812       errorTag2 = "[object Error]";
10813       funcTag3 = "[object Function]";
10814       genTag2 = "[object GeneratorFunction]";
10815       mapTag5 = "[object Map]";
10816       numberTag3 = "[object Number]";
10817       objectTag4 = "[object Object]";
10818       regexpTag3 = "[object RegExp]";
10819       setTag5 = "[object Set]";
10820       stringTag3 = "[object String]";
10821       symbolTag3 = "[object Symbol]";
10822       weakMapTag3 = "[object WeakMap]";
10823       arrayBufferTag3 = "[object ArrayBuffer]";
10824       dataViewTag4 = "[object DataView]";
10825       float32Tag3 = "[object Float32Array]";
10826       float64Tag3 = "[object Float64Array]";
10827       int8Tag3 = "[object Int8Array]";
10828       int16Tag3 = "[object Int16Array]";
10829       int32Tag3 = "[object Int32Array]";
10830       uint8Tag3 = "[object Uint8Array]";
10831       uint8ClampedTag3 = "[object Uint8ClampedArray]";
10832       uint16Tag3 = "[object Uint16Array]";
10833       uint32Tag3 = "[object Uint32Array]";
10834       cloneableTags = {};
10835       cloneableTags[argsTag3] = cloneableTags[arrayTag2] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag5] = cloneableTags[numberTag3] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag5] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true;
10836       cloneableTags[errorTag2] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
10837       baseClone_default = baseClone;
10838     }
10839   });
10840
10841   // node_modules/lodash-es/_setCacheAdd.js
10842   function setCacheAdd(value) {
10843     this.__data__.set(value, HASH_UNDEFINED3);
10844     return this;
10845   }
10846   var HASH_UNDEFINED3, setCacheAdd_default;
10847   var init_setCacheAdd = __esm({
10848     "node_modules/lodash-es/_setCacheAdd.js"() {
10849       HASH_UNDEFINED3 = "__lodash_hash_undefined__";
10850       setCacheAdd_default = setCacheAdd;
10851     }
10852   });
10853
10854   // node_modules/lodash-es/_setCacheHas.js
10855   function setCacheHas(value) {
10856     return this.__data__.has(value);
10857   }
10858   var setCacheHas_default;
10859   var init_setCacheHas = __esm({
10860     "node_modules/lodash-es/_setCacheHas.js"() {
10861       setCacheHas_default = setCacheHas;
10862     }
10863   });
10864
10865   // node_modules/lodash-es/_SetCache.js
10866   function SetCache(values) {
10867     var index = -1, length2 = values == null ? 0 : values.length;
10868     this.__data__ = new MapCache_default();
10869     while (++index < length2) {
10870       this.add(values[index]);
10871     }
10872   }
10873   var SetCache_default;
10874   var init_SetCache = __esm({
10875     "node_modules/lodash-es/_SetCache.js"() {
10876       init_MapCache();
10877       init_setCacheAdd();
10878       init_setCacheHas();
10879       SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
10880       SetCache.prototype.has = setCacheHas_default;
10881       SetCache_default = SetCache;
10882     }
10883   });
10884
10885   // node_modules/lodash-es/_arraySome.js
10886   function arraySome(array2, predicate) {
10887     var index = -1, length2 = array2 == null ? 0 : array2.length;
10888     while (++index < length2) {
10889       if (predicate(array2[index], index, array2)) {
10890         return true;
10891       }
10892     }
10893     return false;
10894   }
10895   var arraySome_default;
10896   var init_arraySome = __esm({
10897     "node_modules/lodash-es/_arraySome.js"() {
10898       arraySome_default = arraySome;
10899     }
10900   });
10901
10902   // node_modules/lodash-es/_cacheHas.js
10903   function cacheHas(cache, key) {
10904     return cache.has(key);
10905   }
10906   var cacheHas_default;
10907   var init_cacheHas = __esm({
10908     "node_modules/lodash-es/_cacheHas.js"() {
10909       cacheHas_default = cacheHas;
10910     }
10911   });
10912
10913   // node_modules/lodash-es/_equalArrays.js
10914   function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
10915     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
10916     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
10917       return false;
10918     }
10919     var arrStacked = stack.get(array2);
10920     var othStacked = stack.get(other);
10921     if (arrStacked && othStacked) {
10922       return arrStacked == other && othStacked == array2;
10923     }
10924     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
10925     stack.set(array2, other);
10926     stack.set(other, array2);
10927     while (++index < arrLength) {
10928       var arrValue = array2[index], othValue = other[index];
10929       if (customizer) {
10930         var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
10931       }
10932       if (compared !== void 0) {
10933         if (compared) {
10934           continue;
10935         }
10936         result = false;
10937         break;
10938       }
10939       if (seen) {
10940         if (!arraySome_default(other, function(othValue2, othIndex) {
10941           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
10942             return seen.push(othIndex);
10943           }
10944         })) {
10945           result = false;
10946           break;
10947         }
10948       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
10949         result = false;
10950         break;
10951       }
10952     }
10953     stack["delete"](array2);
10954     stack["delete"](other);
10955     return result;
10956   }
10957   var COMPARE_PARTIAL_FLAG, COMPARE_UNORDERED_FLAG, equalArrays_default;
10958   var init_equalArrays = __esm({
10959     "node_modules/lodash-es/_equalArrays.js"() {
10960       init_SetCache();
10961       init_arraySome();
10962       init_cacheHas();
10963       COMPARE_PARTIAL_FLAG = 1;
10964       COMPARE_UNORDERED_FLAG = 2;
10965       equalArrays_default = equalArrays;
10966     }
10967   });
10968
10969   // node_modules/lodash-es/_mapToArray.js
10970   function mapToArray(map2) {
10971     var index = -1, result = Array(map2.size);
10972     map2.forEach(function(value, key) {
10973       result[++index] = [key, value];
10974     });
10975     return result;
10976   }
10977   var mapToArray_default;
10978   var init_mapToArray = __esm({
10979     "node_modules/lodash-es/_mapToArray.js"() {
10980       mapToArray_default = mapToArray;
10981     }
10982   });
10983
10984   // node_modules/lodash-es/_setToArray.js
10985   function setToArray(set4) {
10986     var index = -1, result = Array(set4.size);
10987     set4.forEach(function(value) {
10988       result[++index] = value;
10989     });
10990     return result;
10991   }
10992   var setToArray_default;
10993   var init_setToArray = __esm({
10994     "node_modules/lodash-es/_setToArray.js"() {
10995       setToArray_default = setToArray;
10996     }
10997   });
10998
10999   // node_modules/lodash-es/_equalByTag.js
11000   function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
11001     switch (tag) {
11002       case dataViewTag5:
11003         if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
11004           return false;
11005         }
11006         object = object.buffer;
11007         other = other.buffer;
11008       case arrayBufferTag4:
11009         if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
11010           return false;
11011         }
11012         return true;
11013       case boolTag4:
11014       case dateTag4:
11015       case numberTag4:
11016         return eq_default(+object, +other);
11017       case errorTag3:
11018         return object.name == other.name && object.message == other.message;
11019       case regexpTag4:
11020       case stringTag4:
11021         return object == other + "";
11022       case mapTag6:
11023         var convert = mapToArray_default;
11024       case setTag6:
11025         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
11026         convert || (convert = setToArray_default);
11027         if (object.size != other.size && !isPartial) {
11028           return false;
11029         }
11030         var stacked = stack.get(object);
11031         if (stacked) {
11032           return stacked == other;
11033         }
11034         bitmask |= COMPARE_UNORDERED_FLAG2;
11035         stack.set(object, other);
11036         var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
11037         stack["delete"](object);
11038         return result;
11039       case symbolTag4:
11040         if (symbolValueOf2) {
11041           return symbolValueOf2.call(object) == symbolValueOf2.call(other);
11042         }
11043     }
11044     return false;
11045   }
11046   var COMPARE_PARTIAL_FLAG2, COMPARE_UNORDERED_FLAG2, boolTag4, dateTag4, errorTag3, mapTag6, numberTag4, regexpTag4, setTag6, stringTag4, symbolTag4, arrayBufferTag4, dataViewTag5, symbolProto3, symbolValueOf2, equalByTag_default;
11047   var init_equalByTag = __esm({
11048     "node_modules/lodash-es/_equalByTag.js"() {
11049       init_Symbol();
11050       init_Uint8Array();
11051       init_eq();
11052       init_equalArrays();
11053       init_mapToArray();
11054       init_setToArray();
11055       COMPARE_PARTIAL_FLAG2 = 1;
11056       COMPARE_UNORDERED_FLAG2 = 2;
11057       boolTag4 = "[object Boolean]";
11058       dateTag4 = "[object Date]";
11059       errorTag3 = "[object Error]";
11060       mapTag6 = "[object Map]";
11061       numberTag4 = "[object Number]";
11062       regexpTag4 = "[object RegExp]";
11063       setTag6 = "[object Set]";
11064       stringTag4 = "[object String]";
11065       symbolTag4 = "[object Symbol]";
11066       arrayBufferTag4 = "[object ArrayBuffer]";
11067       dataViewTag5 = "[object DataView]";
11068       symbolProto3 = Symbol_default ? Symbol_default.prototype : void 0;
11069       symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : void 0;
11070       equalByTag_default = equalByTag;
11071     }
11072   });
11073
11074   // node_modules/lodash-es/_equalObjects.js
11075   function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
11076     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
11077     if (objLength != othLength && !isPartial) {
11078       return false;
11079     }
11080     var index = objLength;
11081     while (index--) {
11082       var key = objProps[index];
11083       if (!(isPartial ? key in other : hasOwnProperty12.call(other, key))) {
11084         return false;
11085       }
11086     }
11087     var objStacked = stack.get(object);
11088     var othStacked = stack.get(other);
11089     if (objStacked && othStacked) {
11090       return objStacked == other && othStacked == object;
11091     }
11092     var result = true;
11093     stack.set(object, other);
11094     stack.set(other, object);
11095     var skipCtor = isPartial;
11096     while (++index < objLength) {
11097       key = objProps[index];
11098       var objValue = object[key], othValue = other[key];
11099       if (customizer) {
11100         var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
11101       }
11102       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
11103         result = false;
11104         break;
11105       }
11106       skipCtor || (skipCtor = key == "constructor");
11107     }
11108     if (result && !skipCtor) {
11109       var objCtor = object.constructor, othCtor = other.constructor;
11110       if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
11111         result = false;
11112       }
11113     }
11114     stack["delete"](object);
11115     stack["delete"](other);
11116     return result;
11117   }
11118   var COMPARE_PARTIAL_FLAG3, objectProto15, hasOwnProperty12, equalObjects_default;
11119   var init_equalObjects = __esm({
11120     "node_modules/lodash-es/_equalObjects.js"() {
11121       init_getAllKeys();
11122       COMPARE_PARTIAL_FLAG3 = 1;
11123       objectProto15 = Object.prototype;
11124       hasOwnProperty12 = objectProto15.hasOwnProperty;
11125       equalObjects_default = equalObjects;
11126     }
11127   });
11128
11129   // node_modules/lodash-es/_baseIsEqualDeep.js
11130   function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
11131     var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag3 : getTag_default(object), othTag = othIsArr ? arrayTag3 : getTag_default(other);
11132     objTag = objTag == argsTag4 ? objectTag5 : objTag;
11133     othTag = othTag == argsTag4 ? objectTag5 : othTag;
11134     var objIsObj = objTag == objectTag5, othIsObj = othTag == objectTag5, isSameTag = objTag == othTag;
11135     if (isSameTag && isBuffer_default(object)) {
11136       if (!isBuffer_default(other)) {
11137         return false;
11138       }
11139       objIsArr = true;
11140       objIsObj = false;
11141     }
11142     if (isSameTag && !objIsObj) {
11143       stack || (stack = new Stack_default());
11144       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
11145     }
11146     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
11147       var objIsWrapped = objIsObj && hasOwnProperty13.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty13.call(other, "__wrapped__");
11148       if (objIsWrapped || othIsWrapped) {
11149         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
11150         stack || (stack = new Stack_default());
11151         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
11152       }
11153     }
11154     if (!isSameTag) {
11155       return false;
11156     }
11157     stack || (stack = new Stack_default());
11158     return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
11159   }
11160   var COMPARE_PARTIAL_FLAG4, argsTag4, arrayTag3, objectTag5, objectProto16, hasOwnProperty13, baseIsEqualDeep_default;
11161   var init_baseIsEqualDeep = __esm({
11162     "node_modules/lodash-es/_baseIsEqualDeep.js"() {
11163       init_Stack();
11164       init_equalArrays();
11165       init_equalByTag();
11166       init_equalObjects();
11167       init_getTag();
11168       init_isArray();
11169       init_isBuffer();
11170       init_isTypedArray();
11171       COMPARE_PARTIAL_FLAG4 = 1;
11172       argsTag4 = "[object Arguments]";
11173       arrayTag3 = "[object Array]";
11174       objectTag5 = "[object Object]";
11175       objectProto16 = Object.prototype;
11176       hasOwnProperty13 = objectProto16.hasOwnProperty;
11177       baseIsEqualDeep_default = baseIsEqualDeep;
11178     }
11179   });
11180
11181   // node_modules/lodash-es/_baseIsEqual.js
11182   function baseIsEqual(value, other, bitmask, customizer, stack) {
11183     if (value === other) {
11184       return true;
11185     }
11186     if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
11187       return value !== value && other !== other;
11188     }
11189     return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
11190   }
11191   var baseIsEqual_default;
11192   var init_baseIsEqual = __esm({
11193     "node_modules/lodash-es/_baseIsEqual.js"() {
11194       init_baseIsEqualDeep();
11195       init_isObjectLike();
11196       baseIsEqual_default = baseIsEqual;
11197     }
11198   });
11199
11200   // node_modules/lodash-es/_createBaseFor.js
11201   function createBaseFor(fromRight) {
11202     return function(object, iteratee, keysFunc) {
11203       var index = -1, iterable = Object(object), props = keysFunc(object), length2 = props.length;
11204       while (length2--) {
11205         var key = props[fromRight ? length2 : ++index];
11206         if (iteratee(iterable[key], key, iterable) === false) {
11207           break;
11208         }
11209       }
11210       return object;
11211     };
11212   }
11213   var createBaseFor_default;
11214   var init_createBaseFor = __esm({
11215     "node_modules/lodash-es/_createBaseFor.js"() {
11216       createBaseFor_default = createBaseFor;
11217     }
11218   });
11219
11220   // node_modules/lodash-es/_baseFor.js
11221   var baseFor, baseFor_default;
11222   var init_baseFor = __esm({
11223     "node_modules/lodash-es/_baseFor.js"() {
11224       init_createBaseFor();
11225       baseFor = createBaseFor_default();
11226       baseFor_default = baseFor;
11227     }
11228   });
11229
11230   // node_modules/lodash-es/now.js
11231   var now2, now_default;
11232   var init_now = __esm({
11233     "node_modules/lodash-es/now.js"() {
11234       init_root();
11235       now2 = function() {
11236         return root_default.Date.now();
11237       };
11238       now_default = now2;
11239     }
11240   });
11241
11242   // node_modules/lodash-es/debounce.js
11243   function debounce(func, wait, options) {
11244     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
11245     if (typeof func != "function") {
11246       throw new TypeError(FUNC_ERROR_TEXT2);
11247     }
11248     wait = toNumber_default(wait) || 0;
11249     if (isObject_default(options)) {
11250       leading = !!options.leading;
11251       maxing = "maxWait" in options;
11252       maxWait = maxing ? nativeMax2(toNumber_default(options.maxWait) || 0, wait) : maxWait;
11253       trailing = "trailing" in options ? !!options.trailing : trailing;
11254     }
11255     function invokeFunc(time) {
11256       var args = lastArgs, thisArg = lastThis;
11257       lastArgs = lastThis = void 0;
11258       lastInvokeTime = time;
11259       result = func.apply(thisArg, args);
11260       return result;
11261     }
11262     function leadingEdge(time) {
11263       lastInvokeTime = time;
11264       timerId = setTimeout(timerExpired, wait);
11265       return leading ? invokeFunc(time) : result;
11266     }
11267     function remainingWait(time) {
11268       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
11269       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
11270     }
11271     function shouldInvoke(time) {
11272       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
11273       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
11274     }
11275     function timerExpired() {
11276       var time = now_default();
11277       if (shouldInvoke(time)) {
11278         return trailingEdge(time);
11279       }
11280       timerId = setTimeout(timerExpired, remainingWait(time));
11281     }
11282     function trailingEdge(time) {
11283       timerId = void 0;
11284       if (trailing && lastArgs) {
11285         return invokeFunc(time);
11286       }
11287       lastArgs = lastThis = void 0;
11288       return result;
11289     }
11290     function cancel() {
11291       if (timerId !== void 0) {
11292         clearTimeout(timerId);
11293       }
11294       lastInvokeTime = 0;
11295       lastArgs = lastCallTime = lastThis = timerId = void 0;
11296     }
11297     function flush() {
11298       return timerId === void 0 ? result : trailingEdge(now_default());
11299     }
11300     function debounced() {
11301       var time = now_default(), isInvoking = shouldInvoke(time);
11302       lastArgs = arguments;
11303       lastThis = this;
11304       lastCallTime = time;
11305       if (isInvoking) {
11306         if (timerId === void 0) {
11307           return leadingEdge(lastCallTime);
11308         }
11309         if (maxing) {
11310           clearTimeout(timerId);
11311           timerId = setTimeout(timerExpired, wait);
11312           return invokeFunc(lastCallTime);
11313         }
11314       }
11315       if (timerId === void 0) {
11316         timerId = setTimeout(timerExpired, wait);
11317       }
11318       return result;
11319     }
11320     debounced.cancel = cancel;
11321     debounced.flush = flush;
11322     return debounced;
11323   }
11324   var FUNC_ERROR_TEXT2, nativeMax2, nativeMin, debounce_default;
11325   var init_debounce = __esm({
11326     "node_modules/lodash-es/debounce.js"() {
11327       init_isObject();
11328       init_now();
11329       init_toNumber();
11330       FUNC_ERROR_TEXT2 = "Expected a function";
11331       nativeMax2 = Math.max;
11332       nativeMin = Math.min;
11333       debounce_default = debounce;
11334     }
11335   });
11336
11337   // node_modules/lodash-es/_assignMergeValue.js
11338   function assignMergeValue(object, key, value) {
11339     if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
11340       baseAssignValue_default(object, key, value);
11341     }
11342   }
11343   var assignMergeValue_default;
11344   var init_assignMergeValue = __esm({
11345     "node_modules/lodash-es/_assignMergeValue.js"() {
11346       init_baseAssignValue();
11347       init_eq();
11348       assignMergeValue_default = assignMergeValue;
11349     }
11350   });
11351
11352   // node_modules/lodash-es/isArrayLikeObject.js
11353   function isArrayLikeObject(value) {
11354     return isObjectLike_default(value) && isArrayLike_default(value);
11355   }
11356   var isArrayLikeObject_default;
11357   var init_isArrayLikeObject = __esm({
11358     "node_modules/lodash-es/isArrayLikeObject.js"() {
11359       init_isArrayLike();
11360       init_isObjectLike();
11361       isArrayLikeObject_default = isArrayLikeObject;
11362     }
11363   });
11364
11365   // node_modules/lodash-es/_safeGet.js
11366   function safeGet(object, key) {
11367     if (key === "constructor" && typeof object[key] === "function") {
11368       return;
11369     }
11370     if (key == "__proto__") {
11371       return;
11372     }
11373     return object[key];
11374   }
11375   var safeGet_default;
11376   var init_safeGet = __esm({
11377     "node_modules/lodash-es/_safeGet.js"() {
11378       safeGet_default = safeGet;
11379     }
11380   });
11381
11382   // node_modules/lodash-es/toPlainObject.js
11383   function toPlainObject(value) {
11384     return copyObject_default(value, keysIn_default(value));
11385   }
11386   var toPlainObject_default;
11387   var init_toPlainObject = __esm({
11388     "node_modules/lodash-es/toPlainObject.js"() {
11389       init_copyObject();
11390       init_keysIn();
11391       toPlainObject_default = toPlainObject;
11392     }
11393   });
11394
11395   // node_modules/lodash-es/_baseMergeDeep.js
11396   function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
11397     var objValue = safeGet_default(object, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue);
11398     if (stacked) {
11399       assignMergeValue_default(object, key, stacked);
11400       return;
11401     }
11402     var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
11403     var isCommon = newValue === void 0;
11404     if (isCommon) {
11405       var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue);
11406       newValue = srcValue;
11407       if (isArr || isBuff || isTyped) {
11408         if (isArray_default(objValue)) {
11409           newValue = objValue;
11410         } else if (isArrayLikeObject_default(objValue)) {
11411           newValue = copyArray_default(objValue);
11412         } else if (isBuff) {
11413           isCommon = false;
11414           newValue = cloneBuffer_default(srcValue, true);
11415         } else if (isTyped) {
11416           isCommon = false;
11417           newValue = cloneTypedArray_default(srcValue, true);
11418         } else {
11419           newValue = [];
11420         }
11421       } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) {
11422         newValue = objValue;
11423         if (isArguments_default(objValue)) {
11424           newValue = toPlainObject_default(objValue);
11425         } else if (!isObject_default(objValue) || isFunction_default(objValue)) {
11426           newValue = initCloneObject_default(srcValue);
11427         }
11428       } else {
11429         isCommon = false;
11430       }
11431     }
11432     if (isCommon) {
11433       stack.set(srcValue, newValue);
11434       mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
11435       stack["delete"](srcValue);
11436     }
11437     assignMergeValue_default(object, key, newValue);
11438   }
11439   var baseMergeDeep_default;
11440   var init_baseMergeDeep = __esm({
11441     "node_modules/lodash-es/_baseMergeDeep.js"() {
11442       init_assignMergeValue();
11443       init_cloneBuffer();
11444       init_cloneTypedArray();
11445       init_copyArray();
11446       init_initCloneObject();
11447       init_isArguments();
11448       init_isArray();
11449       init_isArrayLikeObject();
11450       init_isBuffer();
11451       init_isFunction();
11452       init_isObject();
11453       init_isPlainObject();
11454       init_isTypedArray();
11455       init_safeGet();
11456       init_toPlainObject();
11457       baseMergeDeep_default = baseMergeDeep;
11458     }
11459   });
11460
11461   // node_modules/lodash-es/_baseMerge.js
11462   function baseMerge(object, source, srcIndex, customizer, stack) {
11463     if (object === source) {
11464       return;
11465     }
11466     baseFor_default(source, function(srcValue, key) {
11467       stack || (stack = new Stack_default());
11468       if (isObject_default(srcValue)) {
11469         baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack);
11470       } else {
11471         var newValue = customizer ? customizer(safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0;
11472         if (newValue === void 0) {
11473           newValue = srcValue;
11474         }
11475         assignMergeValue_default(object, key, newValue);
11476       }
11477     }, keysIn_default);
11478   }
11479   var baseMerge_default;
11480   var init_baseMerge = __esm({
11481     "node_modules/lodash-es/_baseMerge.js"() {
11482       init_Stack();
11483       init_assignMergeValue();
11484       init_baseFor();
11485       init_baseMergeDeep();
11486       init_isObject();
11487       init_keysIn();
11488       init_safeGet();
11489       baseMerge_default = baseMerge;
11490     }
11491   });
11492
11493   // node_modules/lodash-es/last.js
11494   function last(array2) {
11495     var length2 = array2 == null ? 0 : array2.length;
11496     return length2 ? array2[length2 - 1] : void 0;
11497   }
11498   var last_default;
11499   var init_last = __esm({
11500     "node_modules/lodash-es/last.js"() {
11501       last_default = last;
11502     }
11503   });
11504
11505   // node_modules/lodash-es/_escapeHtmlChar.js
11506   var htmlEscapes, escapeHtmlChar, escapeHtmlChar_default;
11507   var init_escapeHtmlChar = __esm({
11508     "node_modules/lodash-es/_escapeHtmlChar.js"() {
11509       init_basePropertyOf();
11510       htmlEscapes = {
11511         "&": "&amp;",
11512         "<": "&lt;",
11513         ">": "&gt;",
11514         '"': "&quot;",
11515         "'": "&#39;"
11516       };
11517       escapeHtmlChar = basePropertyOf_default(htmlEscapes);
11518       escapeHtmlChar_default = escapeHtmlChar;
11519     }
11520   });
11521
11522   // node_modules/lodash-es/escape.js
11523   function escape2(string) {
11524     string = toString_default(string);
11525     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
11526   }
11527   var reUnescapedHtml, reHasUnescapedHtml, escape_default;
11528   var init_escape = __esm({
11529     "node_modules/lodash-es/escape.js"() {
11530       init_escapeHtmlChar();
11531       init_toString();
11532       reUnescapedHtml = /[&<>"']/g;
11533       reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
11534       escape_default = escape2;
11535     }
11536   });
11537
11538   // node_modules/lodash-es/_parent.js
11539   function parent(object, path) {
11540     return path.length < 2 ? object : baseGet_default(object, baseSlice_default(path, 0, -1));
11541   }
11542   var parent_default;
11543   var init_parent = __esm({
11544     "node_modules/lodash-es/_parent.js"() {
11545       init_baseGet();
11546       init_baseSlice();
11547       parent_default = parent;
11548     }
11549   });
11550
11551   // node_modules/lodash-es/isEmpty.js
11552   function isEmpty(value) {
11553     if (value == null) {
11554       return true;
11555     }
11556     if (isArrayLike_default(value) && (isArray_default(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer_default(value) || isTypedArray_default(value) || isArguments_default(value))) {
11557       return !value.length;
11558     }
11559     var tag = getTag_default(value);
11560     if (tag == mapTag7 || tag == setTag7) {
11561       return !value.size;
11562     }
11563     if (isPrototype_default(value)) {
11564       return !baseKeys_default(value).length;
11565     }
11566     for (var key in value) {
11567       if (hasOwnProperty14.call(value, key)) {
11568         return false;
11569       }
11570     }
11571     return true;
11572   }
11573   var mapTag7, setTag7, objectProto17, hasOwnProperty14, isEmpty_default;
11574   var init_isEmpty = __esm({
11575     "node_modules/lodash-es/isEmpty.js"() {
11576       init_baseKeys();
11577       init_getTag();
11578       init_isArguments();
11579       init_isArray();
11580       init_isArrayLike();
11581       init_isBuffer();
11582       init_isPrototype();
11583       init_isTypedArray();
11584       mapTag7 = "[object Map]";
11585       setTag7 = "[object Set]";
11586       objectProto17 = Object.prototype;
11587       hasOwnProperty14 = objectProto17.hasOwnProperty;
11588       isEmpty_default = isEmpty;
11589     }
11590   });
11591
11592   // node_modules/lodash-es/isEqual.js
11593   function isEqual(value, other) {
11594     return baseIsEqual_default(value, other);
11595   }
11596   var isEqual_default;
11597   var init_isEqual = __esm({
11598     "node_modules/lodash-es/isEqual.js"() {
11599       init_baseIsEqual();
11600       isEqual_default = isEqual;
11601     }
11602   });
11603
11604   // node_modules/lodash-es/isNumber.js
11605   function isNumber(value) {
11606     return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag5;
11607   }
11608   var numberTag5, isNumber_default;
11609   var init_isNumber = __esm({
11610     "node_modules/lodash-es/isNumber.js"() {
11611       init_baseGetTag();
11612       init_isObjectLike();
11613       numberTag5 = "[object Number]";
11614       isNumber_default = isNumber;
11615     }
11616   });
11617
11618   // node_modules/lodash-es/merge.js
11619   var merge2, merge_default3;
11620   var init_merge4 = __esm({
11621     "node_modules/lodash-es/merge.js"() {
11622       init_baseMerge();
11623       init_createAssigner();
11624       merge2 = createAssigner_default(function(object, source, srcIndex) {
11625         baseMerge_default(object, source, srcIndex);
11626       });
11627       merge_default3 = merge2;
11628     }
11629   });
11630
11631   // node_modules/lodash-es/_baseUnset.js
11632   function baseUnset(object, path) {
11633     path = castPath_default(path, object);
11634     object = parent_default(object, path);
11635     return object == null || delete object[toKey_default(last_default(path))];
11636   }
11637   var baseUnset_default;
11638   var init_baseUnset = __esm({
11639     "node_modules/lodash-es/_baseUnset.js"() {
11640       init_castPath();
11641       init_last();
11642       init_parent();
11643       init_toKey();
11644       baseUnset_default = baseUnset;
11645     }
11646   });
11647
11648   // node_modules/lodash-es/_customOmitClone.js
11649   function customOmitClone(value) {
11650     return isPlainObject_default(value) ? void 0 : value;
11651   }
11652   var customOmitClone_default;
11653   var init_customOmitClone = __esm({
11654     "node_modules/lodash-es/_customOmitClone.js"() {
11655       init_isPlainObject();
11656       customOmitClone_default = customOmitClone;
11657     }
11658   });
11659
11660   // node_modules/lodash-es/omit.js
11661   var CLONE_DEEP_FLAG2, CLONE_FLAT_FLAG2, CLONE_SYMBOLS_FLAG2, omit, omit_default;
11662   var init_omit = __esm({
11663     "node_modules/lodash-es/omit.js"() {
11664       init_arrayMap();
11665       init_baseClone();
11666       init_baseUnset();
11667       init_castPath();
11668       init_copyObject();
11669       init_customOmitClone();
11670       init_flatRest();
11671       init_getAllKeysIn();
11672       CLONE_DEEP_FLAG2 = 1;
11673       CLONE_FLAT_FLAG2 = 2;
11674       CLONE_SYMBOLS_FLAG2 = 4;
11675       omit = flatRest_default(function(object, paths) {
11676         var result = {};
11677         if (object == null) {
11678           return result;
11679         }
11680         var isDeep = false;
11681         paths = arrayMap_default(paths, function(path) {
11682           path = castPath_default(path, object);
11683           isDeep || (isDeep = path.length > 1);
11684           return path;
11685         });
11686         copyObject_default(object, getAllKeysIn_default(object), result);
11687         if (isDeep) {
11688           result = baseClone_default(result, CLONE_DEEP_FLAG2 | CLONE_FLAT_FLAG2 | CLONE_SYMBOLS_FLAG2, customOmitClone_default);
11689         }
11690         var length2 = paths.length;
11691         while (length2--) {
11692           baseUnset_default(result, paths[length2]);
11693         }
11694         return result;
11695       });
11696       omit_default = omit;
11697     }
11698   });
11699
11700   // node_modules/lodash-es/throttle.js
11701   function throttle(func, wait, options) {
11702     var leading = true, trailing = true;
11703     if (typeof func != "function") {
11704       throw new TypeError(FUNC_ERROR_TEXT3);
11705     }
11706     if (isObject_default(options)) {
11707       leading = "leading" in options ? !!options.leading : leading;
11708       trailing = "trailing" in options ? !!options.trailing : trailing;
11709     }
11710     return debounce_default(func, wait, {
11711       "leading": leading,
11712       "maxWait": wait,
11713       "trailing": trailing
11714     });
11715   }
11716   var FUNC_ERROR_TEXT3, throttle_default;
11717   var init_throttle = __esm({
11718     "node_modules/lodash-es/throttle.js"() {
11719       init_debounce();
11720       init_isObject();
11721       FUNC_ERROR_TEXT3 = "Expected a function";
11722       throttle_default = throttle;
11723     }
11724   });
11725
11726   // node_modules/lodash-es/_unescapeHtmlChar.js
11727   var htmlUnescapes, unescapeHtmlChar, unescapeHtmlChar_default;
11728   var init_unescapeHtmlChar = __esm({
11729     "node_modules/lodash-es/_unescapeHtmlChar.js"() {
11730       init_basePropertyOf();
11731       htmlUnescapes = {
11732         "&amp;": "&",
11733         "&lt;": "<",
11734         "&gt;": ">",
11735         "&quot;": '"',
11736         "&#39;": "'"
11737       };
11738       unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
11739       unescapeHtmlChar_default = unescapeHtmlChar;
11740     }
11741   });
11742
11743   // node_modules/lodash-es/unescape.js
11744   function unescape(string) {
11745     string = toString_default(string);
11746     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
11747   }
11748   var reEscapedHtml, reHasEscapedHtml, unescape_default;
11749   var init_unescape = __esm({
11750     "node_modules/lodash-es/unescape.js"() {
11751       init_toString();
11752       init_unescapeHtmlChar();
11753       reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
11754       reHasEscapedHtml = RegExp(reEscapedHtml.source);
11755       unescape_default = unescape;
11756     }
11757   });
11758
11759   // node_modules/lodash-es/lodash.js
11760   var init_lodash = __esm({
11761     "node_modules/lodash-es/lodash.js"() {
11762       init_clamp();
11763       init_escape();
11764       init_isArray();
11765       init_isEmpty();
11766       init_isEqual();
11767       init_isNumber();
11768       init_merge4();
11769       init_omit();
11770       init_unescape();
11771     }
11772   });
11773
11774   // modules/osm/tags.js
11775   var tags_exports = {};
11776   __export(tags_exports, {
11777     allowUpperCaseTagValues: () => allowUpperCaseTagValues,
11778     isColourValid: () => isColourValid,
11779     osmAreaKeys: () => osmAreaKeys,
11780     osmAreaKeysExceptions: () => osmAreaKeysExceptions,
11781     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
11782     osmIsInterestingTag: () => osmIsInterestingTag,
11783     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
11784     osmLineTags: () => osmLineTags,
11785     osmMutuallyExclusiveTagPairs: () => osmMutuallyExclusiveTagPairs,
11786     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
11787     osmOneWayBackwardTags: () => osmOneWayBackwardTags,
11788     osmOneWayBiDirectionalTags: () => osmOneWayBiDirectionalTags,
11789     osmOneWayForwardTags: () => osmOneWayForwardTags,
11790     osmOneWayTags: () => osmOneWayTags,
11791     osmPathHighwayTagValues: () => osmPathHighwayTagValues,
11792     osmPavedTags: () => osmPavedTags,
11793     osmPointTags: () => osmPointTags,
11794     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
11795     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
11796     osmRightSideIsInsideTags: () => osmRightSideIsInsideTags,
11797     osmRoutableAerowayTags: () => osmRoutableAerowayTags,
11798     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
11799     osmSemipavedTags: () => osmSemipavedTags,
11800     osmSetAreaKeys: () => osmSetAreaKeys,
11801     osmSetLineTags: () => osmSetLineTags,
11802     osmSetPointTags: () => osmSetPointTags,
11803     osmSetVertexTags: () => osmSetVertexTags,
11804     osmShouldRenderDirection: () => osmShouldRenderDirection,
11805     osmSummableTags: () => osmSummableTags,
11806     osmTagSuggestingArea: () => osmTagSuggestingArea,
11807     osmVertexTags: () => osmVertexTags
11808   });
11809   function osmIsInterestingTag(key) {
11810     if (uninterestingKeys.has(key)) return false;
11811     if (uninterestingKeyRegex.test(key)) return false;
11812     return true;
11813   }
11814   function osmRemoveLifecyclePrefix(key) {
11815     const keySegments = key.split(":");
11816     if (keySegments.length === 1) return key;
11817     if (keySegments[0] in osmLifecyclePrefixes) {
11818       return key.slice(keySegments[0].length + 1);
11819     }
11820     return key;
11821   }
11822   function osmSetAreaKeys(value) {
11823     osmAreaKeys = value;
11824   }
11825   function osmTagSuggestingArea(tags) {
11826     if (tags.area === "yes") return { area: "yes" };
11827     if (tags.area === "no") return null;
11828     var returnTags = {};
11829     for (var realKey in tags) {
11830       const key = osmRemoveLifecyclePrefix(realKey);
11831       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
11832         returnTags[realKey] = tags[realKey];
11833         return returnTags;
11834       }
11835       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
11836         returnTags[realKey] = tags[realKey];
11837         return returnTags;
11838       }
11839     }
11840     return null;
11841   }
11842   function osmSetLineTags(value) {
11843     osmLineTags = value;
11844   }
11845   function osmSetPointTags(value) {
11846     osmPointTags = value;
11847   }
11848   function osmSetVertexTags(value) {
11849     osmVertexTags = value;
11850   }
11851   function osmNodeGeometriesForTags(nodeTags) {
11852     var geometries = {};
11853     for (var key in nodeTags) {
11854       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
11855         geometries.point = true;
11856       }
11857       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
11858         geometries.vertex = true;
11859       }
11860       if (geometries.point && geometries.vertex) break;
11861     }
11862     return geometries;
11863   }
11864   function isColourValid(value) {
11865     if (!value.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
11866       return false;
11867     }
11868     if (!CSS.supports("color", value) || ["unset", "inherit", "initial", "revert"].includes(value)) {
11869       return false;
11870     }
11871     return true;
11872   }
11873   function osmShouldRenderDirection(vertexTags, wayTags) {
11874     if (vertexTags.highway || vertexTags.traffic_sign || vertexTags.traffic_calming || vertexTags.barrier) {
11875       return !!(wayTags.highway || wayTags.railway);
11876     }
11877     if (vertexTags.railway) return !!wayTags.railway;
11878     if (vertexTags.waterway) return !!wayTags.waterway;
11879     if (vertexTags.cycleway === "asl") return !!wayTags.highway;
11880     return true;
11881   }
11882   var uninterestingKeys, uninterestingKeyRegex, osmLifecyclePrefixes, osmAreaKeys, osmAreaKeysExceptions, osmLineTags, osmPointTags, osmVertexTags, osmOneWayForwardTags, osmOneWayBackwardTags, osmOneWayBiDirectionalTags, osmOneWayTags, osmPavedTags, osmSemipavedTags, osmRightSideIsInsideTags, osmRoutableHighwayTagValues, osmRoutableAerowayTags, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmFlowingWaterwayTagValues, allowUpperCaseTagValues, osmMutuallyExclusiveTagPairs, osmSummableTags;
11883   var init_tags = __esm({
11884     "modules/osm/tags.js"() {
11885       "use strict";
11886       init_lodash();
11887       uninterestingKeys = /* @__PURE__ */ new Set([
11888         "attribution",
11889         "created_by",
11890         "import_uuid",
11891         "geobase:datasetName",
11892         "geobase:uuid",
11893         "KSJ2:curve_id",
11894         "KSJ2:lat",
11895         "KSJ2:long",
11896         "lat",
11897         "latitude",
11898         "lon",
11899         "longitude",
11900         "source",
11901         "source_ref",
11902         "odbl",
11903         "odbl:note"
11904       ]);
11905       uninterestingKeyRegex = /^(source(_ref)?|tiger):/;
11906       osmLifecyclePrefixes = {
11907         // nonexistent, might be built
11908         proposed: true,
11909         planned: true,
11910         // under maintenance or between groundbreaking and opening
11911         construction: true,
11912         // existent but not functional
11913         disused: true,
11914         // dilapidated to nonexistent
11915         abandoned: true,
11916         was: true,
11917         // nonexistent, still may appear in imagery
11918         dismantled: true,
11919         razed: true,
11920         demolished: true,
11921         destroyed: true,
11922         removed: true,
11923         obliterated: true,
11924         // existent occasionally, e.g. stormwater drainage basin
11925         intermittent: true
11926       };
11927       osmAreaKeys = {};
11928       osmAreaKeysExceptions = {
11929         highway: {
11930           elevator: true,
11931           rest_area: true,
11932           services: true
11933         },
11934         public_transport: {
11935           platform: true
11936         },
11937         railway: {
11938           platform: true,
11939           roundhouse: true,
11940           station: true,
11941           traverser: true,
11942           turntable: true,
11943           wash: true,
11944           ventilation_shaft: true
11945         },
11946         waterway: {
11947           dam: true
11948         },
11949         amenity: {
11950           bicycle_parking: true
11951         }
11952       };
11953       osmLineTags = {};
11954       osmPointTags = {};
11955       osmVertexTags = {};
11956       osmOneWayForwardTags = {
11957         "aerialway": {
11958           "chair_lift": true,
11959           "drag_lift": true,
11960           "j-bar": true,
11961           "magic_carpet": true,
11962           "mixed_lift": true,
11963           "platter": true,
11964           "rope_tow": true,
11965           "t-bar": true,
11966           "zip_line": true
11967         },
11968         "conveying": {
11969           "forward": true
11970         },
11971         "highway": {
11972           "motorway": true
11973         },
11974         "junction": {
11975           "circular": true,
11976           "roundabout": true
11977         },
11978         "man_made": {
11979           "goods_conveyor": true,
11980           "piste:halfpipe": true
11981         },
11982         "oneway": {
11983           "yes": true
11984         },
11985         "piste:type": {
11986           "downhill": true,
11987           "sled": true,
11988           "yes": true
11989         },
11990         "seamark:type": {
11991           "two-way_route": true,
11992           "recommended_traffic_lane": true,
11993           "separation_lane": true,
11994           "separation_roundabout": true
11995         },
11996         "waterway": {
11997           "canal": true,
11998           "ditch": true,
11999           "drain": true,
12000           "fish_pass": true,
12001           "flowline": true,
12002           "pressurised": true,
12003           "river": true,
12004           "spillway": true,
12005           "stream": true,
12006           "tidal_channel": true
12007         }
12008       };
12009       osmOneWayBackwardTags = {
12010         "conveying": {
12011           "backward": true
12012         },
12013         "oneway": {
12014           "-1": true
12015         }
12016       };
12017       osmOneWayBiDirectionalTags = {
12018         "conveying": {
12019           "reversible": true
12020         },
12021         "oneway": {
12022           "alternating": true,
12023           "reversible": true
12024         }
12025       };
12026       osmOneWayTags = merge_default3(
12027         osmOneWayForwardTags,
12028         osmOneWayBackwardTags,
12029         osmOneWayBiDirectionalTags
12030       );
12031       osmPavedTags = {
12032         "surface": {
12033           "paved": true,
12034           "asphalt": true,
12035           "concrete": true,
12036           "chipseal": true,
12037           "concrete:lanes": true,
12038           "concrete:plates": true
12039         },
12040         "tracktype": {
12041           "grade1": true
12042         }
12043       };
12044       osmSemipavedTags = {
12045         "surface": {
12046           "cobblestone": true,
12047           "cobblestone:flattened": true,
12048           "unhewn_cobblestone": true,
12049           "sett": true,
12050           "paving_stones": true,
12051           "metal": true,
12052           "wood": true
12053         }
12054       };
12055       osmRightSideIsInsideTags = {
12056         "natural": {
12057           "cliff": true,
12058           "coastline": "coastline"
12059         },
12060         "barrier": {
12061           "retaining_wall": true,
12062           "kerb": true,
12063           "guard_rail": true,
12064           "city_wall": true
12065         },
12066         "man_made": {
12067           "embankment": true,
12068           "quay": true
12069         },
12070         "waterway": {
12071           "weir": true
12072         }
12073       };
12074       osmRoutableHighwayTagValues = {
12075         motorway: true,
12076         trunk: true,
12077         primary: true,
12078         secondary: true,
12079         tertiary: true,
12080         residential: true,
12081         motorway_link: true,
12082         trunk_link: true,
12083         primary_link: true,
12084         secondary_link: true,
12085         tertiary_link: true,
12086         unclassified: true,
12087         road: true,
12088         service: true,
12089         track: true,
12090         living_street: true,
12091         bus_guideway: true,
12092         busway: true,
12093         path: true,
12094         footway: true,
12095         cycleway: true,
12096         bridleway: true,
12097         pedestrian: true,
12098         corridor: true,
12099         steps: true,
12100         ladder: true
12101       };
12102       osmRoutableAerowayTags = {
12103         runway: true,
12104         taxiway: true
12105       };
12106       osmPathHighwayTagValues = {
12107         path: true,
12108         footway: true,
12109         cycleway: true,
12110         bridleway: true,
12111         pedestrian: true,
12112         corridor: true,
12113         steps: true,
12114         ladder: true
12115       };
12116       osmRailwayTrackTagValues = {
12117         rail: true,
12118         light_rail: true,
12119         tram: true,
12120         subway: true,
12121         monorail: true,
12122         funicular: true,
12123         miniature: true,
12124         narrow_gauge: true,
12125         disused: true,
12126         preserved: true
12127       };
12128       osmFlowingWaterwayTagValues = {
12129         canal: true,
12130         ditch: true,
12131         drain: true,
12132         fish_pass: true,
12133         flowline: true,
12134         river: true,
12135         stream: true,
12136         tidal_channel: true
12137       };
12138       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/;
12139       osmMutuallyExclusiveTagPairs = [
12140         ["noname", "name"],
12141         ["noref", "ref"],
12142         ["nohousenumber", "addr:housenumber"],
12143         ["noaddress", "addr:housenumber"],
12144         ["noaddress", "addr:housename"],
12145         ["noaddress", "addr:unit"],
12146         ["addr:nostreet", "addr:street"]
12147       ];
12148       osmSummableTags = /* @__PURE__ */ new Set([
12149         "step_count",
12150         "parking:both:capacity",
12151         "parking:left:capacity",
12152         "parking:left:capacity"
12153       ]);
12154     }
12155   });
12156
12157   // modules/util/array.js
12158   var array_exports = {};
12159   __export(array_exports, {
12160     utilArrayChunk: () => utilArrayChunk,
12161     utilArrayDifference: () => utilArrayDifference,
12162     utilArrayFlatten: () => utilArrayFlatten,
12163     utilArrayGroupBy: () => utilArrayGroupBy,
12164     utilArrayIdentical: () => utilArrayIdentical,
12165     utilArrayIntersection: () => utilArrayIntersection,
12166     utilArrayUnion: () => utilArrayUnion,
12167     utilArrayUniq: () => utilArrayUniq,
12168     utilArrayUniqBy: () => utilArrayUniqBy
12169   });
12170   function utilArrayIdentical(a4, b3) {
12171     if (a4 === b3) return true;
12172     var i3 = a4.length;
12173     if (i3 !== b3.length) return false;
12174     while (i3--) {
12175       if (a4[i3] !== b3[i3]) return false;
12176     }
12177     return true;
12178   }
12179   function utilArrayDifference(a4, b3) {
12180     var other = new Set(b3);
12181     return Array.from(new Set(a4)).filter(function(v3) {
12182       return !other.has(v3);
12183     });
12184   }
12185   function utilArrayIntersection(a4, b3) {
12186     var other = new Set(b3);
12187     return Array.from(new Set(a4)).filter(function(v3) {
12188       return other.has(v3);
12189     });
12190   }
12191   function utilArrayUnion(a4, b3) {
12192     var result = new Set(a4);
12193     b3.forEach(function(v3) {
12194       result.add(v3);
12195     });
12196     return Array.from(result);
12197   }
12198   function utilArrayUniq(a4) {
12199     return Array.from(new Set(a4));
12200   }
12201   function utilArrayChunk(a4, chunkSize) {
12202     if (!chunkSize || chunkSize < 0) return [a4.slice()];
12203     var result = new Array(Math.ceil(a4.length / chunkSize));
12204     return Array.from(result, function(item, i3) {
12205       return a4.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
12206     });
12207   }
12208   function utilArrayFlatten(a4) {
12209     return a4.reduce(function(acc, val) {
12210       return acc.concat(val);
12211     }, []);
12212   }
12213   function utilArrayGroupBy(a4, key) {
12214     return a4.reduce(function(acc, item) {
12215       var group = typeof key === "function" ? key(item) : item[key];
12216       (acc[group] = acc[group] || []).push(item);
12217       return acc;
12218     }, {});
12219   }
12220   function utilArrayUniqBy(a4, key) {
12221     var seen = /* @__PURE__ */ new Set();
12222     return a4.reduce(function(acc, item) {
12223       var val = typeof key === "function" ? key(item) : item[key];
12224       if (val && !seen.has(val)) {
12225         seen.add(val);
12226         acc.push(item);
12227       }
12228       return acc;
12229     }, []);
12230   }
12231   var init_array3 = __esm({
12232     "modules/util/array.js"() {
12233       "use strict";
12234     }
12235   });
12236
12237   // node_modules/diacritics/index.js
12238   var require_diacritics = __commonJS({
12239     "node_modules/diacritics/index.js"(exports2) {
12240       exports2.remove = removeDiacritics2;
12241       var replacementList = [
12242         {
12243           base: " ",
12244           chars: "\xA0"
12245         },
12246         {
12247           base: "0",
12248           chars: "\u07C0"
12249         },
12250         {
12251           base: "A",
12252           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"
12253         },
12254         {
12255           base: "AA",
12256           chars: "\uA732"
12257         },
12258         {
12259           base: "AE",
12260           chars: "\xC6\u01FC\u01E2"
12261         },
12262         {
12263           base: "AO",
12264           chars: "\uA734"
12265         },
12266         {
12267           base: "AU",
12268           chars: "\uA736"
12269         },
12270         {
12271           base: "AV",
12272           chars: "\uA738\uA73A"
12273         },
12274         {
12275           base: "AY",
12276           chars: "\uA73C"
12277         },
12278         {
12279           base: "B",
12280           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
12281         },
12282         {
12283           base: "C",
12284           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
12285         },
12286         {
12287           base: "D",
12288           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
12289         },
12290         {
12291           base: "Dh",
12292           chars: "\xD0"
12293         },
12294         {
12295           base: "DZ",
12296           chars: "\u01F1\u01C4"
12297         },
12298         {
12299           base: "Dz",
12300           chars: "\u01F2\u01C5"
12301         },
12302         {
12303           base: "E",
12304           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"
12305         },
12306         {
12307           base: "F",
12308           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
12309         },
12310         {
12311           base: "G",
12312           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
12313         },
12314         {
12315           base: "H",
12316           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
12317         },
12318         {
12319           base: "I",
12320           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
12321         },
12322         {
12323           base: "J",
12324           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
12325         },
12326         {
12327           base: "K",
12328           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
12329         },
12330         {
12331           base: "L",
12332           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
12333         },
12334         {
12335           base: "LJ",
12336           chars: "\u01C7"
12337         },
12338         {
12339           base: "Lj",
12340           chars: "\u01C8"
12341         },
12342         {
12343           base: "M",
12344           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
12345         },
12346         {
12347           base: "N",
12348           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
12349         },
12350         {
12351           base: "NJ",
12352           chars: "\u01CA"
12353         },
12354         {
12355           base: "Nj",
12356           chars: "\u01CB"
12357         },
12358         {
12359           base: "O",
12360           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"
12361         },
12362         {
12363           base: "OE",
12364           chars: "\u0152"
12365         },
12366         {
12367           base: "OI",
12368           chars: "\u01A2"
12369         },
12370         {
12371           base: "OO",
12372           chars: "\uA74E"
12373         },
12374         {
12375           base: "OU",
12376           chars: "\u0222"
12377         },
12378         {
12379           base: "P",
12380           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
12381         },
12382         {
12383           base: "Q",
12384           chars: "\u24C6\uFF31\uA756\uA758\u024A"
12385         },
12386         {
12387           base: "R",
12388           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
12389         },
12390         {
12391           base: "S",
12392           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
12393         },
12394         {
12395           base: "T",
12396           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
12397         },
12398         {
12399           base: "Th",
12400           chars: "\xDE"
12401         },
12402         {
12403           base: "TZ",
12404           chars: "\uA728"
12405         },
12406         {
12407           base: "U",
12408           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"
12409         },
12410         {
12411           base: "V",
12412           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
12413         },
12414         {
12415           base: "VY",
12416           chars: "\uA760"
12417         },
12418         {
12419           base: "W",
12420           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
12421         },
12422         {
12423           base: "X",
12424           chars: "\u24CD\uFF38\u1E8A\u1E8C"
12425         },
12426         {
12427           base: "Y",
12428           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
12429         },
12430         {
12431           base: "Z",
12432           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
12433         },
12434         {
12435           base: "a",
12436           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"
12437         },
12438         {
12439           base: "aa",
12440           chars: "\uA733"
12441         },
12442         {
12443           base: "ae",
12444           chars: "\xE6\u01FD\u01E3"
12445         },
12446         {
12447           base: "ao",
12448           chars: "\uA735"
12449         },
12450         {
12451           base: "au",
12452           chars: "\uA737"
12453         },
12454         {
12455           base: "av",
12456           chars: "\uA739\uA73B"
12457         },
12458         {
12459           base: "ay",
12460           chars: "\uA73D"
12461         },
12462         {
12463           base: "b",
12464           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
12465         },
12466         {
12467           base: "c",
12468           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
12469         },
12470         {
12471           base: "d",
12472           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
12473         },
12474         {
12475           base: "dh",
12476           chars: "\xF0"
12477         },
12478         {
12479           base: "dz",
12480           chars: "\u01F3\u01C6"
12481         },
12482         {
12483           base: "e",
12484           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"
12485         },
12486         {
12487           base: "f",
12488           chars: "\u24D5\uFF46\u1E1F\u0192"
12489         },
12490         {
12491           base: "ff",
12492           chars: "\uFB00"
12493         },
12494         {
12495           base: "fi",
12496           chars: "\uFB01"
12497         },
12498         {
12499           base: "fl",
12500           chars: "\uFB02"
12501         },
12502         {
12503           base: "ffi",
12504           chars: "\uFB03"
12505         },
12506         {
12507           base: "ffl",
12508           chars: "\uFB04"
12509         },
12510         {
12511           base: "g",
12512           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
12513         },
12514         {
12515           base: "h",
12516           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
12517         },
12518         {
12519           base: "hv",
12520           chars: "\u0195"
12521         },
12522         {
12523           base: "i",
12524           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
12525         },
12526         {
12527           base: "j",
12528           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
12529         },
12530         {
12531           base: "k",
12532           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
12533         },
12534         {
12535           base: "l",
12536           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
12537         },
12538         {
12539           base: "lj",
12540           chars: "\u01C9"
12541         },
12542         {
12543           base: "m",
12544           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
12545         },
12546         {
12547           base: "n",
12548           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
12549         },
12550         {
12551           base: "nj",
12552           chars: "\u01CC"
12553         },
12554         {
12555           base: "o",
12556           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"
12557         },
12558         {
12559           base: "oe",
12560           chars: "\u0153"
12561         },
12562         {
12563           base: "oi",
12564           chars: "\u01A3"
12565         },
12566         {
12567           base: "oo",
12568           chars: "\uA74F"
12569         },
12570         {
12571           base: "ou",
12572           chars: "\u0223"
12573         },
12574         {
12575           base: "p",
12576           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
12577         },
12578         {
12579           base: "q",
12580           chars: "\u24E0\uFF51\u024B\uA757\uA759"
12581         },
12582         {
12583           base: "r",
12584           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
12585         },
12586         {
12587           base: "s",
12588           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
12589         },
12590         {
12591           base: "ss",
12592           chars: "\xDF"
12593         },
12594         {
12595           base: "t",
12596           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
12597         },
12598         {
12599           base: "th",
12600           chars: "\xFE"
12601         },
12602         {
12603           base: "tz",
12604           chars: "\uA729"
12605         },
12606         {
12607           base: "u",
12608           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"
12609         },
12610         {
12611           base: "v",
12612           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
12613         },
12614         {
12615           base: "vy",
12616           chars: "\uA761"
12617         },
12618         {
12619           base: "w",
12620           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
12621         },
12622         {
12623           base: "x",
12624           chars: "\u24E7\uFF58\u1E8B\u1E8D"
12625         },
12626         {
12627           base: "y",
12628           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
12629         },
12630         {
12631           base: "z",
12632           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
12633         }
12634       ];
12635       var diacriticsMap = {};
12636       for (i3 = 0; i3 < replacementList.length; i3 += 1) {
12637         chars = replacementList[i3].chars;
12638         for (j3 = 0; j3 < chars.length; j3 += 1) {
12639           diacriticsMap[chars[j3]] = replacementList[i3].base;
12640         }
12641       }
12642       var chars;
12643       var j3;
12644       var i3;
12645       function removeDiacritics2(str) {
12646         return str.replace(/[^\u0000-\u007e]/g, function(c2) {
12647           return diacriticsMap[c2] || c2;
12648         });
12649       }
12650       exports2.replacementList = replacementList;
12651       exports2.diacriticsMap = diacriticsMap;
12652     }
12653   });
12654
12655   // node_modules/alif-toolkit/lib/isArabic.js
12656   var require_isArabic = __commonJS({
12657     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
12658       "use strict";
12659       Object.defineProperty(exports2, "__esModule", { value: true });
12660       exports2.isArabic = isArabic;
12661       exports2.isMath = isMath;
12662       var arabicBlocks = [
12663         [1536, 1791],
12664         // Arabic https://www.unicode.org/charts/PDF/U0600.pdf
12665         [1872, 1919],
12666         // supplement https://www.unicode.org/charts/PDF/U0750.pdf
12667         [2208, 2303],
12668         // Extended-A https://www.unicode.org/charts/PDF/U08A0.pdf
12669         [64336, 65023],
12670         // Presentation Forms-A https://www.unicode.org/charts/PDF/UFB50.pdf
12671         [65136, 65279],
12672         // Presentation Forms-B https://www.unicode.org/charts/PDF/UFE70.pdf
12673         [69216, 69247],
12674         // Rumi numerals https://www.unicode.org/charts/PDF/U10E60.pdf
12675         [126064, 126143],
12676         // Indic Siyaq numerals https://www.unicode.org/charts/PDF/U1EC70.pdf
12677         [126464, 126719]
12678         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
12679       ];
12680       function isArabic(char) {
12681         if (char.length > 1) {
12682           throw new Error("isArabic works on only one-character strings");
12683         }
12684         let code = char.charCodeAt(0);
12685         for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
12686           let block = arabicBlocks[i3];
12687           if (code >= block[0] && code <= block[1]) {
12688             return true;
12689           }
12690         }
12691         return false;
12692       }
12693       function isMath(char) {
12694         if (char.length > 2) {
12695           throw new Error("isMath works on only one-character strings");
12696         }
12697         let code = char.charCodeAt(0);
12698         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
12699       }
12700     }
12701   });
12702
12703   // node_modules/alif-toolkit/lib/unicode-arabic.js
12704   var require_unicode_arabic = __commonJS({
12705     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
12706       "use strict";
12707       Object.defineProperty(exports2, "__esModule", { value: true });
12708       var arabicReference = {
12709         "alef": {
12710           "normal": [
12711             "\u0627"
12712           ],
12713           "madda_above": {
12714             "normal": [
12715               "\u0627\u0653",
12716               "\u0622"
12717             ],
12718             "isolated": "\uFE81",
12719             "final": "\uFE82"
12720           },
12721           "hamza_above": {
12722             "normal": [
12723               "\u0627\u0654",
12724               "\u0623"
12725             ],
12726             "isolated": "\uFE83",
12727             "final": "\uFE84"
12728           },
12729           "hamza_below": {
12730             "normal": [
12731               "\u0627\u0655",
12732               "\u0625"
12733             ],
12734             "isolated": "\uFE87",
12735             "final": "\uFE88"
12736           },
12737           "wasla": {
12738             "normal": "\u0671",
12739             "isolated": "\uFB50",
12740             "final": "\uFB51"
12741           },
12742           "wavy_hamza_above": [
12743             "\u0672"
12744           ],
12745           "wavy_hamza_below": [
12746             "\u0627\u065F",
12747             "\u0673"
12748           ],
12749           "high_hamza": [
12750             "\u0675",
12751             "\u0627\u0674"
12752           ],
12753           "indic_two_above": [
12754             "\u0773"
12755           ],
12756           "indic_three_above": [
12757             "\u0774"
12758           ],
12759           "fathatan": {
12760             "normal": [
12761               "\u0627\u064B"
12762             ],
12763             "final": "\uFD3C",
12764             "isolated": "\uFD3D"
12765           },
12766           "isolated": "\uFE8D",
12767           "final": "\uFE8E"
12768         },
12769         "beh": {
12770           "normal": [
12771             "\u0628"
12772           ],
12773           "dotless": [
12774             "\u066E"
12775           ],
12776           "three_dots_horizontally_below": [
12777             "\u0750"
12778           ],
12779           "dot_below_three_dots_above": [
12780             "\u0751"
12781           ],
12782           "three_dots_pointing_upwards_below": [
12783             "\u0752"
12784           ],
12785           "three_dots_pointing_upwards_below_two_dots_above": [
12786             "\u0753"
12787           ],
12788           "two_dots_below_dot_above": [
12789             "\u0754"
12790           ],
12791           "inverted_small_v_below": [
12792             "\u0755"
12793           ],
12794           "small_v": [
12795             "\u0756"
12796           ],
12797           "small_v_below": [
12798             "\u08A0"
12799           ],
12800           "hamza_above": [
12801             "\u08A1"
12802           ],
12803           "small_meem_above": [
12804             "\u08B6"
12805           ],
12806           "isolated": "\uFE8F",
12807           "final": "\uFE90",
12808           "initial": "\uFE91",
12809           "medial": "\uFE92"
12810         },
12811         "teh marbuta": {
12812           "normal": [
12813             "\u0629"
12814           ],
12815           "isolated": "\uFE93",
12816           "final": "\uFE94"
12817         },
12818         "teh": {
12819           "normal": [
12820             "\u062A"
12821           ],
12822           "ring": [
12823             "\u067C"
12824           ],
12825           "three_dots_above_downwards": [
12826             "\u067D"
12827           ],
12828           "small_teh_above": [
12829             "\u08B8"
12830           ],
12831           "isolated": "\uFE95",
12832           "final": "\uFE96",
12833           "initial": "\uFE97",
12834           "medial": "\uFE98"
12835         },
12836         "theh": {
12837           "normal": [
12838             "\u062B"
12839           ],
12840           "isolated": "\uFE99",
12841           "final": "\uFE9A",
12842           "initial": "\uFE9B",
12843           "medial": "\uFE9C"
12844         },
12845         "jeem": {
12846           "normal": [
12847             "\u062C"
12848           ],
12849           "two_dots_above": [
12850             "\u08A2"
12851           ],
12852           "isolated": "\uFE9D",
12853           "final": "\uFE9E",
12854           "initial": "\uFE9F",
12855           "medial": "\uFEA0"
12856         },
12857         "hah": {
12858           "normal": [
12859             "\u062D"
12860           ],
12861           "hamza_above": [
12862             "\u0681"
12863           ],
12864           "two_dots_vertical_above": [
12865             "\u0682"
12866           ],
12867           "three_dots_above": [
12868             "\u0685"
12869           ],
12870           "two_dots_above": [
12871             "\u0757"
12872           ],
12873           "three_dots_pointing_upwards_below": [
12874             "\u0758"
12875           ],
12876           "small_tah_below": [
12877             "\u076E"
12878           ],
12879           "small_tah_two_dots": [
12880             "\u076F"
12881           ],
12882           "small_tah_above": [
12883             "\u0772"
12884           ],
12885           "indic_four_below": [
12886             "\u077C"
12887           ],
12888           "isolated": "\uFEA1",
12889           "final": "\uFEA2",
12890           "initial": "\uFEA3",
12891           "medial": "\uFEA4"
12892         },
12893         "khah": {
12894           "normal": [
12895             "\u062E"
12896           ],
12897           "isolated": "\uFEA5",
12898           "final": "\uFEA6",
12899           "initial": "\uFEA7",
12900           "medial": "\uFEA8"
12901         },
12902         "dal": {
12903           "normal": [
12904             "\u062F"
12905           ],
12906           "ring": [
12907             "\u0689"
12908           ],
12909           "dot_below": [
12910             "\u068A"
12911           ],
12912           "dot_below_small_tah": [
12913             "\u068B"
12914           ],
12915           "three_dots_above_downwards": [
12916             "\u068F"
12917           ],
12918           "four_dots_above": [
12919             "\u0690"
12920           ],
12921           "inverted_v": [
12922             "\u06EE"
12923           ],
12924           "two_dots_vertically_below_small_tah": [
12925             "\u0759"
12926           ],
12927           "inverted_small_v_below": [
12928             "\u075A"
12929           ],
12930           "three_dots_below": [
12931             "\u08AE"
12932           ],
12933           "isolated": "\uFEA9",
12934           "final": "\uFEAA"
12935         },
12936         "thal": {
12937           "normal": [
12938             "\u0630"
12939           ],
12940           "isolated": "\uFEAB",
12941           "final": "\uFEAC"
12942         },
12943         "reh": {
12944           "normal": [
12945             "\u0631"
12946           ],
12947           "small_v": [
12948             "\u0692"
12949           ],
12950           "ring": [
12951             "\u0693"
12952           ],
12953           "dot_below": [
12954             "\u0694"
12955           ],
12956           "small_v_below": [
12957             "\u0695"
12958           ],
12959           "dot_below_dot_above": [
12960             "\u0696"
12961           ],
12962           "two_dots_above": [
12963             "\u0697"
12964           ],
12965           "four_dots_above": [
12966             "\u0699"
12967           ],
12968           "inverted_v": [
12969             "\u06EF"
12970           ],
12971           "stroke": [
12972             "\u075B"
12973           ],
12974           "two_dots_vertically_above": [
12975             "\u076B"
12976           ],
12977           "hamza_above": [
12978             "\u076C"
12979           ],
12980           "small_tah_two_dots": [
12981             "\u0771"
12982           ],
12983           "loop": [
12984             "\u08AA"
12985           ],
12986           "small_noon_above": [
12987             "\u08B9"
12988           ],
12989           "isolated": "\uFEAD",
12990           "final": "\uFEAE"
12991         },
12992         "zain": {
12993           "normal": [
12994             "\u0632"
12995           ],
12996           "inverted_v_above": [
12997             "\u08B2"
12998           ],
12999           "isolated": "\uFEAF",
13000           "final": "\uFEB0"
13001         },
13002         "seen": {
13003           "normal": [
13004             "\u0633"
13005           ],
13006           "dot_below_dot_above": [
13007             "\u069A"
13008           ],
13009           "three_dots_below": [
13010             "\u069B"
13011           ],
13012           "three_dots_below_three_dots_above": [
13013             "\u069C"
13014           ],
13015           "four_dots_above": [
13016             "\u075C"
13017           ],
13018           "two_dots_vertically_above": [
13019             "\u076D"
13020           ],
13021           "small_tah_two_dots": [
13022             "\u0770"
13023           ],
13024           "indic_four_above": [
13025             "\u077D"
13026           ],
13027           "inverted_v": [
13028             "\u077E"
13029           ],
13030           "isolated": "\uFEB1",
13031           "final": "\uFEB2",
13032           "initial": "\uFEB3",
13033           "medial": "\uFEB4"
13034         },
13035         "sheen": {
13036           "normal": [
13037             "\u0634"
13038           ],
13039           "dot_below": [
13040             "\u06FA"
13041           ],
13042           "isolated": "\uFEB5",
13043           "final": "\uFEB6",
13044           "initial": "\uFEB7",
13045           "medial": "\uFEB8"
13046         },
13047         "sad": {
13048           "normal": [
13049             "\u0635"
13050           ],
13051           "two_dots_below": [
13052             "\u069D"
13053           ],
13054           "three_dots_above": [
13055             "\u069E"
13056           ],
13057           "three_dots_below": [
13058             "\u08AF"
13059           ],
13060           "isolated": "\uFEB9",
13061           "final": "\uFEBA",
13062           "initial": "\uFEBB",
13063           "medial": "\uFEBC"
13064         },
13065         "dad": {
13066           "normal": [
13067             "\u0636"
13068           ],
13069           "dot_below": [
13070             "\u06FB"
13071           ],
13072           "isolated": "\uFEBD",
13073           "final": "\uFEBE",
13074           "initial": "\uFEBF",
13075           "medial": "\uFEC0"
13076         },
13077         "tah": {
13078           "normal": [
13079             "\u0637"
13080           ],
13081           "three_dots_above": [
13082             "\u069F"
13083           ],
13084           "two_dots_above": [
13085             "\u08A3"
13086           ],
13087           "isolated": "\uFEC1",
13088           "final": "\uFEC2",
13089           "initial": "\uFEC3",
13090           "medial": "\uFEC4"
13091         },
13092         "zah": {
13093           "normal": [
13094             "\u0638"
13095           ],
13096           "isolated": "\uFEC5",
13097           "final": "\uFEC6",
13098           "initial": "\uFEC7",
13099           "medial": "\uFEC8"
13100         },
13101         "ain": {
13102           "normal": [
13103             "\u0639"
13104           ],
13105           "three_dots_above": [
13106             "\u06A0"
13107           ],
13108           "two_dots_above": [
13109             "\u075D"
13110           ],
13111           "three_dots_pointing_downwards_above": [
13112             "\u075E"
13113           ],
13114           "two_dots_vertically_above": [
13115             "\u075F"
13116           ],
13117           "three_dots_below": [
13118             "\u08B3"
13119           ],
13120           "isolated": "\uFEC9",
13121           "final": "\uFECA",
13122           "initial": "\uFECB",
13123           "medial": "\uFECC"
13124         },
13125         "ghain": {
13126           "normal": [
13127             "\u063A"
13128           ],
13129           "dot_below": [
13130             "\u06FC"
13131           ],
13132           "isolated": "\uFECD",
13133           "final": "\uFECE",
13134           "initial": "\uFECF",
13135           "medial": "\uFED0"
13136         },
13137         "feh": {
13138           "normal": [
13139             "\u0641"
13140           ],
13141           "dotless": [
13142             "\u06A1"
13143           ],
13144           "dot_moved_below": [
13145             "\u06A2"
13146           ],
13147           "dot_below": [
13148             "\u06A3"
13149           ],
13150           "three_dots_below": [
13151             "\u06A5"
13152           ],
13153           "two_dots_below": [
13154             "\u0760"
13155           ],
13156           "three_dots_pointing_upwards_below": [
13157             "\u0761"
13158           ],
13159           "dot_below_three_dots_above": [
13160             "\u08A4"
13161           ],
13162           "isolated": "\uFED1",
13163           "final": "\uFED2",
13164           "initial": "\uFED3",
13165           "medial": "\uFED4"
13166         },
13167         "qaf": {
13168           "normal": [
13169             "\u0642"
13170           ],
13171           "dotless": [
13172             "\u066F"
13173           ],
13174           "dot_above": [
13175             "\u06A7"
13176           ],
13177           "three_dots_above": [
13178             "\u06A8"
13179           ],
13180           "dot_below": [
13181             "\u08A5"
13182           ],
13183           "isolated": "\uFED5",
13184           "final": "\uFED6",
13185           "initial": "\uFED7",
13186           "medial": "\uFED8"
13187         },
13188         "kaf": {
13189           "normal": [
13190             "\u0643"
13191           ],
13192           "swash": [
13193             "\u06AA"
13194           ],
13195           "ring": [
13196             "\u06AB"
13197           ],
13198           "dot_above": [
13199             "\u06AC"
13200           ],
13201           "three_dots_below": [
13202             "\u06AE"
13203           ],
13204           "two_dots_above": [
13205             "\u077F"
13206           ],
13207           "dot_below": [
13208             "\u08B4"
13209           ],
13210           "isolated": "\uFED9",
13211           "final": "\uFEDA",
13212           "initial": "\uFEDB",
13213           "medial": "\uFEDC"
13214         },
13215         "lam": {
13216           "normal": [
13217             "\u0644"
13218           ],
13219           "small_v": [
13220             "\u06B5"
13221           ],
13222           "dot_above": [
13223             "\u06B6"
13224           ],
13225           "three_dots_above": [
13226             "\u06B7"
13227           ],
13228           "three_dots_below": [
13229             "\u06B8"
13230           ],
13231           "bar": [
13232             "\u076A"
13233           ],
13234           "double_bar": [
13235             "\u08A6"
13236           ],
13237           "isolated": "\uFEDD",
13238           "final": "\uFEDE",
13239           "initial": "\uFEDF",
13240           "medial": "\uFEE0"
13241         },
13242         "meem": {
13243           "normal": [
13244             "\u0645"
13245           ],
13246           "dot_above": [
13247             "\u0765"
13248           ],
13249           "dot_below": [
13250             "\u0766"
13251           ],
13252           "three_dots_above": [
13253             "\u08A7"
13254           ],
13255           "isolated": "\uFEE1",
13256           "final": "\uFEE2",
13257           "initial": "\uFEE3",
13258           "medial": "\uFEE4"
13259         },
13260         "noon": {
13261           "normal": [
13262             "\u0646"
13263           ],
13264           "dot_below": [
13265             "\u06B9"
13266           ],
13267           "ring": [
13268             "\u06BC"
13269           ],
13270           "three_dots_above": [
13271             "\u06BD"
13272           ],
13273           "two_dots_below": [
13274             "\u0767"
13275           ],
13276           "small_tah": [
13277             "\u0768"
13278           ],
13279           "small_v": [
13280             "\u0769"
13281           ],
13282           "isolated": "\uFEE5",
13283           "final": "\uFEE6",
13284           "initial": "\uFEE7",
13285           "medial": "\uFEE8"
13286         },
13287         "heh": {
13288           "normal": [
13289             "\u0647"
13290           ],
13291           "isolated": "\uFEE9",
13292           "final": "\uFEEA",
13293           "initial": "\uFEEB",
13294           "medial": "\uFEEC"
13295         },
13296         "waw": {
13297           "normal": [
13298             "\u0648"
13299           ],
13300           "hamza_above": {
13301             "normal": [
13302               "\u0624",
13303               "\u0648\u0654"
13304             ],
13305             "isolated": "\uFE85",
13306             "final": "\uFE86"
13307           },
13308           "high_hamza": [
13309             "\u0676",
13310             "\u0648\u0674"
13311           ],
13312           "ring": [
13313             "\u06C4"
13314           ],
13315           "two_dots_above": [
13316             "\u06CA"
13317           ],
13318           "dot_above": [
13319             "\u06CF"
13320           ],
13321           "indic_two_above": [
13322             "\u0778"
13323           ],
13324           "indic_three_above": [
13325             "\u0779"
13326           ],
13327           "dot_within": [
13328             "\u08AB"
13329           ],
13330           "isolated": "\uFEED",
13331           "final": "\uFEEE"
13332         },
13333         "alef_maksura": {
13334           "normal": [
13335             "\u0649"
13336           ],
13337           "hamza_above": [
13338             "\u0626",
13339             "\u064A\u0654"
13340           ],
13341           "initial": "\uFBE8",
13342           "medial": "\uFBE9",
13343           "isolated": "\uFEEF",
13344           "final": "\uFEF0"
13345         },
13346         "yeh": {
13347           "normal": [
13348             "\u064A"
13349           ],
13350           "hamza_above": {
13351             "normal": [
13352               "\u0626",
13353               "\u0649\u0654"
13354             ],
13355             "isolated": "\uFE89",
13356             "final": "\uFE8A",
13357             "initial": "\uFE8B",
13358             "medial": "\uFE8C"
13359           },
13360           "two_dots_below_hamza_above": [
13361             "\u08A8"
13362           ],
13363           "high_hamza": [
13364             "\u0678",
13365             "\u064A\u0674"
13366           ],
13367           "tail": [
13368             "\u06CD"
13369           ],
13370           "small_v": [
13371             "\u06CE"
13372           ],
13373           "three_dots_below": [
13374             "\u06D1"
13375           ],
13376           "two_dots_below_dot_above": [
13377             "\u08A9"
13378           ],
13379           "two_dots_below_small_noon_above": [
13380             "\u08BA"
13381           ],
13382           "isolated": "\uFEF1",
13383           "final": "\uFEF2",
13384           "initial": "\uFEF3",
13385           "medial": "\uFEF4"
13386         },
13387         "tteh": {
13388           "normal": [
13389             "\u0679"
13390           ],
13391           "isolated": "\uFB66",
13392           "final": "\uFB67",
13393           "initial": "\uFB68",
13394           "medial": "\uFB69"
13395         },
13396         "tteheh": {
13397           "normal": [
13398             "\u067A"
13399           ],
13400           "isolated": "\uFB5E",
13401           "final": "\uFB5F",
13402           "initial": "\uFB60",
13403           "medial": "\uFB61"
13404         },
13405         "beeh": {
13406           "normal": [
13407             "\u067B"
13408           ],
13409           "isolated": "\uFB52",
13410           "final": "\uFB53",
13411           "initial": "\uFB54",
13412           "medial": "\uFB55"
13413         },
13414         "peh": {
13415           "normal": [
13416             "\u067E"
13417           ],
13418           "small_meem_above": [
13419             "\u08B7"
13420           ],
13421           "isolated": "\uFB56",
13422           "final": "\uFB57",
13423           "initial": "\uFB58",
13424           "medial": "\uFB59"
13425         },
13426         "teheh": {
13427           "normal": [
13428             "\u067F"
13429           ],
13430           "isolated": "\uFB62",
13431           "final": "\uFB63",
13432           "initial": "\uFB64",
13433           "medial": "\uFB65"
13434         },
13435         "beheh": {
13436           "normal": [
13437             "\u0680"
13438           ],
13439           "isolated": "\uFB5A",
13440           "final": "\uFB5B",
13441           "initial": "\uFB5C",
13442           "medial": "\uFB5D"
13443         },
13444         "nyeh": {
13445           "normal": [
13446             "\u0683"
13447           ],
13448           "isolated": "\uFB76",
13449           "final": "\uFB77",
13450           "initial": "\uFB78",
13451           "medial": "\uFB79"
13452         },
13453         "dyeh": {
13454           "normal": [
13455             "\u0684"
13456           ],
13457           "isolated": "\uFB72",
13458           "final": "\uFB73",
13459           "initial": "\uFB74",
13460           "medial": "\uFB75"
13461         },
13462         "tcheh": {
13463           "normal": [
13464             "\u0686"
13465           ],
13466           "dot_above": [
13467             "\u06BF"
13468           ],
13469           "isolated": "\uFB7A",
13470           "final": "\uFB7B",
13471           "initial": "\uFB7C",
13472           "medial": "\uFB7D"
13473         },
13474         "tcheheh": {
13475           "normal": [
13476             "\u0687"
13477           ],
13478           "isolated": "\uFB7E",
13479           "final": "\uFB7F",
13480           "initial": "\uFB80",
13481           "medial": "\uFB81"
13482         },
13483         "ddal": {
13484           "normal": [
13485             "\u0688"
13486           ],
13487           "isolated": "\uFB88",
13488           "final": "\uFB89"
13489         },
13490         "dahal": {
13491           "normal": [
13492             "\u068C"
13493           ],
13494           "isolated": "\uFB84",
13495           "final": "\uFB85"
13496         },
13497         "ddahal": {
13498           "normal": [
13499             "\u068D"
13500           ],
13501           "isolated": "\uFB82",
13502           "final": "\uFB83"
13503         },
13504         "dul": {
13505           "normal": [
13506             "\u068F",
13507             "\u068E"
13508           ],
13509           "isolated": "\uFB86",
13510           "final": "\uFB87"
13511         },
13512         "rreh": {
13513           "normal": [
13514             "\u0691"
13515           ],
13516           "isolated": "\uFB8C",
13517           "final": "\uFB8D"
13518         },
13519         "jeh": {
13520           "normal": [
13521             "\u0698"
13522           ],
13523           "isolated": "\uFB8A",
13524           "final": "\uFB8B"
13525         },
13526         "veh": {
13527           "normal": [
13528             "\u06A4"
13529           ],
13530           "isolated": "\uFB6A",
13531           "final": "\uFB6B",
13532           "initial": "\uFB6C",
13533           "medial": "\uFB6D"
13534         },
13535         "peheh": {
13536           "normal": [
13537             "\u06A6"
13538           ],
13539           "isolated": "\uFB6E",
13540           "final": "\uFB6F",
13541           "initial": "\uFB70",
13542           "medial": "\uFB71"
13543         },
13544         "keheh": {
13545           "normal": [
13546             "\u06A9"
13547           ],
13548           "dot_above": [
13549             "\u0762"
13550           ],
13551           "three_dots_above": [
13552             "\u0763"
13553           ],
13554           "three_dots_pointing_upwards_below": [
13555             "\u0764"
13556           ],
13557           "isolated": "\uFB8E",
13558           "final": "\uFB8F",
13559           "initial": "\uFB90",
13560           "medial": "\uFB91"
13561         },
13562         "ng": {
13563           "normal": [
13564             "\u06AD"
13565           ],
13566           "isolated": "\uFBD3",
13567           "final": "\uFBD4",
13568           "initial": "\uFBD5",
13569           "medial": "\uFBD6"
13570         },
13571         "gaf": {
13572           "normal": [
13573             "\u06AF"
13574           ],
13575           "ring": [
13576             "\u06B0"
13577           ],
13578           "two_dots_below": [
13579             "\u06B2"
13580           ],
13581           "three_dots_above": [
13582             "\u06B4"
13583           ],
13584           "inverted_stroke": [
13585             "\u08B0"
13586           ],
13587           "isolated": "\uFB92",
13588           "final": "\uFB93",
13589           "initial": "\uFB94",
13590           "medial": "\uFB95"
13591         },
13592         "ngoeh": {
13593           "normal": [
13594             "\u06B1"
13595           ],
13596           "isolated": "\uFB9A",
13597           "final": "\uFB9B",
13598           "initial": "\uFB9C",
13599           "medial": "\uFB9D"
13600         },
13601         "gueh": {
13602           "normal": [
13603             "\u06B3"
13604           ],
13605           "isolated": "\uFB96",
13606           "final": "\uFB97",
13607           "initial": "\uFB98",
13608           "medial": "\uFB99"
13609         },
13610         "noon ghunna": {
13611           "normal": [
13612             "\u06BA"
13613           ],
13614           "isolated": "\uFB9E",
13615           "final": "\uFB9F"
13616         },
13617         "rnoon": {
13618           "normal": [
13619             "\u06BB"
13620           ],
13621           "isolated": "\uFBA0",
13622           "final": "\uFBA1",
13623           "initial": "\uFBA2",
13624           "medial": "\uFBA3"
13625         },
13626         "heh doachashmee": {
13627           "normal": [
13628             "\u06BE"
13629           ],
13630           "isolated": "\uFBAA",
13631           "final": "\uFBAB",
13632           "initial": "\uFBAC",
13633           "medial": "\uFBAD"
13634         },
13635         "heh goal": {
13636           "normal": [
13637             "\u06C1"
13638           ],
13639           "hamza_above": [
13640             "\u06C1\u0654",
13641             "\u06C2"
13642           ],
13643           "isolated": "\uFBA6",
13644           "final": "\uFBA7",
13645           "initial": "\uFBA8",
13646           "medial": "\uFBA9"
13647         },
13648         "teh marbuta goal": {
13649           "normal": [
13650             "\u06C3"
13651           ]
13652         },
13653         "kirghiz oe": {
13654           "normal": [
13655             "\u06C5"
13656           ],
13657           "isolated": "\uFBE0",
13658           "final": "\uFBE1"
13659         },
13660         "oe": {
13661           "normal": [
13662             "\u06C6"
13663           ],
13664           "isolated": "\uFBD9",
13665           "final": "\uFBDA"
13666         },
13667         "u": {
13668           "normal": [
13669             "\u06C7"
13670           ],
13671           "hamza_above": {
13672             "normal": [
13673               "\u0677",
13674               "\u06C7\u0674"
13675             ],
13676             "isolated": "\uFBDD"
13677           },
13678           "isolated": "\uFBD7",
13679           "final": "\uFBD8"
13680         },
13681         "yu": {
13682           "normal": [
13683             "\u06C8"
13684           ],
13685           "isolated": "\uFBDB",
13686           "final": "\uFBDC"
13687         },
13688         "kirghiz yu": {
13689           "normal": [
13690             "\u06C9"
13691           ],
13692           "isolated": "\uFBE2",
13693           "final": "\uFBE3"
13694         },
13695         "ve": {
13696           "normal": [
13697             "\u06CB"
13698           ],
13699           "isolated": "\uFBDE",
13700           "final": "\uFBDF"
13701         },
13702         "farsi yeh": {
13703           "normal": [
13704             "\u06CC"
13705           ],
13706           "indic_two_above": [
13707             "\u0775"
13708           ],
13709           "indic_three_above": [
13710             "\u0776"
13711           ],
13712           "indic_four_above": [
13713             "\u0777"
13714           ],
13715           "isolated": "\uFBFC",
13716           "final": "\uFBFD",
13717           "initial": "\uFBFE",
13718           "medial": "\uFBFF"
13719         },
13720         "e": {
13721           "normal": [
13722             "\u06D0"
13723           ],
13724           "isolated": "\uFBE4",
13725           "final": "\uFBE5",
13726           "initial": "\uFBE6",
13727           "medial": "\uFBE7"
13728         },
13729         "yeh barree": {
13730           "normal": [
13731             "\u06D2"
13732           ],
13733           "hamza_above": {
13734             "normal": [
13735               "\u06D2\u0654",
13736               "\u06D3"
13737             ],
13738             "isolated": "\uFBB0",
13739             "final": "\uFBB1"
13740           },
13741           "indic_two_above": [
13742             "\u077A"
13743           ],
13744           "indic_three_above": [
13745             "\u077B"
13746           ],
13747           "isolated": "\uFBAE",
13748           "final": "\uFBAF"
13749         },
13750         "ae": {
13751           "normal": [
13752             "\u06D5"
13753           ],
13754           "isolated": "\u06D5",
13755           "final": "\uFEEA",
13756           "yeh_above": {
13757             "normal": [
13758               "\u06C0",
13759               "\u06D5\u0654"
13760             ],
13761             "isolated": "\uFBA4",
13762             "final": "\uFBA5"
13763           }
13764         },
13765         "rohingya yeh": {
13766           "normal": [
13767             "\u08AC"
13768           ]
13769         },
13770         "low alef": {
13771           "normal": [
13772             "\u08AD"
13773           ]
13774         },
13775         "straight waw": {
13776           "normal": [
13777             "\u08B1"
13778           ]
13779         },
13780         "african feh": {
13781           "normal": [
13782             "\u08BB"
13783           ]
13784         },
13785         "african qaf": {
13786           "normal": [
13787             "\u08BC"
13788           ]
13789         },
13790         "african noon": {
13791           "normal": [
13792             "\u08BD"
13793           ]
13794         }
13795       };
13796       exports2.default = arabicReference;
13797     }
13798   });
13799
13800   // node_modules/alif-toolkit/lib/unicode-ligatures.js
13801   var require_unicode_ligatures = __commonJS({
13802     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
13803       "use strict";
13804       Object.defineProperty(exports2, "__esModule", { value: true });
13805       var ligatureReference = {
13806         "\u0626\u0627": {
13807           "isolated": "\uFBEA",
13808           "final": "\uFBEB"
13809         },
13810         "\u0626\u06D5": {
13811           "isolated": "\uFBEC",
13812           "final": "\uFBED"
13813         },
13814         "\u0626\u0648": {
13815           "isolated": "\uFBEE",
13816           "final": "\uFBEF"
13817         },
13818         "\u0626\u06C7": {
13819           "isolated": "\uFBF0",
13820           "final": "\uFBF1"
13821         },
13822         "\u0626\u06C6": {
13823           "isolated": "\uFBF2",
13824           "final": "\uFBF3"
13825         },
13826         "\u0626\u06C8": {
13827           "isolated": "\uFBF4",
13828           "final": "\uFBF5"
13829         },
13830         "\u0626\u06D0": {
13831           "isolated": "\uFBF6",
13832           "final": "\uFBF7",
13833           "initial": "\uFBF8"
13834         },
13835         "\u0626\u0649": {
13836           "uighur_kirghiz": {
13837             "isolated": "\uFBF9",
13838             "final": "\uFBFA",
13839             "initial": "\uFBFB"
13840           },
13841           "isolated": "\uFC03",
13842           "final": "\uFC68"
13843         },
13844         "\u0626\u062C": {
13845           "isolated": "\uFC00",
13846           "initial": "\uFC97"
13847         },
13848         "\u0626\u062D": {
13849           "isolated": "\uFC01",
13850           "initial": "\uFC98"
13851         },
13852         "\u0626\u0645": {
13853           "isolated": "\uFC02",
13854           "final": "\uFC66",
13855           "initial": "\uFC9A",
13856           "medial": "\uFCDF"
13857         },
13858         "\u0626\u064A": {
13859           "isolated": "\uFC04",
13860           "final": "\uFC69"
13861         },
13862         "\u0628\u062C": {
13863           "isolated": "\uFC05",
13864           "initial": "\uFC9C"
13865         },
13866         "\u0628\u062D": {
13867           "isolated": "\uFC06",
13868           "initial": "\uFC9D"
13869         },
13870         "\u0628\u062E": {
13871           "isolated": "\uFC07",
13872           "initial": "\uFC9E"
13873         },
13874         "\u0628\u0645": {
13875           "isolated": "\uFC08",
13876           "final": "\uFC6C",
13877           "initial": "\uFC9F",
13878           "medial": "\uFCE1"
13879         },
13880         "\u0628\u0649": {
13881           "isolated": "\uFC09",
13882           "final": "\uFC6E"
13883         },
13884         "\u0628\u064A": {
13885           "isolated": "\uFC0A",
13886           "final": "\uFC6F"
13887         },
13888         "\u062A\u062C": {
13889           "isolated": "\uFC0B",
13890           "initial": "\uFCA1"
13891         },
13892         "\u062A\u062D": {
13893           "isolated": "\uFC0C",
13894           "initial": "\uFCA2"
13895         },
13896         "\u062A\u062E": {
13897           "isolated": "\uFC0D",
13898           "initial": "\uFCA3"
13899         },
13900         "\u062A\u0645": {
13901           "isolated": "\uFC0E",
13902           "final": "\uFC72",
13903           "initial": "\uFCA4",
13904           "medial": "\uFCE3"
13905         },
13906         "\u062A\u0649": {
13907           "isolated": "\uFC0F",
13908           "final": "\uFC74"
13909         },
13910         "\u062A\u064A": {
13911           "isolated": "\uFC10",
13912           "final": "\uFC75"
13913         },
13914         "\u062B\u062C": {
13915           "isolated": "\uFC11"
13916         },
13917         "\u062B\u0645": {
13918           "isolated": "\uFC12",
13919           "final": "\uFC78",
13920           "initial": "\uFCA6",
13921           "medial": "\uFCE5"
13922         },
13923         "\u062B\u0649": {
13924           "isolated": "\uFC13",
13925           "final": "\uFC7A"
13926         },
13927         "\u062B\u0648": {
13928           "isolated": "\uFC14"
13929         },
13930         "\u062C\u062D": {
13931           "isolated": "\uFC15",
13932           "initial": "\uFCA7"
13933         },
13934         "\u062C\u0645": {
13935           "isolated": "\uFC16",
13936           "initial": "\uFCA8"
13937         },
13938         "\u062D\u062C": {
13939           "isolated": "\uFC17",
13940           "initial": "\uFCA9"
13941         },
13942         "\u062D\u0645": {
13943           "isolated": "\uFC18",
13944           "initial": "\uFCAA"
13945         },
13946         "\u062E\u062C": {
13947           "isolated": "\uFC19",
13948           "initial": "\uFCAB"
13949         },
13950         "\u062E\u062D": {
13951           "isolated": "\uFC1A"
13952         },
13953         "\u062E\u0645": {
13954           "isolated": "\uFC1B",
13955           "initial": "\uFCAC"
13956         },
13957         "\u0633\u062C": {
13958           "isolated": "\uFC1C",
13959           "initial": "\uFCAD",
13960           "medial": "\uFD34"
13961         },
13962         "\u0633\u062D": {
13963           "isolated": "\uFC1D",
13964           "initial": "\uFCAE",
13965           "medial": "\uFD35"
13966         },
13967         "\u0633\u062E": {
13968           "isolated": "\uFC1E",
13969           "initial": "\uFCAF",
13970           "medial": "\uFD36"
13971         },
13972         "\u0633\u0645": {
13973           "isolated": "\uFC1F",
13974           "initial": "\uFCB0",
13975           "medial": "\uFCE7"
13976         },
13977         "\u0635\u062D": {
13978           "isolated": "\uFC20",
13979           "initial": "\uFCB1"
13980         },
13981         "\u0635\u0645": {
13982           "isolated": "\uFC21",
13983           "initial": "\uFCB3"
13984         },
13985         "\u0636\u062C": {
13986           "isolated": "\uFC22",
13987           "initial": "\uFCB4"
13988         },
13989         "\u0636\u062D": {
13990           "isolated": "\uFC23",
13991           "initial": "\uFCB5"
13992         },
13993         "\u0636\u062E": {
13994           "isolated": "\uFC24",
13995           "initial": "\uFCB6"
13996         },
13997         "\u0636\u0645": {
13998           "isolated": "\uFC25",
13999           "initial": "\uFCB7"
14000         },
14001         "\u0637\u062D": {
14002           "isolated": "\uFC26",
14003           "initial": "\uFCB8"
14004         },
14005         "\u0637\u0645": {
14006           "isolated": "\uFC27",
14007           "initial": "\uFD33",
14008           "medial": "\uFD3A"
14009         },
14010         "\u0638\u0645": {
14011           "isolated": "\uFC28",
14012           "initial": "\uFCB9",
14013           "medial": "\uFD3B"
14014         },
14015         "\u0639\u062C": {
14016           "isolated": "\uFC29",
14017           "initial": "\uFCBA"
14018         },
14019         "\u0639\u0645": {
14020           "isolated": "\uFC2A",
14021           "initial": "\uFCBB"
14022         },
14023         "\u063A\u062C": {
14024           "isolated": "\uFC2B",
14025           "initial": "\uFCBC"
14026         },
14027         "\u063A\u0645": {
14028           "isolated": "\uFC2C",
14029           "initial": "\uFCBD"
14030         },
14031         "\u0641\u062C": {
14032           "isolated": "\uFC2D",
14033           "initial": "\uFCBE"
14034         },
14035         "\u0641\u062D": {
14036           "isolated": "\uFC2E",
14037           "initial": "\uFCBF"
14038         },
14039         "\u0641\u062E": {
14040           "isolated": "\uFC2F",
14041           "initial": "\uFCC0"
14042         },
14043         "\u0641\u0645": {
14044           "isolated": "\uFC30",
14045           "initial": "\uFCC1"
14046         },
14047         "\u0641\u0649": {
14048           "isolated": "\uFC31",
14049           "final": "\uFC7C"
14050         },
14051         "\u0641\u064A": {
14052           "isolated": "\uFC32",
14053           "final": "\uFC7D"
14054         },
14055         "\u0642\u062D": {
14056           "isolated": "\uFC33",
14057           "initial": "\uFCC2"
14058         },
14059         "\u0642\u0645": {
14060           "isolated": "\uFC34",
14061           "initial": "\uFCC3"
14062         },
14063         "\u0642\u0649": {
14064           "isolated": "\uFC35",
14065           "final": "\uFC7E"
14066         },
14067         "\u0642\u064A": {
14068           "isolated": "\uFC36",
14069           "final": "\uFC7F"
14070         },
14071         "\u0643\u0627": {
14072           "isolated": "\uFC37",
14073           "final": "\uFC80"
14074         },
14075         "\u0643\u062C": {
14076           "isolated": "\uFC38",
14077           "initial": "\uFCC4"
14078         },
14079         "\u0643\u062D": {
14080           "isolated": "\uFC39",
14081           "initial": "\uFCC5"
14082         },
14083         "\u0643\u062E": {
14084           "isolated": "\uFC3A",
14085           "initial": "\uFCC6"
14086         },
14087         "\u0643\u0644": {
14088           "isolated": "\uFC3B",
14089           "final": "\uFC81",
14090           "initial": "\uFCC7",
14091           "medial": "\uFCEB"
14092         },
14093         "\u0643\u0645": {
14094           "isolated": "\uFC3C",
14095           "final": "\uFC82",
14096           "initial": "\uFCC8",
14097           "medial": "\uFCEC"
14098         },
14099         "\u0643\u0649": {
14100           "isolated": "\uFC3D",
14101           "final": "\uFC83"
14102         },
14103         "\u0643\u064A": {
14104           "isolated": "\uFC3E",
14105           "final": "\uFC84"
14106         },
14107         "\u0644\u062C": {
14108           "isolated": "\uFC3F",
14109           "initial": "\uFCC9"
14110         },
14111         "\u0644\u062D": {
14112           "isolated": "\uFC40",
14113           "initial": "\uFCCA"
14114         },
14115         "\u0644\u062E": {
14116           "isolated": "\uFC41",
14117           "initial": "\uFCCB"
14118         },
14119         "\u0644\u0645": {
14120           "isolated": "\uFC42",
14121           "final": "\uFC85",
14122           "initial": "\uFCCC",
14123           "medial": "\uFCED"
14124         },
14125         "\u0644\u0649": {
14126           "isolated": "\uFC43",
14127           "final": "\uFC86"
14128         },
14129         "\u0644\u064A": {
14130           "isolated": "\uFC44",
14131           "final": "\uFC87"
14132         },
14133         "\u0645\u062C": {
14134           "isolated": "\uFC45",
14135           "initial": "\uFCCE"
14136         },
14137         "\u0645\u062D": {
14138           "isolated": "\uFC46",
14139           "initial": "\uFCCF"
14140         },
14141         "\u0645\u062E": {
14142           "isolated": "\uFC47",
14143           "initial": "\uFCD0"
14144         },
14145         "\u0645\u0645": {
14146           "isolated": "\uFC48",
14147           "final": "\uFC89",
14148           "initial": "\uFCD1"
14149         },
14150         "\u0645\u0649": {
14151           "isolated": "\uFC49"
14152         },
14153         "\u0645\u064A": {
14154           "isolated": "\uFC4A"
14155         },
14156         "\u0646\u062C": {
14157           "isolated": "\uFC4B",
14158           "initial": "\uFCD2"
14159         },
14160         "\u0646\u062D": {
14161           "isolated": "\uFC4C",
14162           "initial": "\uFCD3"
14163         },
14164         "\u0646\u062E": {
14165           "isolated": "\uFC4D",
14166           "initial": "\uFCD4"
14167         },
14168         "\u0646\u0645": {
14169           "isolated": "\uFC4E",
14170           "final": "\uFC8C",
14171           "initial": "\uFCD5",
14172           "medial": "\uFCEE"
14173         },
14174         "\u0646\u0649": {
14175           "isolated": "\uFC4F",
14176           "final": "\uFC8E"
14177         },
14178         "\u0646\u064A": {
14179           "isolated": "\uFC50",
14180           "final": "\uFC8F"
14181         },
14182         "\u0647\u062C": {
14183           "isolated": "\uFC51",
14184           "initial": "\uFCD7"
14185         },
14186         "\u0647\u0645": {
14187           "isolated": "\uFC52",
14188           "initial": "\uFCD8"
14189         },
14190         "\u0647\u0649": {
14191           "isolated": "\uFC53"
14192         },
14193         "\u0647\u064A": {
14194           "isolated": "\uFC54"
14195         },
14196         "\u064A\u062C": {
14197           "isolated": "\uFC55",
14198           "initial": "\uFCDA"
14199         },
14200         "\u064A\u062D": {
14201           "isolated": "\uFC56",
14202           "initial": "\uFCDB"
14203         },
14204         "\u064A\u062E": {
14205           "isolated": "\uFC57",
14206           "initial": "\uFCDC"
14207         },
14208         "\u064A\u0645": {
14209           "isolated": "\uFC58",
14210           "final": "\uFC93",
14211           "initial": "\uFCDD",
14212           "medial": "\uFCF0"
14213         },
14214         "\u064A\u0649": {
14215           "isolated": "\uFC59",
14216           "final": "\uFC95"
14217         },
14218         "\u064A\u064A": {
14219           "isolated": "\uFC5A",
14220           "final": "\uFC96"
14221         },
14222         "\u0630\u0670": {
14223           "isolated": "\uFC5B"
14224         },
14225         "\u0631\u0670": {
14226           "isolated": "\uFC5C"
14227         },
14228         "\u0649\u0670": {
14229           "isolated": "\uFC5D",
14230           "final": "\uFC90"
14231         },
14232         "\u064C\u0651": {
14233           "isolated": "\uFC5E"
14234         },
14235         "\u064D\u0651": {
14236           "isolated": "\uFC5F"
14237         },
14238         "\u064E\u0651": {
14239           "isolated": "\uFC60"
14240         },
14241         "\u064F\u0651": {
14242           "isolated": "\uFC61"
14243         },
14244         "\u0650\u0651": {
14245           "isolated": "\uFC62"
14246         },
14247         "\u0651\u0670": {
14248           "isolated": "\uFC63"
14249         },
14250         "\u0626\u0631": {
14251           "final": "\uFC64"
14252         },
14253         "\u0626\u0632": {
14254           "final": "\uFC65"
14255         },
14256         "\u0626\u0646": {
14257           "final": "\uFC67"
14258         },
14259         "\u0628\u0631": {
14260           "final": "\uFC6A"
14261         },
14262         "\u0628\u0632": {
14263           "final": "\uFC6B"
14264         },
14265         "\u0628\u0646": {
14266           "final": "\uFC6D"
14267         },
14268         "\u062A\u0631": {
14269           "final": "\uFC70"
14270         },
14271         "\u062A\u0632": {
14272           "final": "\uFC71"
14273         },
14274         "\u062A\u0646": {
14275           "final": "\uFC73"
14276         },
14277         "\u062B\u0631": {
14278           "final": "\uFC76"
14279         },
14280         "\u062B\u0632": {
14281           "final": "\uFC77"
14282         },
14283         "\u062B\u0646": {
14284           "final": "\uFC79"
14285         },
14286         "\u062B\u064A": {
14287           "final": "\uFC7B"
14288         },
14289         "\u0645\u0627": {
14290           "final": "\uFC88"
14291         },
14292         "\u0646\u0631": {
14293           "final": "\uFC8A"
14294         },
14295         "\u0646\u0632": {
14296           "final": "\uFC8B"
14297         },
14298         "\u0646\u0646": {
14299           "final": "\uFC8D"
14300         },
14301         "\u064A\u0631": {
14302           "final": "\uFC91"
14303         },
14304         "\u064A\u0632": {
14305           "final": "\uFC92"
14306         },
14307         "\u064A\u0646": {
14308           "final": "\uFC94"
14309         },
14310         "\u0626\u062E": {
14311           "initial": "\uFC99"
14312         },
14313         "\u0626\u0647": {
14314           "initial": "\uFC9B",
14315           "medial": "\uFCE0"
14316         },
14317         "\u0628\u0647": {
14318           "initial": "\uFCA0",
14319           "medial": "\uFCE2"
14320         },
14321         "\u062A\u0647": {
14322           "initial": "\uFCA5",
14323           "medial": "\uFCE4"
14324         },
14325         "\u0635\u062E": {
14326           "initial": "\uFCB2"
14327         },
14328         "\u0644\u0647": {
14329           "initial": "\uFCCD"
14330         },
14331         "\u0646\u0647": {
14332           "initial": "\uFCD6",
14333           "medial": "\uFCEF"
14334         },
14335         "\u0647\u0670": {
14336           "initial": "\uFCD9"
14337         },
14338         "\u064A\u0647": {
14339           "initial": "\uFCDE",
14340           "medial": "\uFCF1"
14341         },
14342         "\u062B\u0647": {
14343           "medial": "\uFCE6"
14344         },
14345         "\u0633\u0647": {
14346           "medial": "\uFCE8",
14347           "initial": "\uFD31"
14348         },
14349         "\u0634\u0645": {
14350           "medial": "\uFCE9",
14351           "isolated": "\uFD0C",
14352           "final": "\uFD28",
14353           "initial": "\uFD30"
14354         },
14355         "\u0634\u0647": {
14356           "medial": "\uFCEA",
14357           "initial": "\uFD32"
14358         },
14359         "\u0640\u064E\u0651": {
14360           "medial": "\uFCF2"
14361         },
14362         "\u0640\u064F\u0651": {
14363           "medial": "\uFCF3"
14364         },
14365         "\u0640\u0650\u0651": {
14366           "medial": "\uFCF4"
14367         },
14368         "\u0637\u0649": {
14369           "isolated": "\uFCF5",
14370           "final": "\uFD11"
14371         },
14372         "\u0637\u064A": {
14373           "isolated": "\uFCF6",
14374           "final": "\uFD12"
14375         },
14376         "\u0639\u0649": {
14377           "isolated": "\uFCF7",
14378           "final": "\uFD13"
14379         },
14380         "\u0639\u064A": {
14381           "isolated": "\uFCF8",
14382           "final": "\uFD14"
14383         },
14384         "\u063A\u0649": {
14385           "isolated": "\uFCF9",
14386           "final": "\uFD15"
14387         },
14388         "\u063A\u064A": {
14389           "isolated": "\uFCFA",
14390           "final": "\uFD16"
14391         },
14392         "\u0633\u0649": {
14393           "isolated": "\uFCFB"
14394         },
14395         "\u0633\u064A": {
14396           "isolated": "\uFCFC",
14397           "final": "\uFD18"
14398         },
14399         "\u0634\u0649": {
14400           "isolated": "\uFCFD",
14401           "final": "\uFD19"
14402         },
14403         "\u0634\u064A": {
14404           "isolated": "\uFCFE",
14405           "final": "\uFD1A"
14406         },
14407         "\u062D\u0649": {
14408           "isolated": "\uFCFF",
14409           "final": "\uFD1B"
14410         },
14411         "\u062D\u064A": {
14412           "isolated": "\uFD00",
14413           "final": "\uFD1C"
14414         },
14415         "\u062C\u0649": {
14416           "isolated": "\uFD01",
14417           "final": "\uFD1D"
14418         },
14419         "\u062C\u064A": {
14420           "isolated": "\uFD02",
14421           "final": "\uFD1E"
14422         },
14423         "\u062E\u0649": {
14424           "isolated": "\uFD03",
14425           "final": "\uFD1F"
14426         },
14427         "\u062E\u064A": {
14428           "isolated": "\uFD04",
14429           "final": "\uFD20"
14430         },
14431         "\u0635\u0649": {
14432           "isolated": "\uFD05",
14433           "final": "\uFD21"
14434         },
14435         "\u0635\u064A": {
14436           "isolated": "\uFD06",
14437           "final": "\uFD22"
14438         },
14439         "\u0636\u0649": {
14440           "isolated": "\uFD07",
14441           "final": "\uFD23"
14442         },
14443         "\u0636\u064A": {
14444           "isolated": "\uFD08",
14445           "final": "\uFD24"
14446         },
14447         "\u0634\u062C": {
14448           "isolated": "\uFD09",
14449           "final": "\uFD25",
14450           "initial": "\uFD2D",
14451           "medial": "\uFD37"
14452         },
14453         "\u0634\u062D": {
14454           "isolated": "\uFD0A",
14455           "final": "\uFD26",
14456           "initial": "\uFD2E",
14457           "medial": "\uFD38"
14458         },
14459         "\u0634\u062E": {
14460           "isolated": "\uFD0B",
14461           "final": "\uFD27",
14462           "initial": "\uFD2F",
14463           "medial": "\uFD39"
14464         },
14465         "\u0634\u0631": {
14466           "isolated": "\uFD0D",
14467           "final": "\uFD29"
14468         },
14469         "\u0633\u0631": {
14470           "isolated": "\uFD0E",
14471           "final": "\uFD2A"
14472         },
14473         "\u0635\u0631": {
14474           "isolated": "\uFD0F",
14475           "final": "\uFD2B"
14476         },
14477         "\u0636\u0631": {
14478           "isolated": "\uFD10",
14479           "final": "\uFD2C"
14480         },
14481         "\u0633\u0639": {
14482           "final": "\uFD17"
14483         },
14484         "\u062A\u062C\u0645": {
14485           "initial": "\uFD50"
14486         },
14487         "\u062A\u062D\u062C": {
14488           "final": "\uFD51",
14489           "initial": "\uFD52"
14490         },
14491         "\u062A\u062D\u0645": {
14492           "initial": "\uFD53"
14493         },
14494         "\u062A\u062E\u0645": {
14495           "initial": "\uFD54"
14496         },
14497         "\u062A\u0645\u062C": {
14498           "initial": "\uFD55"
14499         },
14500         "\u062A\u0645\u062D": {
14501           "initial": "\uFD56"
14502         },
14503         "\u062A\u0645\u062E": {
14504           "initial": "\uFD57"
14505         },
14506         "\u062C\u0645\u062D": {
14507           "final": "\uFD58",
14508           "initial": "\uFD59"
14509         },
14510         "\u062D\u0645\u064A": {
14511           "final": "\uFD5A"
14512         },
14513         "\u062D\u0645\u0649": {
14514           "final": "\uFD5B"
14515         },
14516         "\u0633\u062D\u062C": {
14517           "initial": "\uFD5C"
14518         },
14519         "\u0633\u062C\u062D": {
14520           "initial": "\uFD5D"
14521         },
14522         "\u0633\u062C\u0649": {
14523           "final": "\uFD5E"
14524         },
14525         "\u0633\u0645\u062D": {
14526           "final": "\uFD5F",
14527           "initial": "\uFD60"
14528         },
14529         "\u0633\u0645\u062C": {
14530           "initial": "\uFD61"
14531         },
14532         "\u0633\u0645\u0645": {
14533           "final": "\uFD62",
14534           "initial": "\uFD63"
14535         },
14536         "\u0635\u062D\u062D": {
14537           "final": "\uFD64",
14538           "initial": "\uFD65"
14539         },
14540         "\u0635\u0645\u0645": {
14541           "final": "\uFD66",
14542           "initial": "\uFDC5"
14543         },
14544         "\u0634\u062D\u0645": {
14545           "final": "\uFD67",
14546           "initial": "\uFD68"
14547         },
14548         "\u0634\u062C\u064A": {
14549           "final": "\uFD69"
14550         },
14551         "\u0634\u0645\u062E": {
14552           "final": "\uFD6A",
14553           "initial": "\uFD6B"
14554         },
14555         "\u0634\u0645\u0645": {
14556           "final": "\uFD6C",
14557           "initial": "\uFD6D"
14558         },
14559         "\u0636\u062D\u0649": {
14560           "final": "\uFD6E"
14561         },
14562         "\u0636\u062E\u0645": {
14563           "final": "\uFD6F",
14564           "initial": "\uFD70"
14565         },
14566         "\u0636\u0645\u062D": {
14567           "final": "\uFD71"
14568         },
14569         "\u0637\u0645\u062D": {
14570           "initial": "\uFD72"
14571         },
14572         "\u0637\u0645\u0645": {
14573           "initial": "\uFD73"
14574         },
14575         "\u0637\u0645\u064A": {
14576           "final": "\uFD74"
14577         },
14578         "\u0639\u062C\u0645": {
14579           "final": "\uFD75",
14580           "initial": "\uFDC4"
14581         },
14582         "\u0639\u0645\u0645": {
14583           "final": "\uFD76",
14584           "initial": "\uFD77"
14585         },
14586         "\u0639\u0645\u0649": {
14587           "final": "\uFD78"
14588         },
14589         "\u063A\u0645\u0645": {
14590           "final": "\uFD79"
14591         },
14592         "\u063A\u0645\u064A": {
14593           "final": "\uFD7A"
14594         },
14595         "\u063A\u0645\u0649": {
14596           "final": "\uFD7B"
14597         },
14598         "\u0641\u062E\u0645": {
14599           "final": "\uFD7C",
14600           "initial": "\uFD7D"
14601         },
14602         "\u0642\u0645\u062D": {
14603           "final": "\uFD7E",
14604           "initial": "\uFDB4"
14605         },
14606         "\u0642\u0645\u0645": {
14607           "final": "\uFD7F"
14608         },
14609         "\u0644\u062D\u0645": {
14610           "final": "\uFD80",
14611           "initial": "\uFDB5"
14612         },
14613         "\u0644\u062D\u064A": {
14614           "final": "\uFD81"
14615         },
14616         "\u0644\u062D\u0649": {
14617           "final": "\uFD82"
14618         },
14619         "\u0644\u062C\u062C": {
14620           "initial": "\uFD83",
14621           "final": "\uFD84"
14622         },
14623         "\u0644\u062E\u0645": {
14624           "final": "\uFD85",
14625           "initial": "\uFD86"
14626         },
14627         "\u0644\u0645\u062D": {
14628           "final": "\uFD87",
14629           "initial": "\uFD88"
14630         },
14631         "\u0645\u062D\u062C": {
14632           "initial": "\uFD89"
14633         },
14634         "\u0645\u062D\u0645": {
14635           "initial": "\uFD8A"
14636         },
14637         "\u0645\u062D\u064A": {
14638           "final": "\uFD8B"
14639         },
14640         "\u0645\u062C\u062D": {
14641           "initial": "\uFD8C"
14642         },
14643         "\u0645\u062C\u0645": {
14644           "initial": "\uFD8D"
14645         },
14646         "\u0645\u062E\u062C": {
14647           "initial": "\uFD8E"
14648         },
14649         "\u0645\u062E\u0645": {
14650           "initial": "\uFD8F"
14651         },
14652         "\u0645\u062C\u062E": {
14653           "initial": "\uFD92"
14654         },
14655         "\u0647\u0645\u062C": {
14656           "initial": "\uFD93"
14657         },
14658         "\u0647\u0645\u0645": {
14659           "initial": "\uFD94"
14660         },
14661         "\u0646\u062D\u0645": {
14662           "initial": "\uFD95"
14663         },
14664         "\u0646\u062D\u0649": {
14665           "final": "\uFD96"
14666         },
14667         "\u0646\u062C\u0645": {
14668           "final": "\uFD97",
14669           "initial": "\uFD98"
14670         },
14671         "\u0646\u062C\u0649": {
14672           "final": "\uFD99"
14673         },
14674         "\u0646\u0645\u064A": {
14675           "final": "\uFD9A"
14676         },
14677         "\u0646\u0645\u0649": {
14678           "final": "\uFD9B"
14679         },
14680         "\u064A\u0645\u0645": {
14681           "final": "\uFD9C",
14682           "initial": "\uFD9D"
14683         },
14684         "\u0628\u062E\u064A": {
14685           "final": "\uFD9E"
14686         },
14687         "\u062A\u062C\u064A": {
14688           "final": "\uFD9F"
14689         },
14690         "\u062A\u062C\u0649": {
14691           "final": "\uFDA0"
14692         },
14693         "\u062A\u062E\u064A": {
14694           "final": "\uFDA1"
14695         },
14696         "\u062A\u062E\u0649": {
14697           "final": "\uFDA2"
14698         },
14699         "\u062A\u0645\u064A": {
14700           "final": "\uFDA3"
14701         },
14702         "\u062A\u0645\u0649": {
14703           "final": "\uFDA4"
14704         },
14705         "\u062C\u0645\u064A": {
14706           "final": "\uFDA5"
14707         },
14708         "\u062C\u062D\u0649": {
14709           "final": "\uFDA6"
14710         },
14711         "\u062C\u0645\u0649": {
14712           "final": "\uFDA7"
14713         },
14714         "\u0633\u062E\u0649": {
14715           "final": "\uFDA8"
14716         },
14717         "\u0635\u062D\u064A": {
14718           "final": "\uFDA9"
14719         },
14720         "\u0634\u062D\u064A": {
14721           "final": "\uFDAA"
14722         },
14723         "\u0636\u062D\u064A": {
14724           "final": "\uFDAB"
14725         },
14726         "\u0644\u062C\u064A": {
14727           "final": "\uFDAC"
14728         },
14729         "\u0644\u0645\u064A": {
14730           "final": "\uFDAD"
14731         },
14732         "\u064A\u062D\u064A": {
14733           "final": "\uFDAE"
14734         },
14735         "\u064A\u062C\u064A": {
14736           "final": "\uFDAF"
14737         },
14738         "\u064A\u0645\u064A": {
14739           "final": "\uFDB0"
14740         },
14741         "\u0645\u0645\u064A": {
14742           "final": "\uFDB1"
14743         },
14744         "\u0642\u0645\u064A": {
14745           "final": "\uFDB2"
14746         },
14747         "\u0646\u062D\u064A": {
14748           "final": "\uFDB3"
14749         },
14750         "\u0639\u0645\u064A": {
14751           "final": "\uFDB6"
14752         },
14753         "\u0643\u0645\u064A": {
14754           "final": "\uFDB7"
14755         },
14756         "\u0646\u062C\u062D": {
14757           "initial": "\uFDB8",
14758           "final": "\uFDBD"
14759         },
14760         "\u0645\u062E\u064A": {
14761           "final": "\uFDB9"
14762         },
14763         "\u0644\u062C\u0645": {
14764           "initial": "\uFDBA",
14765           "final": "\uFDBC"
14766         },
14767         "\u0643\u0645\u0645": {
14768           "final": "\uFDBB",
14769           "initial": "\uFDC3"
14770         },
14771         "\u062C\u062D\u064A": {
14772           "final": "\uFDBE"
14773         },
14774         "\u062D\u062C\u064A": {
14775           "final": "\uFDBF"
14776         },
14777         "\u0645\u062C\u064A": {
14778           "final": "\uFDC0"
14779         },
14780         "\u0641\u0645\u064A": {
14781           "final": "\uFDC1"
14782         },
14783         "\u0628\u062D\u064A": {
14784           "final": "\uFDC2"
14785         },
14786         "\u0633\u062E\u064A": {
14787           "final": "\uFDC6"
14788         },
14789         "\u0646\u062C\u064A": {
14790           "final": "\uFDC7"
14791         },
14792         "\u0644\u0622": {
14793           "isolated": "\uFEF5",
14794           "final": "\uFEF6"
14795         },
14796         "\u0644\u0623": {
14797           "isolated": "\uFEF7",
14798           "final": "\uFEF8"
14799         },
14800         "\u0644\u0625": {
14801           "isolated": "\uFEF9",
14802           "final": "\uFEFA"
14803         },
14804         "\u0644\u0627": {
14805           "isolated": "\uFEFB",
14806           "final": "\uFEFC"
14807         },
14808         "words": {
14809           "\u0635\u0644\u06D2": "\uFDF0",
14810           "\u0642\u0644\u06D2": "\uFDF1",
14811           "\u0627\u0644\u0644\u0647": "\uFDF2",
14812           "\u0627\u0643\u0628\u0631": "\uFDF3",
14813           "\u0645\u062D\u0645\u062F": "\uFDF4",
14814           "\u0635\u0644\u0639\u0645": "\uFDF5",
14815           "\u0631\u0633\u0648\u0644": "\uFDF6",
14816           "\u0639\u0644\u064A\u0647": "\uFDF7",
14817           "\u0648\u0633\u0644\u0645": "\uFDF8",
14818           "\u0635\u0644\u0649": "\uFDF9",
14819           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
14820           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
14821           "\u0631\u06CC\u0627\u0644": "\uFDFC"
14822         }
14823       };
14824       exports2.default = ligatureReference;
14825     }
14826   });
14827
14828   // node_modules/alif-toolkit/lib/reference.js
14829   var require_reference = __commonJS({
14830     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
14831       "use strict";
14832       Object.defineProperty(exports2, "__esModule", { value: true });
14833       exports2.ligatureWordList = exports2.ligatureList = exports2.letterList = exports2.alefs = exports2.lams = exports2.lineBreakers = exports2.tashkeel = void 0;
14834       var unicode_arabic_1 = require_unicode_arabic();
14835       var unicode_ligatures_1 = require_unicode_ligatures();
14836       var letterList = Object.keys(unicode_arabic_1.default);
14837       exports2.letterList = letterList;
14838       var ligatureList = Object.keys(unicode_ligatures_1.default);
14839       exports2.ligatureList = ligatureList;
14840       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
14841       exports2.ligatureWordList = ligatureWordList;
14842       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
14843       exports2.lams = lams;
14844       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
14845       exports2.alefs = alefs;
14846       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
14847       exports2.tashkeel = tashkeel;
14848       function addToTashkeel(start2, finish) {
14849         for (var i3 = start2; i3 <= finish; i3++) {
14850           exports2.tashkeel = tashkeel += String.fromCharCode(i3);
14851         }
14852       }
14853       addToTashkeel(1552, 1562);
14854       addToTashkeel(1611, 1631);
14855       addToTashkeel(1750, 1756);
14856       addToTashkeel(1760, 1764);
14857       addToTashkeel(1770, 1773);
14858       addToTashkeel(2259, 2273);
14859       addToTashkeel(2275, 2303);
14860       addToTashkeel(65136, 65151);
14861       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
14862       exports2.lineBreakers = lineBreakers;
14863       function addToLineBreakers(start2, finish) {
14864         for (var i3 = start2; i3 <= finish; i3++) {
14865           exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
14866         }
14867       }
14868       addToLineBreakers(1536, 1567);
14869       addToLineBreakers(1569, 1573);
14870       addToLineBreakers(1583, 1586);
14871       addToLineBreakers(1632, 1645);
14872       addToLineBreakers(1649, 1655);
14873       addToLineBreakers(1672, 1689);
14874       addToLineBreakers(1731, 1739);
14875       addToLineBreakers(1746, 1785);
14876       addToLineBreakers(1881, 1883);
14877       addToLineBreakers(2218, 2222);
14878       addToLineBreakers(64336, 65021);
14879       addToLineBreakers(65152, 65276);
14880       addToLineBreakers(69216, 69247);
14881       addToLineBreakers(126064, 126143);
14882       addToLineBreakers(126464, 126719);
14883     }
14884   });
14885
14886   // node_modules/alif-toolkit/lib/GlyphSplitter.js
14887   var require_GlyphSplitter = __commonJS({
14888     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
14889       "use strict";
14890       Object.defineProperty(exports2, "__esModule", { value: true });
14891       exports2.GlyphSplitter = GlyphSplitter;
14892       var isArabic_1 = require_isArabic();
14893       var reference_1 = require_reference();
14894       function GlyphSplitter(word) {
14895         let letters = [];
14896         let lastLetter = "";
14897         word.split("").forEach((letter) => {
14898           if ((0, isArabic_1.isArabic)(letter)) {
14899             if (reference_1.tashkeel.indexOf(letter) > -1) {
14900               letters[letters.length - 1] += letter;
14901             } 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)) {
14902               letters[letters.length - 1] += letter;
14903             } else {
14904               letters.push(letter);
14905             }
14906           } else {
14907             letters.push(letter);
14908           }
14909           if (reference_1.tashkeel.indexOf(letter) === -1) {
14910             lastLetter = letter;
14911           }
14912         });
14913         return letters;
14914       }
14915     }
14916   });
14917
14918   // node_modules/alif-toolkit/lib/BaselineSplitter.js
14919   var require_BaselineSplitter = __commonJS({
14920     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
14921       "use strict";
14922       Object.defineProperty(exports2, "__esModule", { value: true });
14923       exports2.BaselineSplitter = BaselineSplitter;
14924       var isArabic_1 = require_isArabic();
14925       var reference_1 = require_reference();
14926       function BaselineSplitter(word) {
14927         let letters = [];
14928         let lastLetter = "";
14929         word.split("").forEach((letter) => {
14930           if ((0, isArabic_1.isArabic)(letter) && (0, isArabic_1.isArabic)(lastLetter)) {
14931             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
14932               letters[letters.length - 1] += letter;
14933             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
14934               letters.push(letter);
14935             } else {
14936               letters[letters.length - 1] += letter;
14937             }
14938           } else {
14939             letters.push(letter);
14940           }
14941           if (reference_1.tashkeel.indexOf(letter) === -1) {
14942             lastLetter = letter;
14943           }
14944         });
14945         return letters;
14946       }
14947     }
14948   });
14949
14950   // node_modules/alif-toolkit/lib/Normalization.js
14951   var require_Normalization = __commonJS({
14952     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
14953       "use strict";
14954       Object.defineProperty(exports2, "__esModule", { value: true });
14955       exports2.Normal = Normal;
14956       var unicode_arabic_1 = require_unicode_arabic();
14957       var unicode_ligatures_1 = require_unicode_ligatures();
14958       var isArabic_1 = require_isArabic();
14959       var reference_1 = require_reference();
14960       function Normal(word, breakPresentationForm) {
14961         if (typeof breakPresentationForm === "undefined") {
14962           breakPresentationForm = true;
14963         }
14964         let returnable = "";
14965         word.split("").forEach((letter) => {
14966           if (!(0, isArabic_1.isArabic)(letter)) {
14967             returnable += letter;
14968             return;
14969           }
14970           for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
14971             let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
14972             let versions = Object.keys(letterForms);
14973             for (let v3 = 0; v3 < versions.length; v3++) {
14974               let localVersion = letterForms[versions[v3]];
14975               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14976                 let embeddedForms = Object.keys(localVersion);
14977                 for (let ef = 0; ef < embeddedForms.length; ef++) {
14978                   let form = localVersion[embeddedForms[ef]];
14979                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14980                     if (form === letter) {
14981                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
14982                         if (typeof localVersion["normal"] === "object") {
14983                           returnable += localVersion["normal"][0];
14984                         } else {
14985                           returnable += localVersion["normal"];
14986                         }
14987                         return;
14988                       }
14989                       returnable += letter;
14990                       return;
14991                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14992                       returnable += form[0];
14993                       return;
14994                     }
14995                   }
14996                 }
14997               } else if (localVersion === letter) {
14998                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v3]) > -1) {
14999                   if (typeof letterForms["normal"] === "object") {
15000                     returnable += letterForms["normal"][0];
15001                   } else {
15002                     returnable += letterForms["normal"];
15003                   }
15004                   return;
15005                 }
15006                 returnable += letter;
15007                 return;
15008               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15009                 returnable += localVersion[0];
15010                 return;
15011               }
15012             }
15013           }
15014           for (let v22 = 0; v22 < reference_1.ligatureList.length; v22++) {
15015             let normalForm = reference_1.ligatureList[v22];
15016             if (normalForm !== "words") {
15017               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
15018               for (let f2 = 0; f2 < ligForms.length; f2++) {
15019                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
15020                   returnable += normalForm;
15021                   return;
15022                 }
15023               }
15024             }
15025           }
15026           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
15027             let normalForm = reference_1.ligatureWordList[v3];
15028             if (unicode_ligatures_1.default.words[normalForm] === letter) {
15029               returnable += normalForm;
15030               return;
15031             }
15032           }
15033           returnable += letter;
15034         });
15035         return returnable;
15036       }
15037     }
15038   });
15039
15040   // node_modules/alif-toolkit/lib/CharShaper.js
15041   var require_CharShaper = __commonJS({
15042     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
15043       "use strict";
15044       Object.defineProperty(exports2, "__esModule", { value: true });
15045       exports2.CharShaper = CharShaper;
15046       var unicode_arabic_1 = require_unicode_arabic();
15047       var isArabic_1 = require_isArabic();
15048       var reference_1 = require_reference();
15049       function CharShaper(letter, form) {
15050         if (!(0, isArabic_1.isArabic)(letter)) {
15051           throw new Error("Not Arabic");
15052         }
15053         if (letter === "\u0621") {
15054           return "\u0621";
15055         }
15056         for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
15057           let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
15058           let versions = Object.keys(letterForms);
15059           for (let v3 = 0; v3 < versions.length; v3++) {
15060             let localVersion = letterForms[versions[v3]];
15061             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15062               if (versions.indexOf(form) > -1) {
15063                 return letterForms[form];
15064               }
15065             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
15066               let embeddedVersions = Object.keys(localVersion);
15067               for (let ev = 0; ev < embeddedVersions.length; ev++) {
15068                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
15069                   if (embeddedVersions.indexOf(form) > -1) {
15070                     return localVersion[form];
15071                   }
15072                 }
15073               }
15074             }
15075           }
15076         }
15077       }
15078     }
15079   });
15080
15081   // node_modules/alif-toolkit/lib/WordShaper.js
15082   var require_WordShaper = __commonJS({
15083     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
15084       "use strict";
15085       Object.defineProperty(exports2, "__esModule", { value: true });
15086       exports2.WordShaper = WordShaper2;
15087       var isArabic_1 = require_isArabic();
15088       var reference_1 = require_reference();
15089       var CharShaper_1 = require_CharShaper();
15090       var unicode_ligatures_1 = require_unicode_ligatures();
15091       function WordShaper2(word) {
15092         let state = "initial";
15093         let output = "";
15094         for (let w3 = 0; w3 < word.length; w3++) {
15095           let nextLetter = " ";
15096           for (let nxw = w3 + 1; nxw < word.length; nxw++) {
15097             if (!(0, isArabic_1.isArabic)(word[nxw])) {
15098               break;
15099             }
15100             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
15101               nextLetter = word[nxw];
15102               break;
15103             }
15104           }
15105           if (!(0, isArabic_1.isArabic)(word[w3]) || (0, isArabic_1.isMath)(word[w3])) {
15106             output += word[w3];
15107             state = "initial";
15108           } else if (reference_1.tashkeel.indexOf(word[w3]) > -1) {
15109             output += word[w3];
15110           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w3]) > -1) {
15111             output += (0, CharShaper_1.CharShaper)(word[w3], state === "initial" ? "isolated" : "final");
15112             state = "initial";
15113           } else if (reference_1.lams.indexOf(word[w3]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
15114             output += unicode_ligatures_1.default[word[w3] + nextLetter][state === "initial" ? "isolated" : "final"];
15115             while (word[w3] !== nextLetter) {
15116               w3++;
15117             }
15118             state = "initial";
15119           } else {
15120             output += (0, CharShaper_1.CharShaper)(word[w3], state);
15121             state = "medial";
15122           }
15123         }
15124         return output;
15125       }
15126     }
15127   });
15128
15129   // node_modules/alif-toolkit/lib/ParentLetter.js
15130   var require_ParentLetter = __commonJS({
15131     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
15132       "use strict";
15133       Object.defineProperty(exports2, "__esModule", { value: true });
15134       exports2.ParentLetter = ParentLetter;
15135       exports2.GrandparentLetter = GrandparentLetter;
15136       var unicode_arabic_1 = require_unicode_arabic();
15137       var isArabic_1 = require_isArabic();
15138       var reference_1 = require_reference();
15139       function ParentLetter(letter) {
15140         if (!(0, isArabic_1.isArabic)(letter)) {
15141           throw new Error("Not an Arabic letter");
15142         }
15143         for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
15144           let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
15145           let versions = Object.keys(letterForms);
15146           for (let v3 = 0; v3 < versions.length; v3++) {
15147             let localVersion = letterForms[versions[v3]];
15148             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
15149               let embeddedForms = Object.keys(localVersion);
15150               for (let ef = 0; ef < embeddedForms.length; ef++) {
15151                 let form = localVersion[embeddedForms[ef]];
15152                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
15153                   return localVersion;
15154                 }
15155               }
15156             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15157               return letterForms;
15158             }
15159           }
15160           return null;
15161         }
15162       }
15163       function GrandparentLetter(letter) {
15164         if (!(0, isArabic_1.isArabic)(letter)) {
15165           throw new Error("Not an Arabic letter");
15166         }
15167         for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
15168           let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
15169           let versions = Object.keys(letterForms);
15170           for (let v3 = 0; v3 < versions.length; v3++) {
15171             let localVersion = letterForms[versions[v3]];
15172             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
15173               let embeddedForms = Object.keys(localVersion);
15174               for (let ef = 0; ef < embeddedForms.length; ef++) {
15175                 let form = localVersion[embeddedForms[ef]];
15176                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
15177                   return letterForms;
15178                 }
15179               }
15180             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15181               return letterForms;
15182             }
15183           }
15184           return null;
15185         }
15186       }
15187     }
15188   });
15189
15190   // node_modules/alif-toolkit/lib/index.js
15191   var require_lib = __commonJS({
15192     "node_modules/alif-toolkit/lib/index.js"(exports2) {
15193       "use strict";
15194       Object.defineProperty(exports2, "__esModule", { value: true });
15195       exports2.GrandparentLetter = exports2.ParentLetter = exports2.WordShaper = exports2.CharShaper = exports2.Normal = exports2.BaselineSplitter = exports2.GlyphSplitter = exports2.isArabic = void 0;
15196       var isArabic_1 = require_isArabic();
15197       Object.defineProperty(exports2, "isArabic", { enumerable: true, get: function() {
15198         return isArabic_1.isArabic;
15199       } });
15200       var GlyphSplitter_1 = require_GlyphSplitter();
15201       Object.defineProperty(exports2, "GlyphSplitter", { enumerable: true, get: function() {
15202         return GlyphSplitter_1.GlyphSplitter;
15203       } });
15204       var BaselineSplitter_1 = require_BaselineSplitter();
15205       Object.defineProperty(exports2, "BaselineSplitter", { enumerable: true, get: function() {
15206         return BaselineSplitter_1.BaselineSplitter;
15207       } });
15208       var Normalization_1 = require_Normalization();
15209       Object.defineProperty(exports2, "Normal", { enumerable: true, get: function() {
15210         return Normalization_1.Normal;
15211       } });
15212       var CharShaper_1 = require_CharShaper();
15213       Object.defineProperty(exports2, "CharShaper", { enumerable: true, get: function() {
15214         return CharShaper_1.CharShaper;
15215       } });
15216       var WordShaper_1 = require_WordShaper();
15217       Object.defineProperty(exports2, "WordShaper", { enumerable: true, get: function() {
15218         return WordShaper_1.WordShaper;
15219       } });
15220       var ParentLetter_1 = require_ParentLetter();
15221       Object.defineProperty(exports2, "ParentLetter", { enumerable: true, get: function() {
15222         return ParentLetter_1.ParentLetter;
15223       } });
15224       Object.defineProperty(exports2, "GrandparentLetter", { enumerable: true, get: function() {
15225         return ParentLetter_1.GrandparentLetter;
15226       } });
15227     }
15228   });
15229
15230   // modules/util/svg_paths_rtl_fix.js
15231   var svg_paths_rtl_fix_exports = {};
15232   __export(svg_paths_rtl_fix_exports, {
15233     fixRTLTextForSvg: () => fixRTLTextForSvg,
15234     rtlRegex: () => rtlRegex
15235   });
15236   function fixRTLTextForSvg(inputText) {
15237     var ret = "", rtlBuffer = [];
15238     var arabicRegex = /[\u0600-\u06FF]/g;
15239     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
15240     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
15241     var thaanaVowel = /[\u07A6-\u07B0]/;
15242     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
15243     if (arabicRegex.test(inputText)) {
15244       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
15245     }
15246     for (var n3 = 0; n3 < inputText.length; n3++) {
15247       var c2 = inputText[n3];
15248       if (arabicMath.test(c2)) {
15249         ret += rtlBuffer.reverse().join("");
15250         rtlBuffer = [c2];
15251       } else {
15252         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
15253           ret += rtlBuffer.reverse().join("");
15254           rtlBuffer = [];
15255         }
15256         if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
15257           rtlBuffer[rtlBuffer.length - 1] += c2;
15258         } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
15259           rtlBuffer.push(c2);
15260         } else if (c2 === " " && rtlBuffer.length) {
15261           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
15262         } else {
15263           ret += rtlBuffer.reverse().join("") + c2;
15264           rtlBuffer = [];
15265         }
15266       }
15267     }
15268     ret += rtlBuffer.reverse().join("");
15269     return ret;
15270   }
15271   var import_alif_toolkit, rtlRegex;
15272   var init_svg_paths_rtl_fix = __esm({
15273     "modules/util/svg_paths_rtl_fix.js"() {
15274       "use strict";
15275       import_alif_toolkit = __toESM(require_lib());
15276       rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
15277     }
15278   });
15279
15280   // node_modules/vparse/index.js
15281   var require_vparse = __commonJS({
15282     "node_modules/vparse/index.js"(exports2, module2) {
15283       (function(window2) {
15284         "use strict";
15285         function parseVersion3(v3) {
15286           var m3 = v3.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
15287           v3 = {
15288             major: +m3[0] || 0,
15289             minor: +m3[1] || 0,
15290             patch: +m3[2] || 0,
15291             build: +m3[3] || 0
15292           };
15293           v3.isEmpty = !v3.major && !v3.minor && !v3.patch && !v3.build;
15294           v3.parsed = [v3.major, v3.minor, v3.patch, v3.build];
15295           v3.text = v3.parsed.join(".");
15296           v3.compare = compare2;
15297           return v3;
15298         }
15299         function compare2(v3) {
15300           if (typeof v3 === "string") {
15301             v3 = parseVersion3(v3);
15302           }
15303           for (var i3 = 0; i3 < 4; i3++) {
15304             if (this.parsed[i3] !== v3.parsed[i3]) {
15305               return this.parsed[i3] > v3.parsed[i3] ? 1 : -1;
15306             }
15307           }
15308           return 0;
15309         }
15310         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
15311           module2.exports = parseVersion3;
15312         } else {
15313           window2.parseVersion = parseVersion3;
15314         }
15315       })(exports2);
15316     }
15317   });
15318
15319   // config/id.js
15320   var presetsCdnUrl, ociCdnUrl, wmfSitematrixCdnUrl, nsiCdnUrl, defaultOsmApiConnections, osmApiConnections, taginfoApiUrl, nominatimApiUrl, showDonationMessage;
15321   var init_id = __esm({
15322     "config/id.js"() {
15323       "use strict";
15324       presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
15325       ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
15326       wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
15327       nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
15328       defaultOsmApiConnections = {
15329         live: {
15330           url: "https://www.openstreetmap.org",
15331           apiUrl: "https://api.openstreetmap.org",
15332           client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc"
15333         },
15334         dev: {
15335           url: "https://api06.dev.openstreetmap.org",
15336           client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw"
15337         }
15338       };
15339       osmApiConnections = [];
15340       if (false) {
15341         osmApiConnections.push({
15342           url: null,
15343           apiUrl: null,
15344           client_id: null
15345         });
15346       } else if (false) {
15347         osmApiConnections.push(defaultOsmApiConnections[null]);
15348       } else {
15349         osmApiConnections.push(defaultOsmApiConnections.live);
15350         osmApiConnections.push(defaultOsmApiConnections.dev);
15351       }
15352       taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
15353       nominatimApiUrl = "https://nominatim.openstreetmap.org/";
15354       showDonationMessage = true;
15355     }
15356   });
15357
15358   // package.json
15359   var package_default;
15360   var init_package = __esm({
15361     "package.json"() {
15362       package_default = {
15363         name: "iD",
15364         version: "2.35.0",
15365         description: "A friendly editor for OpenStreetMap",
15366         main: "dist/iD.min.js",
15367         repository: "github:openstreetmap/iD",
15368         homepage: "https://github.com/openstreetmap/iD",
15369         bugs: "https://github.com/openstreetmap/iD/issues",
15370         keywords: [
15371           "editor",
15372           "openstreetmap"
15373         ],
15374         license: "ISC",
15375         scripts: {
15376           all: "run-s clean build dist",
15377           build: "run-s build:css build:data build:js",
15378           "build:css": "node scripts/build_css.js",
15379           "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
15380           "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",
15381           "build:js": "node config/esbuild.config.mjs",
15382           "build:js:watch": "node config/esbuild.config.mjs --watch",
15383           clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
15384           dist: "run-p dist:**",
15385           "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
15386           "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
15387           "dist:min": "node config/esbuild.config.min.mjs",
15388           "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
15389           "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',
15390           "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
15391           "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',
15392           "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",
15393           "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",
15394           "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',
15395           "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',
15396           imagery: "node scripts/update_imagery.js",
15397           lint: "eslint config scripts test/spec modules",
15398           "lint:fix": "eslint scripts test/spec modules --fix",
15399           start: "run-s start:watch",
15400           "start:single-build": "run-p build:js start:server",
15401           "start:watch": "run-p build:js:watch start:server",
15402           "start:server": "node scripts/server.js",
15403           test: "npm-run-all -s lint build test:spec",
15404           "test:spec": "vitest --no-isolate",
15405           translations: "node scripts/update_locales.js"
15406         },
15407         dependencies: {
15408           "@mapbox/geojson-area": "^0.2.2",
15409           "@mapbox/sexagesimal": "1.2.0",
15410           "@mapbox/vector-tile": "^2.0.4",
15411           "@rapideditor/country-coder": "~5.4.0",
15412           "@rapideditor/location-conflation": "~1.5.0",
15413           "@tmcw/togeojson": "^7.1.2",
15414           "@turf/bbox": "^7.2.0",
15415           "@turf/bbox-clip": "^7.2.0",
15416           "abortcontroller-polyfill": "^1.7.8",
15417           "aes-js": "^3.1.2",
15418           "alif-toolkit": "^1.3.0",
15419           "core-js-bundle": "^3.44.0",
15420           diacritics: "1.3.0",
15421           exifr: "^7.1.3",
15422           "fast-deep-equal": "~3.1.1",
15423           "fast-json-stable-stringify": "2.1.0",
15424           "lodash-es": "~4.17.15",
15425           marked: "~16.0.0",
15426           "node-diff3": "~3.1.0",
15427           "osm-auth": "^3.0.0",
15428           pannellum: "2.5.6",
15429           pbf: "^4.0.1",
15430           "polygon-clipping": "~0.15.7",
15431           rbush: "4.0.1",
15432           vitest: "^3.2.4",
15433           "whatwg-fetch": "^3.6.20",
15434           "which-polygon": "2.2.1"
15435         },
15436         devDependencies: {
15437           "@fortawesome/fontawesome-svg-core": "~6.7.2",
15438           "@fortawesome/free-brands-svg-icons": "~6.7.2",
15439           "@fortawesome/free-regular-svg-icons": "~6.7.2",
15440           "@fortawesome/free-solid-svg-icons": "~6.7.2",
15441           "@mapbox/maki": "^8.2.0",
15442           "@openstreetmap/id-tagging-schema": "^6.11.0",
15443           "@rapideditor/mapillary_sprite_source": "^1.8.0",
15444           "@rapideditor/temaki": "^5.9.0",
15445           "@transifex/api": "^7.1.4",
15446           "@types/chai": "^5.2.2",
15447           "@types/d3": "^7.4.3",
15448           "@types/geojson": "^7946.0.16",
15449           "@types/happen": "^0.3.0",
15450           "@types/lodash-es": "^4.17.12",
15451           "@types/node": "^24.0.10",
15452           "@types/sinon": "^17.0.4",
15453           "@types/sinon-chai": "^4.0.0",
15454           autoprefixer: "^10.4.21",
15455           browserslist: "^4.25.1",
15456           "browserslist-to-esbuild": "^2.1.1",
15457           chai: "^5.2.1",
15458           chalk: "^4.1.2",
15459           "cldr-core": "^47.0.0",
15460           "cldr-localenames-full": "^47.0.0",
15461           "concat-files": "^0.1.1",
15462           d3: "~7.9.0",
15463           dotenv: "^17.2.0",
15464           "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
15465           esbuild: "^0.25.6",
15466           "esbuild-visualizer": "^0.7.0",
15467           eslint: "^9.30.1",
15468           "fetch-mock": "^11.1.1",
15469           gaze: "^1.1.3",
15470           glob: "^11.0.3",
15471           happen: "^0.3.2",
15472           "js-yaml": "^4.0.0",
15473           jsdom: "^26.1.0",
15474           "json-stringify-pretty-compact": "^3.0.0",
15475           "mapillary-js": "4.1.2",
15476           minimist: "^1.2.8",
15477           "name-suggestion-index": "~6.0",
15478           "netlify-cli": "^22.2.2",
15479           nise: "^6.1.1",
15480           "npm-run-all": "^4.0.0",
15481           "osm-community-index": "~5.9.2",
15482           postcss: "^8.5.6",
15483           "postcss-prefix-selector": "^2.1.1",
15484           "serve-handler": "^6.1.6",
15485           shelljs: "^0.10.0",
15486           shx: "^0.4.0",
15487           sinon: "^21.0.0",
15488           "sinon-chai": "^4.0.0",
15489           smash: "0.0",
15490           "svg-sprite": "2.0.4",
15491           vparse: "~1.1.0"
15492         },
15493         engines: {
15494           node: ">=20"
15495         },
15496         browserslist: [
15497           "> 0.3%, last 6 major versions, not dead, Firefox ESR, maintained node versions"
15498         ]
15499       };
15500     }
15501   });
15502
15503   // node_modules/aes-js/index.js
15504   var require_aes_js = __commonJS({
15505     "node_modules/aes-js/index.js"(exports2, module2) {
15506       (function(root3) {
15507         "use strict";
15508         function checkInt(value) {
15509           return parseInt(value) === value;
15510         }
15511         function checkInts(arrayish) {
15512           if (!checkInt(arrayish.length)) {
15513             return false;
15514           }
15515           for (var i3 = 0; i3 < arrayish.length; i3++) {
15516             if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
15517               return false;
15518             }
15519           }
15520           return true;
15521         }
15522         function coerceArray(arg, copy2) {
15523           if (arg.buffer && arg.name === "Uint8Array") {
15524             if (copy2) {
15525               if (arg.slice) {
15526                 arg = arg.slice();
15527               } else {
15528                 arg = Array.prototype.slice.call(arg);
15529               }
15530             }
15531             return arg;
15532           }
15533           if (Array.isArray(arg)) {
15534             if (!checkInts(arg)) {
15535               throw new Error("Array contains invalid value: " + arg);
15536             }
15537             return new Uint8Array(arg);
15538           }
15539           if (checkInt(arg.length) && checkInts(arg)) {
15540             return new Uint8Array(arg);
15541           }
15542           throw new Error("unsupported array-like object");
15543         }
15544         function createArray(length2) {
15545           return new Uint8Array(length2);
15546         }
15547         function copyArray2(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
15548           if (sourceStart != null || sourceEnd != null) {
15549             if (sourceArray.slice) {
15550               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
15551             } else {
15552               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
15553             }
15554           }
15555           targetArray.set(sourceArray, targetStart);
15556         }
15557         var convertUtf8 = /* @__PURE__ */ function() {
15558           function toBytes(text) {
15559             var result = [], i3 = 0;
15560             text = encodeURI(text);
15561             while (i3 < text.length) {
15562               var c2 = text.charCodeAt(i3++);
15563               if (c2 === 37) {
15564                 result.push(parseInt(text.substr(i3, 2), 16));
15565                 i3 += 2;
15566               } else {
15567                 result.push(c2);
15568               }
15569             }
15570             return coerceArray(result);
15571           }
15572           function fromBytes(bytes) {
15573             var result = [], i3 = 0;
15574             while (i3 < bytes.length) {
15575               var c2 = bytes[i3];
15576               if (c2 < 128) {
15577                 result.push(String.fromCharCode(c2));
15578                 i3++;
15579               } else if (c2 > 191 && c2 < 224) {
15580                 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
15581                 i3 += 2;
15582               } else {
15583                 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
15584                 i3 += 3;
15585               }
15586             }
15587             return result.join("");
15588           }
15589           return {
15590             toBytes,
15591             fromBytes
15592           };
15593         }();
15594         var convertHex = /* @__PURE__ */ function() {
15595           function toBytes(text) {
15596             var result = [];
15597             for (var i3 = 0; i3 < text.length; i3 += 2) {
15598               result.push(parseInt(text.substr(i3, 2), 16));
15599             }
15600             return result;
15601           }
15602           var Hex = "0123456789abcdef";
15603           function fromBytes(bytes) {
15604             var result = [];
15605             for (var i3 = 0; i3 < bytes.length; i3++) {
15606               var v3 = bytes[i3];
15607               result.push(Hex[(v3 & 240) >> 4] + Hex[v3 & 15]);
15608             }
15609             return result.join("");
15610           }
15611           return {
15612             toBytes,
15613             fromBytes
15614           };
15615         }();
15616         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
15617         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];
15618         var S3 = [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];
15619         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];
15620         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];
15621         var T22 = [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];
15622         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];
15623         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];
15624         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];
15625         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];
15626         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];
15627         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];
15628         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];
15629         var U22 = [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];
15630         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];
15631         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];
15632         function convertToInt32(bytes) {
15633           var result = [];
15634           for (var i3 = 0; i3 < bytes.length; i3 += 4) {
15635             result.push(
15636               bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
15637             );
15638           }
15639           return result;
15640         }
15641         var AES = function(key) {
15642           if (!(this instanceof AES)) {
15643             throw Error("AES must be instanitated with `new`");
15644           }
15645           Object.defineProperty(this, "key", {
15646             value: coerceArray(key, true)
15647           });
15648           this._prepare();
15649         };
15650         AES.prototype._prepare = function() {
15651           var rounds = numberOfRounds[this.key.length];
15652           if (rounds == null) {
15653             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
15654           }
15655           this._Ke = [];
15656           this._Kd = [];
15657           for (var i3 = 0; i3 <= rounds; i3++) {
15658             this._Ke.push([0, 0, 0, 0]);
15659             this._Kd.push([0, 0, 0, 0]);
15660           }
15661           var roundKeyCount = (rounds + 1) * 4;
15662           var KC = this.key.length / 4;
15663           var tk = convertToInt32(this.key);
15664           var index;
15665           for (var i3 = 0; i3 < KC; i3++) {
15666             index = i3 >> 2;
15667             this._Ke[index][i3 % 4] = tk[i3];
15668             this._Kd[rounds - index][i3 % 4] = tk[i3];
15669           }
15670           var rconpointer = 0;
15671           var t2 = KC, tt2;
15672           while (t2 < roundKeyCount) {
15673             tt2 = tk[KC - 1];
15674             tk[0] ^= S3[tt2 >> 16 & 255] << 24 ^ S3[tt2 >> 8 & 255] << 16 ^ S3[tt2 & 255] << 8 ^ S3[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
15675             rconpointer += 1;
15676             if (KC != 8) {
15677               for (var i3 = 1; i3 < KC; i3++) {
15678                 tk[i3] ^= tk[i3 - 1];
15679               }
15680             } else {
15681               for (var i3 = 1; i3 < KC / 2; i3++) {
15682                 tk[i3] ^= tk[i3 - 1];
15683               }
15684               tt2 = tk[KC / 2 - 1];
15685               tk[KC / 2] ^= S3[tt2 & 255] ^ S3[tt2 >> 8 & 255] << 8 ^ S3[tt2 >> 16 & 255] << 16 ^ S3[tt2 >> 24 & 255] << 24;
15686               for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
15687                 tk[i3] ^= tk[i3 - 1];
15688               }
15689             }
15690             var i3 = 0, r2, c2;
15691             while (i3 < KC && t2 < roundKeyCount) {
15692               r2 = t2 >> 2;
15693               c2 = t2 % 4;
15694               this._Ke[r2][c2] = tk[i3];
15695               this._Kd[rounds - r2][c2] = tk[i3++];
15696               t2++;
15697             }
15698           }
15699           for (var r2 = 1; r2 < rounds; r2++) {
15700             for (var c2 = 0; c2 < 4; c2++) {
15701               tt2 = this._Kd[r2][c2];
15702               this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U22[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
15703             }
15704           }
15705         };
15706         AES.prototype.encrypt = function(plaintext) {
15707           if (plaintext.length != 16) {
15708             throw new Error("invalid plaintext size (must be 16 bytes)");
15709           }
15710           var rounds = this._Ke.length - 1;
15711           var a4 = [0, 0, 0, 0];
15712           var t2 = convertToInt32(plaintext);
15713           for (var i3 = 0; i3 < 4; i3++) {
15714             t2[i3] ^= this._Ke[0][i3];
15715           }
15716           for (var r2 = 1; r2 < rounds; r2++) {
15717             for (var i3 = 0; i3 < 4; i3++) {
15718               a4[i3] = T1[t2[i3] >> 24 & 255] ^ T22[t2[(i3 + 1) % 4] >> 16 & 255] ^ T3[t2[(i3 + 2) % 4] >> 8 & 255] ^ T4[t2[(i3 + 3) % 4] & 255] ^ this._Ke[r2][i3];
15719             }
15720             t2 = a4.slice();
15721           }
15722           var result = createArray(16), tt2;
15723           for (var i3 = 0; i3 < 4; i3++) {
15724             tt2 = this._Ke[rounds][i3];
15725             result[4 * i3] = (S3[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
15726             result[4 * i3 + 1] = (S3[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
15727             result[4 * i3 + 2] = (S3[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
15728             result[4 * i3 + 3] = (S3[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
15729           }
15730           return result;
15731         };
15732         AES.prototype.decrypt = function(ciphertext) {
15733           if (ciphertext.length != 16) {
15734             throw new Error("invalid ciphertext size (must be 16 bytes)");
15735           }
15736           var rounds = this._Kd.length - 1;
15737           var a4 = [0, 0, 0, 0];
15738           var t2 = convertToInt32(ciphertext);
15739           for (var i3 = 0; i3 < 4; i3++) {
15740             t2[i3] ^= this._Kd[0][i3];
15741           }
15742           for (var r2 = 1; r2 < rounds; r2++) {
15743             for (var i3 = 0; i3 < 4; i3++) {
15744               a4[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];
15745             }
15746             t2 = a4.slice();
15747           }
15748           var result = createArray(16), tt2;
15749           for (var i3 = 0; i3 < 4; i3++) {
15750             tt2 = this._Kd[rounds][i3];
15751             result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
15752             result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
15753             result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
15754             result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
15755           }
15756           return result;
15757         };
15758         var ModeOfOperationECB = function(key) {
15759           if (!(this instanceof ModeOfOperationECB)) {
15760             throw Error("AES must be instanitated with `new`");
15761           }
15762           this.description = "Electronic Code Block";
15763           this.name = "ecb";
15764           this._aes = new AES(key);
15765         };
15766         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
15767           plaintext = coerceArray(plaintext);
15768           if (plaintext.length % 16 !== 0) {
15769             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
15770           }
15771           var ciphertext = createArray(plaintext.length);
15772           var block = createArray(16);
15773           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
15774             copyArray2(plaintext, block, 0, i3, i3 + 16);
15775             block = this._aes.encrypt(block);
15776             copyArray2(block, ciphertext, i3);
15777           }
15778           return ciphertext;
15779         };
15780         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
15781           ciphertext = coerceArray(ciphertext);
15782           if (ciphertext.length % 16 !== 0) {
15783             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
15784           }
15785           var plaintext = createArray(ciphertext.length);
15786           var block = createArray(16);
15787           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
15788             copyArray2(ciphertext, block, 0, i3, i3 + 16);
15789             block = this._aes.decrypt(block);
15790             copyArray2(block, plaintext, i3);
15791           }
15792           return plaintext;
15793         };
15794         var ModeOfOperationCBC = function(key, iv) {
15795           if (!(this instanceof ModeOfOperationCBC)) {
15796             throw Error("AES must be instanitated with `new`");
15797           }
15798           this.description = "Cipher Block Chaining";
15799           this.name = "cbc";
15800           if (!iv) {
15801             iv = createArray(16);
15802           } else if (iv.length != 16) {
15803             throw new Error("invalid initialation vector size (must be 16 bytes)");
15804           }
15805           this._lastCipherblock = coerceArray(iv, true);
15806           this._aes = new AES(key);
15807         };
15808         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
15809           plaintext = coerceArray(plaintext);
15810           if (plaintext.length % 16 !== 0) {
15811             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
15812           }
15813           var ciphertext = createArray(plaintext.length);
15814           var block = createArray(16);
15815           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
15816             copyArray2(plaintext, block, 0, i3, i3 + 16);
15817             for (var j3 = 0; j3 < 16; j3++) {
15818               block[j3] ^= this._lastCipherblock[j3];
15819             }
15820             this._lastCipherblock = this._aes.encrypt(block);
15821             copyArray2(this._lastCipherblock, ciphertext, i3);
15822           }
15823           return ciphertext;
15824         };
15825         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
15826           ciphertext = coerceArray(ciphertext);
15827           if (ciphertext.length % 16 !== 0) {
15828             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
15829           }
15830           var plaintext = createArray(ciphertext.length);
15831           var block = createArray(16);
15832           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
15833             copyArray2(ciphertext, block, 0, i3, i3 + 16);
15834             block = this._aes.decrypt(block);
15835             for (var j3 = 0; j3 < 16; j3++) {
15836               plaintext[i3 + j3] = block[j3] ^ this._lastCipherblock[j3];
15837             }
15838             copyArray2(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
15839           }
15840           return plaintext;
15841         };
15842         var ModeOfOperationCFB = function(key, iv, segmentSize) {
15843           if (!(this instanceof ModeOfOperationCFB)) {
15844             throw Error("AES must be instanitated with `new`");
15845           }
15846           this.description = "Cipher Feedback";
15847           this.name = "cfb";
15848           if (!iv) {
15849             iv = createArray(16);
15850           } else if (iv.length != 16) {
15851             throw new Error("invalid initialation vector size (must be 16 size)");
15852           }
15853           if (!segmentSize) {
15854             segmentSize = 1;
15855           }
15856           this.segmentSize = segmentSize;
15857           this._shiftRegister = coerceArray(iv, true);
15858           this._aes = new AES(key);
15859         };
15860         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
15861           if (plaintext.length % this.segmentSize != 0) {
15862             throw new Error("invalid plaintext size (must be segmentSize bytes)");
15863           }
15864           var encrypted = coerceArray(plaintext, true);
15865           var xorSegment;
15866           for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
15867             xorSegment = this._aes.encrypt(this._shiftRegister);
15868             for (var j3 = 0; j3 < this.segmentSize; j3++) {
15869               encrypted[i3 + j3] ^= xorSegment[j3];
15870             }
15871             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15872             copyArray2(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15873           }
15874           return encrypted;
15875         };
15876         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
15877           if (ciphertext.length % this.segmentSize != 0) {
15878             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
15879           }
15880           var plaintext = coerceArray(ciphertext, true);
15881           var xorSegment;
15882           for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
15883             xorSegment = this._aes.encrypt(this._shiftRegister);
15884             for (var j3 = 0; j3 < this.segmentSize; j3++) {
15885               plaintext[i3 + j3] ^= xorSegment[j3];
15886             }
15887             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15888             copyArray2(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15889           }
15890           return plaintext;
15891         };
15892         var ModeOfOperationOFB = function(key, iv) {
15893           if (!(this instanceof ModeOfOperationOFB)) {
15894             throw Error("AES must be instanitated with `new`");
15895           }
15896           this.description = "Output Feedback";
15897           this.name = "ofb";
15898           if (!iv) {
15899             iv = createArray(16);
15900           } else if (iv.length != 16) {
15901             throw new Error("invalid initialation vector size (must be 16 bytes)");
15902           }
15903           this._lastPrecipher = coerceArray(iv, true);
15904           this._lastPrecipherIndex = 16;
15905           this._aes = new AES(key);
15906         };
15907         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
15908           var encrypted = coerceArray(plaintext, true);
15909           for (var i3 = 0; i3 < encrypted.length; i3++) {
15910             if (this._lastPrecipherIndex === 16) {
15911               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
15912               this._lastPrecipherIndex = 0;
15913             }
15914             encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
15915           }
15916           return encrypted;
15917         };
15918         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
15919         var Counter = function(initialValue) {
15920           if (!(this instanceof Counter)) {
15921             throw Error("Counter must be instanitated with `new`");
15922           }
15923           if (initialValue !== 0 && !initialValue) {
15924             initialValue = 1;
15925           }
15926           if (typeof initialValue === "number") {
15927             this._counter = createArray(16);
15928             this.setValue(initialValue);
15929           } else {
15930             this.setBytes(initialValue);
15931           }
15932         };
15933         Counter.prototype.setValue = function(value) {
15934           if (typeof value !== "number" || parseInt(value) != value) {
15935             throw new Error("invalid counter value (must be an integer)");
15936           }
15937           if (value > Number.MAX_SAFE_INTEGER) {
15938             throw new Error("integer value out of safe range");
15939           }
15940           for (var index = 15; index >= 0; --index) {
15941             this._counter[index] = value % 256;
15942             value = parseInt(value / 256);
15943           }
15944         };
15945         Counter.prototype.setBytes = function(bytes) {
15946           bytes = coerceArray(bytes, true);
15947           if (bytes.length != 16) {
15948             throw new Error("invalid counter bytes size (must be 16 bytes)");
15949           }
15950           this._counter = bytes;
15951         };
15952         Counter.prototype.increment = function() {
15953           for (var i3 = 15; i3 >= 0; i3--) {
15954             if (this._counter[i3] === 255) {
15955               this._counter[i3] = 0;
15956             } else {
15957               this._counter[i3]++;
15958               break;
15959             }
15960           }
15961         };
15962         var ModeOfOperationCTR = function(key, counter) {
15963           if (!(this instanceof ModeOfOperationCTR)) {
15964             throw Error("AES must be instanitated with `new`");
15965           }
15966           this.description = "Counter";
15967           this.name = "ctr";
15968           if (!(counter instanceof Counter)) {
15969             counter = new Counter(counter);
15970           }
15971           this._counter = counter;
15972           this._remainingCounter = null;
15973           this._remainingCounterIndex = 16;
15974           this._aes = new AES(key);
15975         };
15976         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
15977           var encrypted = coerceArray(plaintext, true);
15978           for (var i3 = 0; i3 < encrypted.length; i3++) {
15979             if (this._remainingCounterIndex === 16) {
15980               this._remainingCounter = this._aes.encrypt(this._counter._counter);
15981               this._remainingCounterIndex = 0;
15982               this._counter.increment();
15983             }
15984             encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
15985           }
15986           return encrypted;
15987         };
15988         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
15989         function pkcs7pad(data) {
15990           data = coerceArray(data, true);
15991           var padder = 16 - data.length % 16;
15992           var result = createArray(data.length + padder);
15993           copyArray2(data, result);
15994           for (var i3 = data.length; i3 < result.length; i3++) {
15995             result[i3] = padder;
15996           }
15997           return result;
15998         }
15999         function pkcs7strip(data) {
16000           data = coerceArray(data, true);
16001           if (data.length < 16) {
16002             throw new Error("PKCS#7 invalid length");
16003           }
16004           var padder = data[data.length - 1];
16005           if (padder > 16) {
16006             throw new Error("PKCS#7 padding byte out of range");
16007           }
16008           var length2 = data.length - padder;
16009           for (var i3 = 0; i3 < padder; i3++) {
16010             if (data[length2 + i3] !== padder) {
16011               throw new Error("PKCS#7 invalid padding byte");
16012             }
16013           }
16014           var result = createArray(length2);
16015           copyArray2(data, result, 0, 0, length2);
16016           return result;
16017         }
16018         var aesjs2 = {
16019           AES,
16020           Counter,
16021           ModeOfOperation: {
16022             ecb: ModeOfOperationECB,
16023             cbc: ModeOfOperationCBC,
16024             cfb: ModeOfOperationCFB,
16025             ofb: ModeOfOperationOFB,
16026             ctr: ModeOfOperationCTR
16027           },
16028           utils: {
16029             hex: convertHex,
16030             utf8: convertUtf8
16031           },
16032           padding: {
16033             pkcs7: {
16034               pad: pkcs7pad,
16035               strip: pkcs7strip
16036             }
16037           },
16038           _arrayTest: {
16039             coerceArray,
16040             createArray,
16041             copyArray: copyArray2
16042           }
16043         };
16044         if (typeof exports2 !== "undefined") {
16045           module2.exports = aesjs2;
16046         } else if (typeof define === "function" && define.amd) {
16047           define([], function() {
16048             return aesjs2;
16049           });
16050         } else {
16051           if (root3.aesjs) {
16052             aesjs2._aesjs = root3.aesjs;
16053           }
16054           root3.aesjs = aesjs2;
16055         }
16056       })(exports2);
16057     }
16058   });
16059
16060   // modules/util/aes.js
16061   var aes_exports = {};
16062   __export(aes_exports, {
16063     utilAesDecrypt: () => utilAesDecrypt,
16064     utilAesEncrypt: () => utilAesEncrypt
16065   });
16066   function utilAesEncrypt(text, key) {
16067     key = key || DEFAULT_128;
16068     const textBytes = import_aes_js.default.utils.utf8.toBytes(text);
16069     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
16070     const encryptedBytes = aesCtr.encrypt(textBytes);
16071     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
16072     return encryptedHex;
16073   }
16074   function utilAesDecrypt(encryptedHex, key) {
16075     key = key || DEFAULT_128;
16076     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
16077     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
16078     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
16079     const text = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
16080     return text;
16081   }
16082   var import_aes_js, DEFAULT_128;
16083   var init_aes = __esm({
16084     "modules/util/aes.js"() {
16085       "use strict";
16086       import_aes_js = __toESM(require_aes_js());
16087       DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
16088     }
16089   });
16090
16091   // modules/util/clean_tags.js
16092   var clean_tags_exports = {};
16093   __export(clean_tags_exports, {
16094     utilCleanTags: () => utilCleanTags
16095   });
16096   function utilCleanTags(tags) {
16097     var out = {};
16098     for (var k3 in tags) {
16099       if (!k3) continue;
16100       var v3 = tags[k3];
16101       if (v3 !== void 0) {
16102         out[k3] = cleanValue(k3, v3);
16103       }
16104     }
16105     return out;
16106     function cleanValue(k4, v4) {
16107       function keepSpaces(k5) {
16108         return /_hours|_times|:conditional$/.test(k5);
16109       }
16110       function skip(k5) {
16111         return /^(description|note|fixme|inscription)$/.test(k5);
16112       }
16113       if (skip(k4)) return v4;
16114       var cleaned = v4.split(";").map(function(s2) {
16115         return s2.trim();
16116       }).join(keepSpaces(k4) ? "; " : ";");
16117       if (k4.indexOf("website") !== -1 || k4.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
16118         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
16119       }
16120       return cleaned;
16121     }
16122   }
16123   var init_clean_tags = __esm({
16124     "modules/util/clean_tags.js"() {
16125       "use strict";
16126     }
16127   });
16128
16129   // modules/util/detect.js
16130   var detect_exports = {};
16131   __export(detect_exports, {
16132     utilDetect: () => utilDetect
16133   });
16134   function utilDetect(refresh2) {
16135     if (_detected && !refresh2) return _detected;
16136     _detected = {};
16137     const ua = navigator.userAgent;
16138     let m3 = null;
16139     m3 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
16140     if (m3 !== null) {
16141       _detected.browser = m3[1];
16142       _detected.version = m3[2];
16143     }
16144     if (!_detected.browser) {
16145       m3 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
16146       if (m3 !== null) {
16147         _detected.browser = "msie";
16148         _detected.version = m3[1];
16149       }
16150     }
16151     if (!_detected.browser) {
16152       m3 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
16153       if (m3 !== null) {
16154         _detected.browser = "Opera";
16155         _detected.version = m3[2];
16156       }
16157     }
16158     if (!_detected.browser) {
16159       m3 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
16160       if (m3 !== null) {
16161         _detected.browser = m3[1];
16162         _detected.version = m3[2];
16163         m3 = ua.match(/version\/([\.\d]+)/i);
16164         if (m3 !== null) _detected.version = m3[1];
16165       }
16166     }
16167     if (!_detected.browser) {
16168       _detected.browser = navigator.appName;
16169       _detected.version = navigator.appVersion;
16170     }
16171     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
16172     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
16173     if (_detected.browser.toLowerCase() === "msie") {
16174       _detected.ie = true;
16175       _detected.browser = "Internet Explorer";
16176       _detected.support = false;
16177     } else {
16178       _detected.ie = false;
16179       _detected.support = true;
16180     }
16181     _detected.filedrop = window.FileReader && "ondrop" in window;
16182     if (/Win/.test(ua)) {
16183       _detected.os = "win";
16184       _detected.platform = "Windows";
16185     } else if (/Mac/.test(ua)) {
16186       _detected.os = "mac";
16187       _detected.platform = "Macintosh";
16188     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
16189       _detected.os = "linux";
16190       _detected.platform = "Linux";
16191     } else {
16192       _detected.os = "win";
16193       _detected.platform = "Unknown";
16194     }
16195     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
16196     // so assume any "mac" with multitouch is actually iOS
16197     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
16198     _detected.browserLocales = Array.from(new Set(
16199       // remove duplicates
16200       [navigator.language].concat(navigator.languages || []).concat([
16201         // old property for backwards compatibility
16202         navigator.userLanguage
16203       ]).filter(Boolean)
16204     ));
16205     let loc;
16206     try {
16207       loc = window.top.location;
16208     } catch {
16209       loc = window.location;
16210     }
16211     _detected.host = loc.origin + loc.pathname;
16212     return _detected;
16213   }
16214   var _detected;
16215   var init_detect = __esm({
16216     "modules/util/detect.js"() {
16217       "use strict";
16218     }
16219   });
16220
16221   // modules/util/get_set_value.js
16222   var get_set_value_exports = {};
16223   __export(get_set_value_exports, {
16224     utilGetSetValue: () => utilGetSetValue
16225   });
16226   function utilGetSetValue(selection2, value, shouldUpdate) {
16227     function setValue(value2, shouldUpdate2) {
16228       function valueNull() {
16229         delete this.value;
16230       }
16231       function valueConstant() {
16232         if (shouldUpdate2(this.value, value2)) {
16233           this.value = value2;
16234         }
16235       }
16236       function valueFunction() {
16237         var x2 = value2.apply(this, arguments);
16238         if (x2 === null || x2 === void 0) {
16239           delete this.value;
16240         } else if (shouldUpdate2(this.value, x2)) {
16241           this.value = x2;
16242         }
16243       }
16244       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
16245     }
16246     if (arguments.length === 1) {
16247       return selection2.property("value");
16248     }
16249     if (shouldUpdate === void 0) {
16250       shouldUpdate = (a4, b3) => a4 !== b3;
16251     }
16252     return selection2.each(setValue(value, shouldUpdate));
16253   }
16254   var init_get_set_value = __esm({
16255     "modules/util/get_set_value.js"() {
16256       "use strict";
16257     }
16258   });
16259
16260   // modules/util/keybinding.js
16261   var keybinding_exports = {};
16262   __export(keybinding_exports, {
16263     utilKeybinding: () => utilKeybinding
16264   });
16265   function utilKeybinding(namespace) {
16266     var _keybindings = {};
16267     function testBindings(d3_event, isCapturing) {
16268       var didMatch = false;
16269       var bindings = Object.keys(_keybindings).map(function(id2) {
16270         return _keybindings[id2];
16271       });
16272       for (const binding of bindings) {
16273         if (!binding.event.modifiers.shiftKey) continue;
16274         if (!!binding.capture !== isCapturing) continue;
16275         if (matches(d3_event, binding, true)) {
16276           binding.callback(d3_event);
16277           didMatch = true;
16278           break;
16279         }
16280       }
16281       if (didMatch) return;
16282       for (const binding of bindings) {
16283         if (binding.event.modifiers.shiftKey) continue;
16284         if (!!binding.capture !== isCapturing) continue;
16285         if (matches(d3_event, binding, false)) {
16286           binding.callback(d3_event);
16287           break;
16288         }
16289       }
16290       function matches(d3_event2, binding, testShift) {
16291         var event = d3_event2;
16292         var isMatch = false;
16293         var tryKeyCode = true;
16294         if (event.key !== void 0) {
16295           tryKeyCode = event.key.charCodeAt(0) > 127;
16296           isMatch = true;
16297           if (binding.event.key === void 0) {
16298             isMatch = false;
16299           } else if (Array.isArray(binding.event.key)) {
16300             if (binding.event.key.map(function(s2) {
16301               return s2.toLowerCase();
16302             }).indexOf(event.key.toLowerCase()) === -1) {
16303               isMatch = false;
16304             }
16305           } else {
16306             if (event.key.toLowerCase() !== binding.event.key.toLowerCase()) {
16307               isMatch = false;
16308             }
16309           }
16310         }
16311         if (!isMatch && (tryKeyCode || binding.event.modifiers.altKey)) {
16312           isMatch = event.keyCode === binding.event.keyCode;
16313         }
16314         if (!isMatch) return false;
16315         if (!(event.ctrlKey && event.altKey)) {
16316           if (event.ctrlKey !== binding.event.modifiers.ctrlKey) return false;
16317           if (event.altKey !== binding.event.modifiers.altKey) return false;
16318         }
16319         if (event.metaKey !== binding.event.modifiers.metaKey) return false;
16320         if (testShift && event.shiftKey !== binding.event.modifiers.shiftKey) return false;
16321         return true;
16322       }
16323     }
16324     function capture(d3_event) {
16325       testBindings(d3_event, true);
16326     }
16327     function bubble(d3_event) {
16328       var tagName = select_default2(d3_event.target).node().tagName;
16329       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
16330         return;
16331       }
16332       testBindings(d3_event, false);
16333     }
16334     function keybinding(selection2) {
16335       selection2 = selection2 || select_default2(document);
16336       selection2.on("keydown.capture." + namespace, capture, true);
16337       selection2.on("keydown.bubble." + namespace, bubble, false);
16338       return keybinding;
16339     }
16340     keybinding.unbind = function(selection2) {
16341       _keybindings = [];
16342       selection2 = selection2 || select_default2(document);
16343       selection2.on("keydown.capture." + namespace, null);
16344       selection2.on("keydown.bubble." + namespace, null);
16345       return keybinding;
16346     };
16347     keybinding.clear = function() {
16348       _keybindings = {};
16349       return keybinding;
16350     };
16351     keybinding.off = function(codes, capture2) {
16352       var arr = utilArrayUniq([].concat(codes));
16353       for (var i3 = 0; i3 < arr.length; i3++) {
16354         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
16355         delete _keybindings[id2];
16356       }
16357       return keybinding;
16358     };
16359     keybinding.on = function(codes, callback, capture2) {
16360       if (typeof callback !== "function") {
16361         return keybinding.off(codes, capture2);
16362       }
16363       var arr = utilArrayUniq([].concat(codes));
16364       for (var i3 = 0; i3 < arr.length; i3++) {
16365         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
16366         var binding = {
16367           id: id2,
16368           capture: capture2,
16369           callback,
16370           event: {
16371             key: void 0,
16372             // preferred
16373             keyCode: 0,
16374             // fallback
16375             modifiers: {
16376               shiftKey: false,
16377               ctrlKey: false,
16378               altKey: false,
16379               metaKey: false
16380             }
16381           }
16382         };
16383         if (_keybindings[id2]) {
16384           console.warn('warning: duplicate keybinding for "' + id2 + '"');
16385         }
16386         _keybindings[id2] = binding;
16387         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
16388         for (var j3 = 0; j3 < matches.length; j3++) {
16389           if (matches[j3] === "++") matches[j3] = "+";
16390           if (matches[j3] in utilKeybinding.modifierCodes) {
16391             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j3]]];
16392             binding.event.modifiers[prop] = true;
16393           } else {
16394             binding.event.key = utilKeybinding.keys[matches[j3]] || matches[j3];
16395             if (matches[j3] in utilKeybinding.keyCodes) {
16396               binding.event.keyCode = utilKeybinding.keyCodes[matches[j3]];
16397             }
16398           }
16399         }
16400       }
16401       return keybinding;
16402     };
16403     return keybinding;
16404   }
16405   var i, n;
16406   var init_keybinding = __esm({
16407     "modules/util/keybinding.js"() {
16408       "use strict";
16409       init_src5();
16410       init_array3();
16411       utilKeybinding.modifierCodes = {
16412         // Shift key, ⇧
16413         "\u21E7": 16,
16414         shift: 16,
16415         // CTRL key, on Mac: ⌃
16416         "\u2303": 17,
16417         ctrl: 17,
16418         // ALT key, on Mac: ⌥ (Alt)
16419         "\u2325": 18,
16420         alt: 18,
16421         option: 18,
16422         // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
16423         "\u2318": 91,
16424         meta: 91,
16425         cmd: 91,
16426         "super": 91,
16427         win: 91
16428       };
16429       utilKeybinding.modifierProperties = {
16430         16: "shiftKey",
16431         17: "ctrlKey",
16432         18: "altKey",
16433         91: "metaKey"
16434       };
16435       utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
16436       utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
16437       utilKeybinding.keys = {
16438         // Backspace key, on Mac: ⌫ (Backspace)
16439         "\u232B": "Backspace",
16440         backspace: "Backspace",
16441         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
16442         "\u21E5": "Tab",
16443         "\u21C6": "Tab",
16444         tab: "Tab",
16445         // Return key, ↩
16446         "\u21A9": "Enter",
16447         "\u21B5": "Enter",
16448         "\u23CE": "Enter",
16449         "return": "Enter",
16450         enter: "Enter",
16451         "\u2305": "Enter",
16452         // Pause/Break key
16453         "pause": "Pause",
16454         "pause-break": "Pause",
16455         // Caps Lock key, ⇪
16456         "\u21EA": "CapsLock",
16457         caps: "CapsLock",
16458         "caps-lock": "CapsLock",
16459         // Escape key, on Mac: ⎋, on Windows: Esc
16460         "\u238B": ["Escape", "Esc"],
16461         escape: ["Escape", "Esc"],
16462         esc: ["Escape", "Esc"],
16463         // Space key
16464         space: [" ", "Spacebar"],
16465         // Page-Up key, or pgup, on Mac: ↖
16466         "\u2196": "PageUp",
16467         pgup: "PageUp",
16468         "page-up": "PageUp",
16469         // Page-Down key, or pgdown, on Mac: ↘
16470         "\u2198": "PageDown",
16471         pgdown: "PageDown",
16472         "page-down": "PageDown",
16473         // END key, on Mac: ⇟
16474         "\u21DF": "End",
16475         end: "End",
16476         // HOME key, on Mac: ⇞
16477         "\u21DE": "Home",
16478         home: "Home",
16479         // Insert key, or ins
16480         ins: "Insert",
16481         insert: "Insert",
16482         // Delete key, on Mac: ⌦ (Delete)
16483         "\u2326": ["Delete", "Del"],
16484         del: ["Delete", "Del"],
16485         "delete": ["Delete", "Del"],
16486         // Left Arrow Key, or ←
16487         "\u2190": ["ArrowLeft", "Left"],
16488         left: ["ArrowLeft", "Left"],
16489         "arrow-left": ["ArrowLeft", "Left"],
16490         // Up Arrow Key, or ↑
16491         "\u2191": ["ArrowUp", "Up"],
16492         up: ["ArrowUp", "Up"],
16493         "arrow-up": ["ArrowUp", "Up"],
16494         // Right Arrow Key, or →
16495         "\u2192": ["ArrowRight", "Right"],
16496         right: ["ArrowRight", "Right"],
16497         "arrow-right": ["ArrowRight", "Right"],
16498         // Up Arrow Key, or ↓
16499         "\u2193": ["ArrowDown", "Down"],
16500         down: ["ArrowDown", "Down"],
16501         "arrow-down": ["ArrowDown", "Down"],
16502         // odities, stuff for backward compatibility (browsers and code):
16503         // Num-Multiply, or *
16504         "*": ["*", "Multiply"],
16505         star: ["*", "Multiply"],
16506         asterisk: ["*", "Multiply"],
16507         multiply: ["*", "Multiply"],
16508         // Num-Plus or +
16509         "+": ["+", "Add"],
16510         "plus": ["+", "Add"],
16511         // Num-Subtract, or -
16512         "-": ["-", "Subtract"],
16513         subtract: ["-", "Subtract"],
16514         "dash": ["-", "Subtract"],
16515         // Semicolon
16516         semicolon: ";",
16517         // = or equals
16518         equals: "=",
16519         // Comma, or ,
16520         comma: ",",
16521         // Period, or ., or full-stop
16522         period: ".",
16523         "full-stop": ".",
16524         // Slash, or /, or forward-slash
16525         slash: "/",
16526         "forward-slash": "/",
16527         // Tick, or `, or back-quote
16528         tick: "`",
16529         "back-quote": "`",
16530         // Open bracket, or [
16531         "open-bracket": "[",
16532         // Back slash, or \
16533         "back-slash": "\\",
16534         // Close bracket, or ]
16535         "close-bracket": "]",
16536         // Apostrophe, or Quote, or '
16537         quote: "'",
16538         apostrophe: "'",
16539         // NUMPAD 0-9
16540         "num-0": "0",
16541         "num-1": "1",
16542         "num-2": "2",
16543         "num-3": "3",
16544         "num-4": "4",
16545         "num-5": "5",
16546         "num-6": "6",
16547         "num-7": "7",
16548         "num-8": "8",
16549         "num-9": "9",
16550         // F1-F25
16551         f1: "F1",
16552         f2: "F2",
16553         f3: "F3",
16554         f4: "F4",
16555         f5: "F5",
16556         f6: "F6",
16557         f7: "F7",
16558         f8: "F8",
16559         f9: "F9",
16560         f10: "F10",
16561         f11: "F11",
16562         f12: "F12",
16563         f13: "F13",
16564         f14: "F14",
16565         f15: "F15",
16566         f16: "F16",
16567         f17: "F17",
16568         f18: "F18",
16569         f19: "F19",
16570         f20: "F20",
16571         f21: "F21",
16572         f22: "F22",
16573         f23: "F23",
16574         f24: "F24",
16575         f25: "F25"
16576       };
16577       utilKeybinding.keyCodes = {
16578         // Backspace key, on Mac: ⌫ (Backspace)
16579         "\u232B": 8,
16580         backspace: 8,
16581         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
16582         "\u21E5": 9,
16583         "\u21C6": 9,
16584         tab: 9,
16585         // Return key, ↩
16586         "\u21A9": 13,
16587         "\u21B5": 13,
16588         "\u23CE": 13,
16589         "return": 13,
16590         enter: 13,
16591         "\u2305": 13,
16592         // Pause/Break key
16593         "pause": 19,
16594         "pause-break": 19,
16595         // Caps Lock key, ⇪
16596         "\u21EA": 20,
16597         caps: 20,
16598         "caps-lock": 20,
16599         // Escape key, on Mac: ⎋, on Windows: Esc
16600         "\u238B": 27,
16601         escape: 27,
16602         esc: 27,
16603         // Space key
16604         space: 32,
16605         // Page-Up key, or pgup, on Mac: ↖
16606         "\u2196": 33,
16607         pgup: 33,
16608         "page-up": 33,
16609         // Page-Down key, or pgdown, on Mac: ↘
16610         "\u2198": 34,
16611         pgdown: 34,
16612         "page-down": 34,
16613         // END key, on Mac: ⇟
16614         "\u21DF": 35,
16615         end: 35,
16616         // HOME key, on Mac: ⇞
16617         "\u21DE": 36,
16618         home: 36,
16619         // Insert key, or ins
16620         ins: 45,
16621         insert: 45,
16622         // Delete key, on Mac: ⌦ (Delete)
16623         "\u2326": 46,
16624         del: 46,
16625         "delete": 46,
16626         // Left Arrow Key, or ←
16627         "\u2190": 37,
16628         left: 37,
16629         "arrow-left": 37,
16630         // Up Arrow Key, or ↑
16631         "\u2191": 38,
16632         up: 38,
16633         "arrow-up": 38,
16634         // Right Arrow Key, or →
16635         "\u2192": 39,
16636         right: 39,
16637         "arrow-right": 39,
16638         // Up Arrow Key, or ↓
16639         "\u2193": 40,
16640         down: 40,
16641         "arrow-down": 40,
16642         // odities, printing characters that come out wrong:
16643         // Firefox Equals
16644         "ffequals": 61,
16645         // Num-Multiply, or *
16646         "*": 106,
16647         star: 106,
16648         asterisk: 106,
16649         multiply: 106,
16650         // Num-Plus or +
16651         "+": 107,
16652         "plus": 107,
16653         // Num-Subtract, or -
16654         "-": 109,
16655         subtract: 109,
16656         // Vertical Bar / Pipe
16657         "|": 124,
16658         // Firefox Plus
16659         "ffplus": 171,
16660         // Firefox Minus
16661         "ffminus": 173,
16662         // Semicolon
16663         ";": 186,
16664         semicolon: 186,
16665         // = or equals
16666         "=": 187,
16667         "equals": 187,
16668         // Comma, or ,
16669         ",": 188,
16670         comma: 188,
16671         // Dash / Underscore key
16672         "dash": 189,
16673         // Period, or ., or full-stop
16674         ".": 190,
16675         period: 190,
16676         "full-stop": 190,
16677         // Slash, or /, or forward-slash
16678         "/": 191,
16679         slash: 191,
16680         "forward-slash": 191,
16681         // Tick, or `, or back-quote
16682         "`": 192,
16683         tick: 192,
16684         "back-quote": 192,
16685         // Open bracket, or [
16686         "[": 219,
16687         "open-bracket": 219,
16688         // Back slash, or \
16689         "\\": 220,
16690         "back-slash": 220,
16691         // Close bracket, or ]
16692         "]": 221,
16693         "close-bracket": 221,
16694         // Apostrophe, or Quote, or '
16695         "'": 222,
16696         quote: 222,
16697         apostrophe: 222
16698       };
16699       i = 95;
16700       n = 0;
16701       while (++i < 106) {
16702         utilKeybinding.keyCodes["num-" + n] = i;
16703         ++n;
16704       }
16705       i = 47;
16706       n = 0;
16707       while (++i < 58) {
16708         utilKeybinding.keyCodes[n] = i;
16709         ++n;
16710       }
16711       i = 111;
16712       n = 1;
16713       while (++i < 136) {
16714         utilKeybinding.keyCodes["f" + n] = i;
16715         ++n;
16716       }
16717       i = 64;
16718       while (++i < 91) {
16719         utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
16720       }
16721     }
16722   });
16723
16724   // modules/util/object.js
16725   var object_exports = {};
16726   __export(object_exports, {
16727     utilCheckTagDictionary: () => utilCheckTagDictionary,
16728     utilObjectOmit: () => utilObjectOmit
16729   });
16730   function utilObjectOmit(obj, omitKeys) {
16731     return Object.keys(obj).reduce(function(result, key) {
16732       if (omitKeys.indexOf(key) === -1) {
16733         result[key] = obj[key];
16734       }
16735       return result;
16736     }, {});
16737   }
16738   function utilCheckTagDictionary(tags, tagDictionary) {
16739     for (const key in tags) {
16740       const value = tags[key];
16741       if (tagDictionary[key] && value in tagDictionary[key]) {
16742         return tagDictionary[key][value];
16743       }
16744     }
16745     return void 0;
16746   }
16747   var init_object2 = __esm({
16748     "modules/util/object.js"() {
16749       "use strict";
16750     }
16751   });
16752
16753   // modules/util/rebind.js
16754   var rebind_exports = {};
16755   __export(rebind_exports, {
16756     utilRebind: () => utilRebind
16757   });
16758   function utilRebind(target, source, ...args) {
16759     for (const method of args) {
16760       target[method] = d3_rebind(target, source, source[method]);
16761     }
16762     return target;
16763   }
16764   function d3_rebind(target, source, method) {
16765     return function() {
16766       var value = method.apply(source, arguments);
16767       return value === source ? target : value;
16768     };
16769   }
16770   var init_rebind = __esm({
16771     "modules/util/rebind.js"() {
16772       "use strict";
16773     }
16774   });
16775
16776   // modules/util/session_mutex.js
16777   var session_mutex_exports = {};
16778   __export(session_mutex_exports, {
16779     utilSessionMutex: () => utilSessionMutex
16780   });
16781   function utilSessionMutex(name) {
16782     var mutex = {};
16783     var intervalID;
16784     function renew() {
16785       if (typeof window === "undefined") return;
16786       var expires = /* @__PURE__ */ new Date();
16787       expires.setSeconds(expires.getSeconds() + 5);
16788       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
16789     }
16790     mutex.lock = function() {
16791       if (intervalID) return true;
16792       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
16793       if (cookie) return false;
16794       renew();
16795       intervalID = window.setInterval(renew, 4e3);
16796       return true;
16797     };
16798     mutex.unlock = function() {
16799       if (!intervalID) return;
16800       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
16801       clearInterval(intervalID);
16802       intervalID = null;
16803     };
16804     mutex.locked = function() {
16805       return !!intervalID;
16806     };
16807     return mutex;
16808   }
16809   var init_session_mutex = __esm({
16810     "modules/util/session_mutex.js"() {
16811       "use strict";
16812     }
16813   });
16814
16815   // modules/util/tiler.js
16816   var tiler_exports = {};
16817   __export(tiler_exports, {
16818     utilTiler: () => utilTiler
16819   });
16820   function utilTiler() {
16821     var _size = [256, 256];
16822     var _scale = 256;
16823     var _tileSize = 256;
16824     var _zoomExtent = [0, 20];
16825     var _translate = [_size[0] / 2, _size[1] / 2];
16826     var _margin = 0;
16827     var _skipNullIsland = false;
16828     function nearNullIsland(tile) {
16829       var x2 = tile[0];
16830       var y2 = tile[1];
16831       var z3 = tile[2];
16832       if (z3 >= 7) {
16833         var center = Math.pow(2, z3 - 1);
16834         var width = Math.pow(2, z3 - 6);
16835         var min3 = center - width / 2;
16836         var max3 = center + width / 2 - 1;
16837         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
16838       }
16839       return false;
16840     }
16841     function tiler8() {
16842       var z3 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
16843       var z0 = clamp_default(Math.round(z3), _zoomExtent[0], _zoomExtent[1]);
16844       var tileMin = 0;
16845       var tileMax = Math.pow(2, z0) - 1;
16846       var log2ts = Math.log(_tileSize) * Math.LOG2E;
16847       var k3 = Math.pow(2, z3 - z0 + log2ts);
16848       var origin = [
16849         (_translate[0] - _scale / 2) / k3,
16850         (_translate[1] - _scale / 2) / k3
16851       ];
16852       var cols = range(
16853         clamp_default(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
16854         clamp_default(Math.ceil(_size[0] / k3 - origin[0]) + _margin, tileMin, tileMax + 1)
16855       );
16856       var rows = range(
16857         clamp_default(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
16858         clamp_default(Math.ceil(_size[1] / k3 - origin[1]) + _margin, tileMin, tileMax + 1)
16859       );
16860       var tiles = [];
16861       for (var i3 = 0; i3 < rows.length; i3++) {
16862         var y2 = rows[i3];
16863         for (var j3 = 0; j3 < cols.length; j3++) {
16864           var x2 = cols[j3];
16865           if (i3 >= _margin && i3 <= rows.length - _margin && j3 >= _margin && j3 <= cols.length - _margin) {
16866             tiles.unshift([x2, y2, z0]);
16867           } else {
16868             tiles.push([x2, y2, z0]);
16869           }
16870         }
16871       }
16872       tiles.translate = origin;
16873       tiles.scale = k3;
16874       return tiles;
16875     }
16876     tiler8.getTiles = function(projection2) {
16877       var origin = [
16878         projection2.scale() * Math.PI - projection2.translate()[0],
16879         projection2.scale() * Math.PI - projection2.translate()[1]
16880       ];
16881       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
16882       var tiles = tiler8();
16883       var ts = tiles.scale;
16884       return tiles.map(function(tile) {
16885         if (_skipNullIsland && nearNullIsland(tile)) {
16886           return false;
16887         }
16888         var x2 = tile[0] * ts - origin[0];
16889         var y2 = tile[1] * ts - origin[1];
16890         return {
16891           id: tile.toString(),
16892           xyz: tile,
16893           extent: geoExtent(
16894             projection2.invert([x2, y2 + ts]),
16895             projection2.invert([x2 + ts, y2])
16896           )
16897         };
16898       }).filter(Boolean);
16899     };
16900     tiler8.getGeoJSON = function(projection2) {
16901       var features = tiler8.getTiles(projection2).map(function(tile) {
16902         return {
16903           type: "Feature",
16904           properties: {
16905             id: tile.id,
16906             name: tile.id
16907           },
16908           geometry: {
16909             type: "Polygon",
16910             coordinates: [tile.extent.polygon()]
16911           }
16912         };
16913       });
16914       return {
16915         type: "FeatureCollection",
16916         features
16917       };
16918     };
16919     tiler8.tileSize = function(val) {
16920       if (!arguments.length) return _tileSize;
16921       _tileSize = val;
16922       return tiler8;
16923     };
16924     tiler8.zoomExtent = function(val) {
16925       if (!arguments.length) return _zoomExtent;
16926       _zoomExtent = val;
16927       return tiler8;
16928     };
16929     tiler8.size = function(val) {
16930       if (!arguments.length) return _size;
16931       _size = val;
16932       return tiler8;
16933     };
16934     tiler8.scale = function(val) {
16935       if (!arguments.length) return _scale;
16936       _scale = val;
16937       return tiler8;
16938     };
16939     tiler8.translate = function(val) {
16940       if (!arguments.length) return _translate;
16941       _translate = val;
16942       return tiler8;
16943     };
16944     tiler8.margin = function(val) {
16945       if (!arguments.length) return _margin;
16946       _margin = +val;
16947       return tiler8;
16948     };
16949     tiler8.skipNullIsland = function(val) {
16950       if (!arguments.length) return _skipNullIsland;
16951       _skipNullIsland = val;
16952       return tiler8;
16953     };
16954     return tiler8;
16955   }
16956   var init_tiler = __esm({
16957     "modules/util/tiler.js"() {
16958       "use strict";
16959       init_src();
16960       init_lodash();
16961       init_geo2();
16962     }
16963   });
16964
16965   // modules/util/trigger_event.js
16966   var trigger_event_exports = {};
16967   __export(trigger_event_exports, {
16968     utilTriggerEvent: () => utilTriggerEvent
16969   });
16970   function utilTriggerEvent(target, type2, eventProperties) {
16971     target.each(function() {
16972       var evt = document.createEvent("HTMLEvents");
16973       evt.initEvent(type2, true, true);
16974       for (var prop in eventProperties) {
16975         evt[prop] = eventProperties[prop];
16976       }
16977       this.dispatchEvent(evt);
16978     });
16979   }
16980   var init_trigger_event = __esm({
16981     "modules/util/trigger_event.js"() {
16982       "use strict";
16983     }
16984   });
16985
16986   // modules/util/units.js
16987   var units_exports = {};
16988   __export(units_exports, {
16989     decimalCoordinatePair: () => decimalCoordinatePair,
16990     displayArea: () => displayArea,
16991     displayLength: () => displayLength,
16992     dmsCoordinatePair: () => dmsCoordinatePair,
16993     dmsMatcher: () => dmsMatcher
16994   });
16995   function displayLength(m3, isImperial) {
16996     var d2 = m3 * (isImperial ? 3.28084 : 1);
16997     var unit2;
16998     if (isImperial) {
16999       if (d2 >= 5280) {
17000         d2 /= 5280;
17001         unit2 = "miles";
17002       } else {
17003         unit2 = "feet";
17004       }
17005     } else {
17006       if (d2 >= 1e3) {
17007         d2 /= 1e3;
17008         unit2 = "kilometers";
17009       } else {
17010         unit2 = "meters";
17011       }
17012     }
17013     return _t("units." + unit2, {
17014       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
17015         maximumSignificantDigits: 4
17016       })
17017     });
17018   }
17019   function displayArea(m22, isImperial) {
17020     var locale3 = _mainLocalizer.localeCode();
17021     var d2 = m22 * (isImperial ? 10.7639111056 : 1);
17022     var d1, d22, area;
17023     var unit1 = "";
17024     var unit2 = "";
17025     if (isImperial) {
17026       if (d2 >= 6969600) {
17027         d1 = d2 / 27878400;
17028         unit1 = "square_miles";
17029       } else {
17030         d1 = d2;
17031         unit1 = "square_feet";
17032       }
17033       if (d2 > 4356 && d2 < 4356e4) {
17034         d22 = d2 / 43560;
17035         unit2 = "acres";
17036       }
17037     } else {
17038       if (d2 >= 25e4) {
17039         d1 = d2 / 1e6;
17040         unit1 = "square_kilometers";
17041       } else {
17042         d1 = d2;
17043         unit1 = "square_meters";
17044       }
17045       if (d2 > 1e3 && d2 < 1e7) {
17046         d22 = d2 / 1e4;
17047         unit2 = "hectares";
17048       }
17049     }
17050     area = _t("units." + unit1, {
17051       quantity: d1.toLocaleString(locale3, {
17052         maximumSignificantDigits: 4
17053       })
17054     });
17055     if (d22) {
17056       return _t("units.area_pair", {
17057         area1: area,
17058         area2: _t("units." + unit2, {
17059           quantity: d22.toLocaleString(locale3, {
17060             maximumSignificantDigits: 2
17061           })
17062         })
17063       });
17064     } else {
17065       return area;
17066     }
17067   }
17068   function wrap(x2, min3, max3) {
17069     var d2 = max3 - min3;
17070     return ((x2 - min3) % d2 + d2) % d2 + min3;
17071   }
17072   function roundToDecimal(target, decimalPlace) {
17073     target = Number(target);
17074     decimalPlace = Number(decimalPlace);
17075     const factor = Math.pow(10, decimalPlace);
17076     return Math.round(target * factor) / factor;
17077   }
17078   function displayCoordinate(deg, pos, neg) {
17079     var displayCoordinate2;
17080     var locale3 = _mainLocalizer.localeCode();
17081     var degreesFloor = Math.floor(Math.abs(deg));
17082     var min3 = (Math.abs(deg) - degreesFloor) * 60;
17083     var minFloor = Math.floor(min3);
17084     var sec = (min3 - minFloor) * 60;
17085     var fix = roundToDecimal(sec, 8);
17086     var secRounded = roundToDecimal(fix, 0);
17087     if (secRounded === 60) {
17088       secRounded = 0;
17089       minFloor += 1;
17090       if (minFloor === 60) {
17091         minFloor = 0;
17092         degreesFloor += 1;
17093       }
17094     }
17095     displayCoordinate2 = _t("units.arcdegrees", {
17096       quantity: degreesFloor.toLocaleString(locale3)
17097     }) + (minFloor !== 0 || secRounded !== 0 ? _t("units.arcminutes", {
17098       quantity: minFloor.toLocaleString(locale3)
17099     }) : "") + (secRounded !== 0 ? _t("units.arcseconds", {
17100       quantity: secRounded.toLocaleString(locale3)
17101     }) : "");
17102     if (deg === 0) {
17103       return displayCoordinate2;
17104     } else {
17105       return _t("units.coordinate", {
17106         coordinate: displayCoordinate2,
17107         direction: _t("units." + (deg > 0 ? pos : neg))
17108       });
17109     }
17110   }
17111   function dmsCoordinatePair(coord2) {
17112     return _t("units.coordinate_pair", {
17113       latitude: displayCoordinate(clamp_default(coord2[1], -90, 90), "north", "south"),
17114       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
17115     });
17116   }
17117   function decimalCoordinatePair(coord2) {
17118     return _t("units.coordinate_pair", {
17119       latitude: clamp_default(coord2[1], -90, 90).toFixed(OSM_PRECISION),
17120       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
17121     });
17122   }
17123   function dmsMatcher(q3, _localeCode = void 0) {
17124     const matchers = [
17125       // D M SS , D M SS  ex: 35 11 10.1 , 136 49 53.8
17126       {
17127         condition: /^\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*$/,
17128         parser: function(q4) {
17129           const match = this.condition.exec(q4);
17130           const lat = +match[2] + +match[3] / 60 + +match[4] / 3600;
17131           const lng = +match[6] + +match[7] / 60 + +match[8] / 3600;
17132           const isNegLat = match[1] === "-" ? -lat : lat;
17133           const isNegLng = match[5] === "-" ? -lng : lng;
17134           return [isNegLat, isNegLng];
17135         }
17136       },
17137       // D MM , D MM ex: 35 11.1683 , 136 49.8966
17138       {
17139         condition: /^\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*$/,
17140         parser: function(q4) {
17141           const match = this.condition.exec(q4);
17142           const lat = +match[2] + +match[3] / 60;
17143           const lng = +match[5] + +match[6] / 60;
17144           const isNegLat = match[1] === "-" ? -lat : lat;
17145           const isNegLng = match[4] === "-" ? -lng : lng;
17146           return [isNegLat, isNegLng];
17147         }
17148       },
17149       // D/D ex: 46.112785/72.921033
17150       {
17151         condition: /^\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
17152         parser: function(q4) {
17153           const match = this.condition.exec(q4);
17154           return [+match[1], +match[2]];
17155         }
17156       },
17157       // zoom/x/y ex: 2/1.23/34.44
17158       {
17159         condition: /^\s*(\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
17160         parser: function(q4) {
17161           const match = this.condition.exec(q4);
17162           const lat = +match[2];
17163           const lng = +match[3];
17164           const zoom = +match[1];
17165           return [lat, lng, zoom];
17166         }
17167       },
17168       // x/y , x, y , x y  where x and y are localized floats, e.g. in German locale: 49,4109399, 8,7147086
17169       {
17170         condition: { test: (q4) => !!localizedNumberCoordsParser(q4) },
17171         parser: localizedNumberCoordsParser
17172       }
17173     ];
17174     function localizedNumberCoordsParser(q4) {
17175       const parseLocaleFloat = _mainLocalizer.floatParser(_localeCode || _mainLocalizer.localeCode());
17176       let parts = q4.split(/,?\s+|\s*[\/\\]\s*/);
17177       if (parts.length !== 2) return false;
17178       const lat = parseLocaleFloat(parts[0]);
17179       const lng = parseLocaleFloat(parts[1]);
17180       if (isNaN(lat) || isNaN(lng)) return false;
17181       return [lat, lng];
17182     }
17183     for (const matcher of matchers) {
17184       if (matcher.condition.test(q3)) {
17185         return matcher.parser(q3);
17186       }
17187     }
17188     return null;
17189   }
17190   var OSM_PRECISION;
17191   var init_units = __esm({
17192     "modules/util/units.js"() {
17193       "use strict";
17194       init_lodash();
17195       init_localizer();
17196       OSM_PRECISION = 7;
17197     }
17198   });
17199
17200   // modules/util/index.js
17201   var util_exports = {};
17202   __export(util_exports, {
17203     dmsCoordinatePair: () => dmsCoordinatePair,
17204     dmsMatcher: () => dmsMatcher,
17205     utilAesDecrypt: () => utilAesDecrypt,
17206     utilAesEncrypt: () => utilAesEncrypt,
17207     utilArrayChunk: () => utilArrayChunk,
17208     utilArrayDifference: () => utilArrayDifference,
17209     utilArrayFlatten: () => utilArrayFlatten,
17210     utilArrayGroupBy: () => utilArrayGroupBy,
17211     utilArrayIdentical: () => utilArrayIdentical,
17212     utilArrayIntersection: () => utilArrayIntersection,
17213     utilArrayUnion: () => utilArrayUnion,
17214     utilArrayUniq: () => utilArrayUniq,
17215     utilArrayUniqBy: () => utilArrayUniqBy,
17216     utilAsyncMap: () => utilAsyncMap,
17217     utilCheckTagDictionary: () => utilCheckTagDictionary,
17218     utilCleanOsmString: () => utilCleanOsmString,
17219     utilCleanTags: () => utilCleanTags,
17220     utilCombinedTags: () => utilCombinedTags,
17221     utilCompareIDs: () => utilCompareIDs,
17222     utilDeepMemberSelector: () => utilDeepMemberSelector,
17223     utilDetect: () => utilDetect,
17224     utilDisplayName: () => utilDisplayName,
17225     utilDisplayNameForPath: () => utilDisplayNameForPath,
17226     utilDisplayType: () => utilDisplayType,
17227     utilEditDistance: () => utilEditDistance,
17228     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
17229     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
17230     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
17231     utilEntityRoot: () => utilEntityRoot,
17232     utilEntitySelector: () => utilEntitySelector,
17233     utilFastMouse: () => utilFastMouse,
17234     utilFunctor: () => utilFunctor,
17235     utilGetAllNodes: () => utilGetAllNodes,
17236     utilGetSetValue: () => utilGetSetValue,
17237     utilHashcode: () => utilHashcode,
17238     utilHighlightEntities: () => utilHighlightEntities,
17239     utilKeybinding: () => utilKeybinding,
17240     utilNoAuto: () => utilNoAuto,
17241     utilObjectOmit: () => utilObjectOmit,
17242     utilOldestID: () => utilOldestID,
17243     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
17244     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
17245     utilQsString: () => utilQsString,
17246     utilRebind: () => utilRebind,
17247     utilSafeClassName: () => utilSafeClassName,
17248     utilSessionMutex: () => utilSessionMutex,
17249     utilSetTransform: () => utilSetTransform,
17250     utilStringQs: () => utilStringQs,
17251     utilTagDiff: () => utilTagDiff,
17252     utilTagText: () => utilTagText,
17253     utilTiler: () => utilTiler,
17254     utilTotalExtent: () => utilTotalExtent,
17255     utilTriggerEvent: () => utilTriggerEvent,
17256     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
17257     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
17258     utilUniqueDomId: () => utilUniqueDomId,
17259     utilWrap: () => utilWrap
17260   });
17261   var init_util = __esm({
17262     "modules/util/index.js"() {
17263       "use strict";
17264       init_aes();
17265       init_aes();
17266       init_array3();
17267       init_array3();
17268       init_array3();
17269       init_array3();
17270       init_array3();
17271       init_array3();
17272       init_array3();
17273       init_array3();
17274       init_array3();
17275       init_util2();
17276       init_clean_tags();
17277       init_util2();
17278       init_util2();
17279       init_detect();
17280       init_util2();
17281       init_util2();
17282       init_util2();
17283       init_util2();
17284       init_util2();
17285       init_util2();
17286       init_util2();
17287       init_util2();
17288       init_util2();
17289       init_util2();
17290       init_util2();
17291       init_util2();
17292       init_get_set_value();
17293       init_util2();
17294       init_util2();
17295       init_keybinding();
17296       init_util2();
17297       init_object2();
17298       init_util2();
17299       init_util2();
17300       init_util2();
17301       init_util2();
17302       init_util2();
17303       init_rebind();
17304       init_util2();
17305       init_util2();
17306       init_session_mutex();
17307       init_util2();
17308       init_util2();
17309       init_util2();
17310       init_tiler();
17311       init_util2();
17312       init_trigger_event();
17313       init_util2();
17314       init_util2();
17315       init_util2();
17316       init_util2();
17317       init_util2();
17318       init_units();
17319       init_units();
17320     }
17321   });
17322
17323   // modules/actions/add_midpoint.js
17324   var add_midpoint_exports = {};
17325   __export(add_midpoint_exports, {
17326     actionAddMidpoint: () => actionAddMidpoint
17327   });
17328   function actionAddMidpoint(midpoint, node) {
17329     return function(graph) {
17330       graph = graph.replace(node.move(midpoint.loc));
17331       var parents = utilArrayIntersection(
17332         graph.parentWays(graph.entity(midpoint.edge[0])),
17333         graph.parentWays(graph.entity(midpoint.edge[1]))
17334       );
17335       parents.forEach(function(way) {
17336         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
17337           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
17338             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
17339             return;
17340           }
17341         }
17342       });
17343       return graph;
17344     };
17345   }
17346   var init_add_midpoint = __esm({
17347     "modules/actions/add_midpoint.js"() {
17348       "use strict";
17349       init_geo2();
17350       init_util();
17351     }
17352   });
17353
17354   // modules/actions/add_vertex.js
17355   var add_vertex_exports = {};
17356   __export(add_vertex_exports, {
17357     actionAddVertex: () => actionAddVertex
17358   });
17359   function actionAddVertex(wayId, nodeId, index) {
17360     return function(graph) {
17361       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
17362     };
17363   }
17364   var init_add_vertex = __esm({
17365     "modules/actions/add_vertex.js"() {
17366       "use strict";
17367     }
17368   });
17369
17370   // modules/actions/change_member.js
17371   var change_member_exports = {};
17372   __export(change_member_exports, {
17373     actionChangeMember: () => actionChangeMember
17374   });
17375   function actionChangeMember(relationId, member, memberIndex) {
17376     return function(graph) {
17377       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
17378     };
17379   }
17380   var init_change_member = __esm({
17381     "modules/actions/change_member.js"() {
17382       "use strict";
17383     }
17384   });
17385
17386   // modules/actions/change_preset.js
17387   var change_preset_exports = {};
17388   __export(change_preset_exports, {
17389     actionChangePreset: () => actionChangePreset
17390   });
17391   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
17392     return function action(graph) {
17393       var entity = graph.entity(entityID);
17394       var geometry = entity.geometry(graph);
17395       var tags = entity.tags;
17396       const loc = entity.extent(graph).center();
17397       var preserveKeys;
17398       if (newPreset) {
17399         preserveKeys = [];
17400         if (newPreset.addTags) {
17401           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
17402         }
17403         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
17404           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
17405         }
17406       }
17407       if (oldPreset) tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
17408       if (newPreset) tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
17409       return graph.replace(entity.update({ tags }));
17410     };
17411   }
17412   var init_change_preset = __esm({
17413     "modules/actions/change_preset.js"() {
17414       "use strict";
17415     }
17416   });
17417
17418   // modules/actions/change_tags.js
17419   var change_tags_exports = {};
17420   __export(change_tags_exports, {
17421     actionChangeTags: () => actionChangeTags
17422   });
17423   function actionChangeTags(entityId, tags) {
17424     return function(graph) {
17425       var entity = graph.entity(entityId);
17426       return graph.replace(entity.update({ tags }));
17427     };
17428   }
17429   var init_change_tags = __esm({
17430     "modules/actions/change_tags.js"() {
17431       "use strict";
17432     }
17433   });
17434
17435   // modules/osm/node.js
17436   var node_exports = {};
17437   __export(node_exports, {
17438     cardinal: () => cardinal,
17439     osmNode: () => osmNode
17440   });
17441   function osmNode() {
17442     if (!(this instanceof osmNode)) {
17443       return new osmNode().initialize(arguments);
17444     } else if (arguments.length) {
17445       this.initialize(arguments);
17446     }
17447   }
17448   var cardinal, prototype;
17449   var init_node2 = __esm({
17450     "modules/osm/node.js"() {
17451       "use strict";
17452       init_entity();
17453       init_geo2();
17454       init_util();
17455       init_tags();
17456       cardinal = {
17457         north: 0,
17458         n: 0,
17459         northnortheast: 22,
17460         nne: 22,
17461         northeast: 45,
17462         ne: 45,
17463         eastnortheast: 67,
17464         ene: 67,
17465         east: 90,
17466         e: 90,
17467         eastsoutheast: 112,
17468         ese: 112,
17469         southeast: 135,
17470         se: 135,
17471         southsoutheast: 157,
17472         sse: 157,
17473         south: 180,
17474         s: 180,
17475         southsouthwest: 202,
17476         ssw: 202,
17477         southwest: 225,
17478         sw: 225,
17479         westsouthwest: 247,
17480         wsw: 247,
17481         west: 270,
17482         w: 270,
17483         westnorthwest: 292,
17484         wnw: 292,
17485         northwest: 315,
17486         nw: 315,
17487         northnorthwest: 337,
17488         nnw: 337
17489       };
17490       osmEntity.node = osmNode;
17491       osmNode.prototype = Object.create(osmEntity.prototype);
17492       prototype = {
17493         type: "node",
17494         loc: [9999, 9999],
17495         extent: function() {
17496           return new geoExtent(this.loc);
17497         },
17498         geometry: function(graph) {
17499           return graph.transient(this, "geometry", function() {
17500             return graph.isPoi(this) ? "point" : "vertex";
17501           });
17502         },
17503         move: function(loc) {
17504           return this.update({ loc });
17505         },
17506         isDegenerate: function() {
17507           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);
17508         },
17509         // Inspect tags and geometry to determine which direction(s) this node/vertex points
17510         directions: function(resolver, projection2) {
17511           var val;
17512           var i3;
17513           if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
17514             val = "all";
17515           } else {
17516             val = (this.tags.direction || "").toLowerCase();
17517             var re4 = /:direction$/i;
17518             var keys2 = Object.keys(this.tags);
17519             for (i3 = 0; i3 < keys2.length; i3++) {
17520               if (re4.test(keys2[i3])) {
17521                 val = this.tags[keys2[i3]].toLowerCase();
17522                 break;
17523               }
17524             }
17525           }
17526           if (val === "") return [];
17527           var values = val.split(";");
17528           var results = [];
17529           values.forEach(function(v3) {
17530             if (cardinal[v3] !== void 0) {
17531               v3 = cardinal[v3];
17532             }
17533             if (v3 !== "" && !isNaN(+v3)) {
17534               results.push(+v3);
17535               return;
17536             }
17537             var lookBackward = this.tags["traffic_sign:backward"] || v3 === "backward" || v3 === "both" || v3 === "all";
17538             var lookForward = this.tags["traffic_sign:forward"] || v3 === "forward" || v3 === "both" || v3 === "all";
17539             if (!lookForward && !lookBackward) return;
17540             var nodeIds = {};
17541             resolver.parentWays(this).filter((way) => osmShouldRenderDirection(this.tags, way.tags)).forEach(function(parent2) {
17542               var nodes = parent2.nodes;
17543               for (i3 = 0; i3 < nodes.length; i3++) {
17544                 if (nodes[i3] === this.id) {
17545                   if (lookForward && i3 > 0) {
17546                     nodeIds[nodes[i3 - 1]] = true;
17547                   }
17548                   if (lookBackward && i3 < nodes.length - 1) {
17549                     nodeIds[nodes[i3 + 1]] = true;
17550                   }
17551                 }
17552               }
17553             }, this);
17554             Object.keys(nodeIds).forEach(function(nodeId) {
17555               results.push(
17556                 geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
17557               );
17558             }, this);
17559           }, this);
17560           return utilArrayUniq(results);
17561         },
17562         isCrossing: function() {
17563           return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
17564         },
17565         isEndpoint: function(resolver) {
17566           return resolver.transient(this, "isEndpoint", function() {
17567             var id2 = this.id;
17568             return resolver.parentWays(this).filter(function(parent2) {
17569               return !parent2.isClosed() && !!parent2.affix(id2);
17570             }).length > 0;
17571           });
17572         },
17573         isConnected: function(resolver) {
17574           return resolver.transient(this, "isConnected", function() {
17575             var parents = resolver.parentWays(this);
17576             if (parents.length > 1) {
17577               for (var i3 in parents) {
17578                 if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags()) return true;
17579               }
17580             } else if (parents.length === 1) {
17581               var way = parents[0];
17582               var nodes = way.nodes.slice();
17583               if (way.isClosed()) {
17584                 nodes.pop();
17585               }
17586               return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
17587             }
17588             return false;
17589           });
17590         },
17591         parentIntersectionWays: function(resolver) {
17592           return resolver.transient(this, "parentIntersectionWays", function() {
17593             return resolver.parentWays(this).filter(function(parent2) {
17594               return (parent2.tags.highway || parent2.tags.waterway || parent2.tags.railway || parent2.tags.aeroway) && parent2.geometry(resolver) === "line";
17595             });
17596           });
17597         },
17598         isIntersection: function(resolver) {
17599           return this.parentIntersectionWays(resolver).length > 1;
17600         },
17601         isHighwayIntersection: function(resolver) {
17602           return resolver.transient(this, "isHighwayIntersection", function() {
17603             return resolver.parentWays(this).filter(function(parent2) {
17604               return parent2.tags.highway && parent2.geometry(resolver) === "line";
17605             }).length > 1;
17606           });
17607         },
17608         isOnAddressLine: function(resolver) {
17609           return resolver.transient(this, "isOnAddressLine", function() {
17610             return resolver.parentWays(this).filter(function(parent2) {
17611               return parent2.tags.hasOwnProperty("addr:interpolation") && parent2.geometry(resolver) === "line";
17612             }).length > 0;
17613           });
17614         },
17615         asJXON: function(changeset_id) {
17616           var r2 = {
17617             node: {
17618               "@id": this.osmId(),
17619               "@lon": this.loc[0],
17620               "@lat": this.loc[1],
17621               "@version": this.version || 0,
17622               tag: Object.keys(this.tags).map(function(k3) {
17623                 return { keyAttributes: { k: k3, v: this.tags[k3] } };
17624               }, this)
17625             }
17626           };
17627           if (changeset_id) r2.node["@changeset"] = changeset_id;
17628           return r2;
17629         },
17630         asGeoJSON: function() {
17631           return {
17632             type: "Point",
17633             coordinates: this.loc
17634           };
17635         }
17636       };
17637       Object.assign(osmNode.prototype, prototype);
17638     }
17639   });
17640
17641   // modules/actions/circularize.js
17642   var circularize_exports = {};
17643   __export(circularize_exports, {
17644     actionCircularize: () => actionCircularize
17645   });
17646   function actionCircularize(wayId, projection2, maxAngle) {
17647     maxAngle = (maxAngle || 20) * Math.PI / 180;
17648     var action = function(graph, t2) {
17649       if (t2 === null || !isFinite(t2)) t2 = 1;
17650       t2 = Math.min(Math.max(+t2, 0), 1);
17651       var way = graph.entity(wayId);
17652       var origNodes = {};
17653       graph.childNodes(way).forEach(function(node2) {
17654         if (!origNodes[node2.id]) origNodes[node2.id] = node2;
17655       });
17656       if (!way.isConvex(graph)) {
17657         graph = action.makeConvex(graph);
17658       }
17659       var nodes = utilArrayUniq(graph.childNodes(way));
17660       var keyNodes = nodes.filter(function(n3) {
17661         return graph.parentWays(n3).length !== 1;
17662       });
17663       var points = nodes.map(function(n3) {
17664         return projection2(n3.loc);
17665       });
17666       var keyPoints = keyNodes.map(function(n3) {
17667         return projection2(n3.loc);
17668       });
17669       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
17670       var radius = median(points, function(p2) {
17671         return geoVecLength(centroid, p2);
17672       });
17673       var sign2 = area_default3(points) > 0 ? 1 : -1;
17674       var ids, i3, j3, k3;
17675       if (!keyNodes.length) {
17676         keyNodes = [nodes[0]];
17677         keyPoints = [points[0]];
17678       }
17679       if (keyNodes.length === 1) {
17680         var index = nodes.indexOf(keyNodes[0]);
17681         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
17682         keyNodes.push(nodes[oppositeIndex]);
17683         keyPoints.push(points[oppositeIndex]);
17684       }
17685       for (i3 = 0; i3 < keyPoints.length; i3++) {
17686         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
17687         var startNode = keyNodes[i3];
17688         var endNode = keyNodes[nextKeyNodeIndex];
17689         var startNodeIndex = nodes.indexOf(startNode);
17690         var endNodeIndex = nodes.indexOf(endNode);
17691         var numberNewPoints = -1;
17692         var indexRange = endNodeIndex - startNodeIndex;
17693         var nearNodes = {};
17694         var inBetweenNodes = [];
17695         var startAngle, endAngle, totalAngle, eachAngle;
17696         var angle2, loc, node, origNode;
17697         if (indexRange < 0) {
17698           indexRange += nodes.length;
17699         }
17700         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
17701         keyPoints[i3] = [
17702           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
17703           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
17704         ];
17705         loc = projection2.invert(keyPoints[i3]);
17706         node = keyNodes[i3];
17707         origNode = origNodes[node.id];
17708         node = node.move(geoVecInterp(origNode.loc, loc, t2));
17709         graph = graph.replace(node);
17710         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
17711         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
17712         totalAngle = endAngle - startAngle;
17713         if (totalAngle * sign2 > 0) {
17714           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
17715         }
17716         do {
17717           numberNewPoints++;
17718           eachAngle = totalAngle / (indexRange + numberNewPoints);
17719         } while (Math.abs(eachAngle) > maxAngle);
17720         for (j3 = 1; j3 < indexRange; j3++) {
17721           angle2 = startAngle + j3 * eachAngle;
17722           loc = projection2.invert([
17723             centroid[0] + Math.cos(angle2) * radius,
17724             centroid[1] + Math.sin(angle2) * radius
17725           ]);
17726           node = nodes[(j3 + startNodeIndex) % nodes.length];
17727           origNode = origNodes[node.id];
17728           nearNodes[node.id] = angle2;
17729           node = node.move(geoVecInterp(origNode.loc, loc, t2));
17730           graph = graph.replace(node);
17731         }
17732         for (j3 = 0; j3 < numberNewPoints; j3++) {
17733           angle2 = startAngle + (indexRange + j3) * eachAngle;
17734           loc = projection2.invert([
17735             centroid[0] + Math.cos(angle2) * radius,
17736             centroid[1] + Math.sin(angle2) * radius
17737           ]);
17738           var min3 = Infinity;
17739           for (var nodeId in nearNodes) {
17740             var nearAngle = nearNodes[nodeId];
17741             var dist = Math.abs(nearAngle - angle2);
17742             if (dist < min3) {
17743               min3 = dist;
17744               origNode = origNodes[nodeId];
17745             }
17746           }
17747           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
17748           graph = graph.replace(node);
17749           nodes.splice(endNodeIndex + j3, 0, node);
17750           inBetweenNodes.push(node.id);
17751         }
17752         if (indexRange === 1 && inBetweenNodes.length) {
17753           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
17754           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
17755           var wayDirection1 = endIndex1 - startIndex1;
17756           if (wayDirection1 < -1) {
17757             wayDirection1 = 1;
17758           }
17759           var parentWays = graph.parentWays(keyNodes[i3]);
17760           for (j3 = 0; j3 < parentWays.length; j3++) {
17761             var sharedWay = parentWays[j3];
17762             if (sharedWay === way) continue;
17763             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
17764               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
17765               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
17766               var wayDirection2 = endIndex2 - startIndex2;
17767               var insertAt = endIndex2;
17768               if (wayDirection2 < -1) {
17769                 wayDirection2 = 1;
17770               }
17771               if (wayDirection1 !== wayDirection2) {
17772                 inBetweenNodes.reverse();
17773                 insertAt = startIndex2;
17774               }
17775               for (k3 = 0; k3 < inBetweenNodes.length; k3++) {
17776                 sharedWay = sharedWay.addNode(inBetweenNodes[k3], insertAt + k3);
17777               }
17778               graph = graph.replace(sharedWay);
17779             }
17780           }
17781         }
17782       }
17783       ids = nodes.map(function(n3) {
17784         return n3.id;
17785       });
17786       ids.push(ids[0]);
17787       way = way.update({ nodes: ids });
17788       graph = graph.replace(way);
17789       return graph;
17790     };
17791     action.makeConvex = function(graph) {
17792       var way = graph.entity(wayId);
17793       var nodes = utilArrayUniq(graph.childNodes(way));
17794       var points = nodes.map(function(n3) {
17795         return projection2(n3.loc);
17796       });
17797       var sign2 = area_default3(points) > 0 ? 1 : -1;
17798       var hull = hull_default(points);
17799       var i3, j3;
17800       if (sign2 === -1) {
17801         nodes.reverse();
17802         points.reverse();
17803       }
17804       for (i3 = 0; i3 < hull.length - 1; i3++) {
17805         var startIndex = points.indexOf(hull[i3]);
17806         var endIndex = points.indexOf(hull[i3 + 1]);
17807         var indexRange = endIndex - startIndex;
17808         if (indexRange < 0) {
17809           indexRange += nodes.length;
17810         }
17811         for (j3 = 1; j3 < indexRange; j3++) {
17812           var point = geoVecInterp(hull[i3], hull[i3 + 1], j3 / indexRange);
17813           var node = nodes[(j3 + startIndex) % nodes.length].move(projection2.invert(point));
17814           graph = graph.replace(node);
17815         }
17816       }
17817       return graph;
17818     };
17819     action.disabled = function(graph) {
17820       if (!graph.entity(wayId).isClosed()) {
17821         return "not_closed";
17822       }
17823       var way = graph.entity(wayId);
17824       var nodes = utilArrayUniq(graph.childNodes(way));
17825       var points = nodes.map(function(n3) {
17826         return projection2(n3.loc);
17827       });
17828       var hull = hull_default(points);
17829       var epsilonAngle = Math.PI / 180;
17830       if (hull.length !== points.length || hull.length < 3) {
17831         return false;
17832       }
17833       var centroid = centroid_default2(points);
17834       var radius = geoVecLengthSquare(centroid, points[0]);
17835       var i3, actualPoint;
17836       for (i3 = 0; i3 < hull.length; i3++) {
17837         actualPoint = hull[i3];
17838         var actualDist = geoVecLengthSquare(actualPoint, centroid);
17839         var diff = Math.abs(actualDist - radius);
17840         if (diff > 0.05 * radius) {
17841           return false;
17842         }
17843       }
17844       for (i3 = 0; i3 < hull.length; i3++) {
17845         actualPoint = hull[i3];
17846         var nextPoint = hull[(i3 + 1) % hull.length];
17847         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
17848         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
17849         var angle2 = endAngle - startAngle;
17850         if (angle2 < 0) {
17851           angle2 = -angle2;
17852         }
17853         if (angle2 > Math.PI) {
17854           angle2 = 2 * Math.PI - angle2;
17855         }
17856         if (angle2 > maxAngle + epsilonAngle) {
17857           return false;
17858         }
17859       }
17860       return "already_circular";
17861     };
17862     action.transitionable = true;
17863     return action;
17864   }
17865   var init_circularize = __esm({
17866     "modules/actions/circularize.js"() {
17867       "use strict";
17868       init_src();
17869       init_src3();
17870       init_geo2();
17871       init_node2();
17872       init_util();
17873       init_vector();
17874     }
17875   });
17876
17877   // modules/actions/delete_way.js
17878   var delete_way_exports = {};
17879   __export(delete_way_exports, {
17880     actionDeleteWay: () => actionDeleteWay
17881   });
17882   function actionDeleteWay(wayID) {
17883     function canDeleteNode(node, graph) {
17884       if (graph.parentWays(node).length || graph.parentRelations(node).length) return false;
17885       var geometries = osmNodeGeometriesForTags(node.tags);
17886       if (geometries.point) return false;
17887       if (geometries.vertex) return true;
17888       return !node.hasInterestingTags();
17889     }
17890     var action = function(graph) {
17891       var way = graph.entity(wayID);
17892       graph.parentRelations(way).forEach(function(parent2) {
17893         parent2 = parent2.removeMembersWithID(wayID);
17894         graph = graph.replace(parent2);
17895         if (parent2.isDegenerate()) {
17896           graph = actionDeleteRelation(parent2.id)(graph);
17897         }
17898       });
17899       new Set(way.nodes).forEach(function(nodeID) {
17900         graph = graph.replace(way.removeNode(nodeID));
17901         var node = graph.entity(nodeID);
17902         if (canDeleteNode(node, graph)) {
17903           graph = graph.remove(node);
17904         }
17905       });
17906       return graph.remove(way);
17907     };
17908     return action;
17909   }
17910   var init_delete_way = __esm({
17911     "modules/actions/delete_way.js"() {
17912       "use strict";
17913       init_tags();
17914       init_delete_relation();
17915     }
17916   });
17917
17918   // modules/actions/delete_multiple.js
17919   var delete_multiple_exports = {};
17920   __export(delete_multiple_exports, {
17921     actionDeleteMultiple: () => actionDeleteMultiple
17922   });
17923   function actionDeleteMultiple(ids) {
17924     var actions = {
17925       way: actionDeleteWay,
17926       node: actionDeleteNode,
17927       relation: actionDeleteRelation
17928     };
17929     var action = function(graph) {
17930       ids.forEach(function(id2) {
17931         if (graph.hasEntity(id2)) {
17932           graph = actions[graph.entity(id2).type](id2)(graph);
17933         }
17934       });
17935       return graph;
17936     };
17937     return action;
17938   }
17939   var init_delete_multiple = __esm({
17940     "modules/actions/delete_multiple.js"() {
17941       "use strict";
17942       init_delete_node();
17943       init_delete_relation();
17944       init_delete_way();
17945     }
17946   });
17947
17948   // modules/actions/delete_relation.js
17949   var delete_relation_exports = {};
17950   __export(delete_relation_exports, {
17951     actionDeleteRelation: () => actionDeleteRelation
17952   });
17953   function actionDeleteRelation(relationID, allowUntaggedMembers) {
17954     function canDeleteEntity(entity, graph) {
17955       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
17956     }
17957     var action = function(graph) {
17958       var relation = graph.entity(relationID);
17959       graph.parentRelations(relation).forEach(function(parent2) {
17960         parent2 = parent2.removeMembersWithID(relationID);
17961         graph = graph.replace(parent2);
17962         if (parent2.isDegenerate()) {
17963           graph = actionDeleteRelation(parent2.id)(graph);
17964         }
17965       });
17966       var memberIDs = utilArrayUniq(relation.members.map(function(m3) {
17967         return m3.id;
17968       }));
17969       memberIDs.forEach(function(memberID) {
17970         graph = graph.replace(relation.removeMembersWithID(memberID));
17971         var entity = graph.entity(memberID);
17972         if (canDeleteEntity(entity, graph)) {
17973           graph = actionDeleteMultiple([memberID])(graph);
17974         }
17975       });
17976       return graph.remove(relation);
17977     };
17978     return action;
17979   }
17980   var init_delete_relation = __esm({
17981     "modules/actions/delete_relation.js"() {
17982       "use strict";
17983       init_delete_multiple();
17984       init_util();
17985     }
17986   });
17987
17988   // modules/actions/delete_node.js
17989   var delete_node_exports = {};
17990   __export(delete_node_exports, {
17991     actionDeleteNode: () => actionDeleteNode
17992   });
17993   function actionDeleteNode(nodeId) {
17994     var action = function(graph) {
17995       var node = graph.entity(nodeId);
17996       graph.parentWays(node).forEach(function(parent2) {
17997         parent2 = parent2.removeNode(nodeId);
17998         graph = graph.replace(parent2);
17999         if (parent2.isDegenerate()) {
18000           graph = actionDeleteWay(parent2.id)(graph);
18001         }
18002       });
18003       graph.parentRelations(node).forEach(function(parent2) {
18004         parent2 = parent2.removeMembersWithID(nodeId);
18005         graph = graph.replace(parent2);
18006         if (parent2.isDegenerate()) {
18007           graph = actionDeleteRelation(parent2.id)(graph);
18008         }
18009       });
18010       return graph.remove(node);
18011     };
18012     return action;
18013   }
18014   var init_delete_node = __esm({
18015     "modules/actions/delete_node.js"() {
18016       "use strict";
18017       init_delete_relation();
18018       init_delete_way();
18019     }
18020   });
18021
18022   // modules/actions/connect.js
18023   var connect_exports = {};
18024   __export(connect_exports, {
18025     actionConnect: () => actionConnect
18026   });
18027   function actionConnect(nodeIDs) {
18028     var action = function(graph) {
18029       var survivor;
18030       var node;
18031       var parents;
18032       var i3, j3;
18033       nodeIDs.reverse();
18034       var interestingIDs = [];
18035       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18036         node = graph.entity(nodeIDs[i3]);
18037         if (node.hasInterestingTags()) {
18038           if (!node.isNew()) {
18039             interestingIDs.push(node.id);
18040           }
18041         }
18042       }
18043       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
18044       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18045         node = graph.entity(nodeIDs[i3]);
18046         if (node.id === survivor.id) continue;
18047         parents = graph.parentWays(node);
18048         for (j3 = 0; j3 < parents.length; j3++) {
18049           graph = graph.replace(parents[j3].replaceNode(node.id, survivor.id));
18050         }
18051         parents = graph.parentRelations(node);
18052         for (j3 = 0; j3 < parents.length; j3++) {
18053           graph = graph.replace(parents[j3].replaceMember(node, survivor));
18054         }
18055         survivor = survivor.mergeTags(node.tags);
18056         graph = actionDeleteNode(node.id)(graph);
18057       }
18058       graph = graph.replace(survivor);
18059       parents = graph.parentWays(survivor);
18060       for (i3 = 0; i3 < parents.length; i3++) {
18061         if (parents[i3].isDegenerate()) {
18062           graph = actionDeleteWay(parents[i3].id)(graph);
18063         }
18064       }
18065       return graph;
18066     };
18067     action.disabled = function(graph) {
18068       var seen = {};
18069       var restrictionIDs = [];
18070       var survivor;
18071       var node, way;
18072       var relations, relation, role;
18073       var i3, j3, k3;
18074       survivor = graph.entity(utilOldestID(nodeIDs));
18075       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18076         node = graph.entity(nodeIDs[i3]);
18077         relations = graph.parentRelations(node);
18078         for (j3 = 0; j3 < relations.length; j3++) {
18079           relation = relations[j3];
18080           role = relation.memberById(node.id).role || "";
18081           if (relation.hasFromViaTo()) {
18082             restrictionIDs.push(relation.id);
18083           }
18084           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
18085             return "relation";
18086           } else {
18087             seen[relation.id] = role;
18088           }
18089         }
18090       }
18091       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18092         node = graph.entity(nodeIDs[i3]);
18093         var parents = graph.parentWays(node);
18094         for (j3 = 0; j3 < parents.length; j3++) {
18095           var parent2 = parents[j3];
18096           relations = graph.parentRelations(parent2);
18097           for (k3 = 0; k3 < relations.length; k3++) {
18098             relation = relations[k3];
18099             if (relation.hasFromViaTo()) {
18100               restrictionIDs.push(relation.id);
18101             }
18102           }
18103         }
18104       }
18105       restrictionIDs = utilArrayUniq(restrictionIDs);
18106       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
18107         relation = graph.entity(restrictionIDs[i3]);
18108         if (!relation.isComplete(graph)) continue;
18109         var memberWays = relation.members.filter(function(m3) {
18110           return m3.type === "way";
18111         }).map(function(m3) {
18112           return graph.entity(m3.id);
18113         });
18114         memberWays = utilArrayUniq(memberWays);
18115         var f2 = relation.memberByRole("from");
18116         var t2 = relation.memberByRole("to");
18117         var isUturn = f2.id === t2.id;
18118         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
18119         for (j3 = 0; j3 < relation.members.length; j3++) {
18120           collectNodes(relation.members[j3], nodes);
18121         }
18122         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
18123         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
18124         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
18125         nodes.from = nodes.from.filter(filter2);
18126         nodes.via = nodes.via.filter(filter2);
18127         nodes.to = nodes.to.filter(filter2);
18128         var connectFrom = false;
18129         var connectVia = false;
18130         var connectTo = false;
18131         var connectKeyFrom = false;
18132         var connectKeyTo = false;
18133         for (j3 = 0; j3 < nodeIDs.length; j3++) {
18134           var n3 = nodeIDs[j3];
18135           if (nodes.from.indexOf(n3) !== -1) {
18136             connectFrom = true;
18137           }
18138           if (nodes.via.indexOf(n3) !== -1) {
18139             connectVia = true;
18140           }
18141           if (nodes.to.indexOf(n3) !== -1) {
18142             connectTo = true;
18143           }
18144           if (nodes.keyfrom.indexOf(n3) !== -1) {
18145             connectKeyFrom = true;
18146           }
18147           if (nodes.keyto.indexOf(n3) !== -1) {
18148             connectKeyTo = true;
18149           }
18150         }
18151         if (connectFrom && connectTo && !isUturn) {
18152           return "restriction";
18153         }
18154         if (connectFrom && connectVia) {
18155           return "restriction";
18156         }
18157         if (connectTo && connectVia) {
18158           return "restriction";
18159         }
18160         if (connectKeyFrom || connectKeyTo) {
18161           if (nodeIDs.length !== 2) {
18162             return "restriction";
18163           }
18164           var n0 = null;
18165           var n1 = null;
18166           for (j3 = 0; j3 < memberWays.length; j3++) {
18167             way = memberWays[j3];
18168             if (way.contains(nodeIDs[0])) {
18169               n0 = nodeIDs[0];
18170             }
18171             if (way.contains(nodeIDs[1])) {
18172               n1 = nodeIDs[1];
18173             }
18174           }
18175           if (n0 && n1) {
18176             var ok = false;
18177             for (j3 = 0; j3 < memberWays.length; j3++) {
18178               way = memberWays[j3];
18179               if (way.areAdjacent(n0, n1)) {
18180                 ok = true;
18181                 break;
18182               }
18183             }
18184             if (!ok) {
18185               return "restriction";
18186             }
18187           }
18188         }
18189         for (j3 = 0; j3 < memberWays.length; j3++) {
18190           way = memberWays[j3].update({});
18191           for (k3 = 0; k3 < nodeIDs.length; k3++) {
18192             if (nodeIDs[k3] === survivor.id) continue;
18193             if (way.areAdjacent(nodeIDs[k3], survivor.id)) {
18194               way = way.removeNode(nodeIDs[k3]);
18195             } else {
18196               way = way.replaceNode(nodeIDs[k3], survivor.id);
18197             }
18198           }
18199           if (way.isDegenerate()) {
18200             return "restriction";
18201           }
18202         }
18203       }
18204       return false;
18205       function hasDuplicates(n4, i4, arr) {
18206         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
18207       }
18208       function keyNodeFilter(froms, tos) {
18209         return function(n4) {
18210           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
18211         };
18212       }
18213       function collectNodes(member, collection) {
18214         var entity = graph.hasEntity(member.id);
18215         if (!entity) return;
18216         var role2 = member.role || "";
18217         if (!collection[role2]) {
18218           collection[role2] = [];
18219         }
18220         if (member.type === "node") {
18221           collection[role2].push(member.id);
18222           if (role2 === "via") {
18223             collection.keyfrom.push(member.id);
18224             collection.keyto.push(member.id);
18225           }
18226         } else if (member.type === "way") {
18227           collection[role2].push.apply(collection[role2], entity.nodes);
18228           if (role2 === "from" || role2 === "via") {
18229             collection.keyfrom.push(entity.first());
18230             collection.keyfrom.push(entity.last());
18231           }
18232           if (role2 === "to" || role2 === "via") {
18233             collection.keyto.push(entity.first());
18234             collection.keyto.push(entity.last());
18235           }
18236         }
18237       }
18238     };
18239     return action;
18240   }
18241   var init_connect = __esm({
18242     "modules/actions/connect.js"() {
18243       "use strict";
18244       init_delete_node();
18245       init_delete_way();
18246       init_util();
18247     }
18248   });
18249
18250   // modules/actions/copy_entities.js
18251   var copy_entities_exports = {};
18252   __export(copy_entities_exports, {
18253     actionCopyEntities: () => actionCopyEntities
18254   });
18255   function actionCopyEntities(ids, fromGraph) {
18256     var _copies = {};
18257     var action = function(graph) {
18258       ids.forEach(function(id3) {
18259         fromGraph.entity(id3).copy(fromGraph, _copies);
18260       });
18261       for (var id2 in _copies) {
18262         graph = graph.replace(_copies[id2]);
18263       }
18264       return graph;
18265     };
18266     action.copies = function() {
18267       return _copies;
18268     };
18269     return action;
18270   }
18271   var init_copy_entities = __esm({
18272     "modules/actions/copy_entities.js"() {
18273       "use strict";
18274     }
18275   });
18276
18277   // modules/actions/delete_member.js
18278   var delete_member_exports = {};
18279   __export(delete_member_exports, {
18280     actionDeleteMember: () => actionDeleteMember
18281   });
18282   function actionDeleteMember(relationId, memberIndex) {
18283     return function(graph) {
18284       var relation = graph.entity(relationId).removeMember(memberIndex);
18285       graph = graph.replace(relation);
18286       if (relation.isDegenerate()) {
18287         graph = actionDeleteRelation(relation.id)(graph);
18288       }
18289       return graph;
18290     };
18291   }
18292   var init_delete_member = __esm({
18293     "modules/actions/delete_member.js"() {
18294       "use strict";
18295       init_delete_relation();
18296     }
18297   });
18298
18299   // modules/actions/delete_members.js
18300   var delete_members_exports = {};
18301   __export(delete_members_exports, {
18302     actionDeleteMembers: () => actionDeleteMembers
18303   });
18304   function actionDeleteMembers(relationId, memberIndexes) {
18305     return function(graph) {
18306       memberIndexes.sort((a4, b3) => b3 - a4);
18307       for (var i3 in memberIndexes) {
18308         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
18309       }
18310       return graph;
18311     };
18312   }
18313   var init_delete_members = __esm({
18314     "modules/actions/delete_members.js"() {
18315       "use strict";
18316       init_delete_member();
18317     }
18318   });
18319
18320   // modules/actions/discard_tags.js
18321   var discard_tags_exports = {};
18322   __export(discard_tags_exports, {
18323     actionDiscardTags: () => actionDiscardTags
18324   });
18325   function actionDiscardTags(difference2, discardTags) {
18326     discardTags = discardTags || {};
18327     return (graph) => {
18328       difference2.modified().forEach(checkTags);
18329       difference2.created().forEach(checkTags);
18330       return graph;
18331       function checkTags(entity) {
18332         const keys2 = Object.keys(entity.tags);
18333         let didDiscard = false;
18334         let tags = {};
18335         for (let i3 = 0; i3 < keys2.length; i3++) {
18336           const k3 = keys2[i3];
18337           if (discardTags[k3] || !entity.tags[k3]) {
18338             didDiscard = true;
18339           } else {
18340             tags[k3] = entity.tags[k3];
18341           }
18342         }
18343         if (didDiscard) {
18344           graph = graph.replace(entity.update({ tags }));
18345         }
18346       }
18347     };
18348   }
18349   var init_discard_tags = __esm({
18350     "modules/actions/discard_tags.js"() {
18351       "use strict";
18352     }
18353   });
18354
18355   // modules/actions/disconnect.js
18356   var disconnect_exports = {};
18357   __export(disconnect_exports, {
18358     actionDisconnect: () => actionDisconnect
18359   });
18360   function actionDisconnect(nodeId, newNodeId) {
18361     var wayIds;
18362     var disconnectableRelationTypes = {
18363       "associatedStreet": true,
18364       "enforcement": true,
18365       "site": true
18366     };
18367     var action = function(graph) {
18368       var node = graph.entity(nodeId);
18369       var connections = action.connections(graph);
18370       connections.forEach(function(connection) {
18371         var way = graph.entity(connection.wayID);
18372         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
18373         graph = graph.replace(newNode);
18374         if (connection.index === 0 && way.isArea()) {
18375           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
18376         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
18377           graph = graph.replace(way.unclose().addNode(newNode.id));
18378         } else {
18379           graph = graph.replace(way.updateNode(newNode.id, connection.index));
18380         }
18381       });
18382       return graph;
18383     };
18384     action.connections = function(graph) {
18385       var candidates = [];
18386       var keeping = false;
18387       var parentWays = graph.parentWays(graph.entity(nodeId));
18388       var way, waynode;
18389       for (var i3 = 0; i3 < parentWays.length; i3++) {
18390         way = parentWays[i3];
18391         if (wayIds && wayIds.indexOf(way.id) === -1) {
18392           keeping = true;
18393           continue;
18394         }
18395         if (way.isArea() && way.nodes[0] === nodeId) {
18396           candidates.push({ wayID: way.id, index: 0 });
18397         } else {
18398           for (var j3 = 0; j3 < way.nodes.length; j3++) {
18399             waynode = way.nodes[j3];
18400             if (waynode === nodeId) {
18401               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j3 === way.nodes.length - 1) {
18402                 continue;
18403               }
18404               candidates.push({ wayID: way.id, index: j3 });
18405             }
18406           }
18407         }
18408       }
18409       return keeping ? candidates : candidates.slice(1);
18410     };
18411     action.disabled = function(graph) {
18412       var connections = action.connections(graph);
18413       if (connections.length === 0) return "not_connected";
18414       var parentWays = graph.parentWays(graph.entity(nodeId));
18415       var seenRelationIds = {};
18416       var sharedRelation;
18417       parentWays.forEach(function(way) {
18418         var relations = graph.parentRelations(way);
18419         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
18420           if (relation.id in seenRelationIds) {
18421             if (wayIds) {
18422               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
18423                 sharedRelation = relation;
18424               }
18425             } else {
18426               sharedRelation = relation;
18427             }
18428           } else {
18429             seenRelationIds[relation.id] = way.id;
18430           }
18431         });
18432       });
18433       if (sharedRelation) return "relation";
18434     };
18435     action.limitWays = function(val) {
18436       if (!arguments.length) return wayIds;
18437       wayIds = val;
18438       return action;
18439     };
18440     return action;
18441   }
18442   var init_disconnect = __esm({
18443     "modules/actions/disconnect.js"() {
18444       "use strict";
18445       init_node2();
18446     }
18447   });
18448
18449   // modules/actions/extract.js
18450   var extract_exports = {};
18451   __export(extract_exports, {
18452     actionExtract: () => actionExtract
18453   });
18454   function actionExtract(entityID, projection2) {
18455     var extractedNodeID;
18456     var action = function(graph, shiftKeyPressed) {
18457       var entity = graph.entity(entityID);
18458       if (entity.type === "node") {
18459         return extractFromNode(entity, graph, shiftKeyPressed);
18460       }
18461       return extractFromWayOrRelation(entity, graph);
18462     };
18463     function extractFromNode(node, graph, shiftKeyPressed) {
18464       extractedNodeID = node.id;
18465       var replacement = osmNode({ loc: node.loc });
18466       graph = graph.replace(replacement);
18467       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
18468         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
18469       }, graph);
18470       if (!shiftKeyPressed) return graph;
18471       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
18472         return accGraph.replace(parentRel.replaceMember(node, replacement));
18473       }, graph);
18474     }
18475     function extractFromWayOrRelation(entity, graph) {
18476       var fromGeometry = entity.geometry(graph);
18477       var keysToCopyAndRetain = ["source", "wheelchair"];
18478       var keysToRetain = ["area"];
18479       var buildingKeysToRetain = ["architect", "building", "height", "layer", "nycdoitt:bin"];
18480       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
18481       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
18482       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
18483         extractedLoc = entity.extent(graph).center();
18484       }
18485       var indoorAreaValues = {
18486         area: true,
18487         corridor: true,
18488         elevator: true,
18489         level: true,
18490         room: true
18491       };
18492       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
18493       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
18494       var entityTags = Object.assign({}, entity.tags);
18495       var pointTags = {};
18496       for (var key in entityTags) {
18497         if (entity.type === "relation" && key === "type") {
18498           continue;
18499         }
18500         if (keysToRetain.indexOf(key) !== -1) {
18501           continue;
18502         }
18503         if (isBuilding) {
18504           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
18505         }
18506         if (isIndoorArea && key === "indoor") {
18507           continue;
18508         }
18509         pointTags[key] = entityTags[key];
18510         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
18511           continue;
18512         } else if (isIndoorArea && key === "level") {
18513           continue;
18514         }
18515         delete entityTags[key];
18516       }
18517       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
18518         entityTags.area = "yes";
18519       }
18520       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
18521       graph = graph.replace(replacement);
18522       extractedNodeID = replacement.id;
18523       return graph.replace(entity.update({ tags: entityTags }));
18524     }
18525     action.getExtractedNodeID = function() {
18526       return extractedNodeID;
18527     };
18528     return action;
18529   }
18530   var init_extract = __esm({
18531     "modules/actions/extract.js"() {
18532       "use strict";
18533       init_src2();
18534       init_node2();
18535     }
18536   });
18537
18538   // modules/actions/join.js
18539   var join_exports = {};
18540   __export(join_exports, {
18541     actionJoin: () => actionJoin
18542   });
18543   function actionJoin(ids) {
18544     function groupEntitiesByGeometry(graph) {
18545       var entities = ids.map(function(id2) {
18546         return graph.entity(id2);
18547       });
18548       return Object.assign(
18549         { line: [] },
18550         utilArrayGroupBy(entities, function(entity) {
18551           return entity.geometry(graph);
18552         })
18553       );
18554     }
18555     var action = function(graph) {
18556       var ways = ids.map(graph.entity, graph);
18557       var survivorID = utilOldestID(ways.map((way) => way.id));
18558       ways.sort(function(a4, b3) {
18559         var aSided = a4.isSided();
18560         var bSided = b3.isSided();
18561         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
18562       });
18563       var sequences = osmJoinWays(ways, graph);
18564       var joined = sequences[0];
18565       graph = sequences.actions.reduce(function(g3, action2) {
18566         return action2(g3);
18567       }, graph);
18568       var survivor = graph.entity(survivorID);
18569       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
18570         return n3.id;
18571       }) });
18572       graph = graph.replace(survivor);
18573       joined.forEach(function(way) {
18574         if (way.id === survivorID) return;
18575         graph.parentRelations(way).forEach(function(parent2) {
18576           graph = graph.replace(parent2.replaceMember(way, survivor));
18577         });
18578         const summedTags = {};
18579         for (const key in way.tags) {
18580           if (!canSumTags(key, way.tags, survivor.tags)) continue;
18581           summedTags[key] = (+way.tags[key] + +survivor.tags[key]).toString();
18582         }
18583         survivor = survivor.mergeTags(way.tags, summedTags);
18584         graph = graph.replace(survivor);
18585         graph = actionDeleteWay(way.id)(graph);
18586       });
18587       function checkForSimpleMultipolygon() {
18588         if (!survivor.isClosed()) return;
18589         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
18590           return multipolygon2.members.length === 1;
18591         });
18592         if (multipolygons.length !== 1) return;
18593         var multipolygon = multipolygons[0];
18594         for (var key in survivor.tags) {
18595           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
18596           multipolygon.tags[key] !== survivor.tags[key]) return;
18597         }
18598         survivor = survivor.mergeTags(multipolygon.tags);
18599         graph = graph.replace(survivor);
18600         graph = actionDeleteRelation(
18601           multipolygon.id,
18602           true
18603           /* allow untagged members */
18604         )(graph);
18605         var tags = Object.assign({}, survivor.tags);
18606         if (survivor.geometry(graph) !== "area") {
18607           tags.area = "yes";
18608         }
18609         delete tags.type;
18610         survivor = survivor.update({ tags });
18611         graph = graph.replace(survivor);
18612       }
18613       checkForSimpleMultipolygon();
18614       return graph;
18615     };
18616     action.resultingWayNodesLength = function(graph) {
18617       return ids.reduce(function(count, id2) {
18618         return count + graph.entity(id2).nodes.length;
18619       }, 0) - ids.length - 1;
18620     };
18621     action.disabled = function(graph) {
18622       var geometries = groupEntitiesByGeometry(graph);
18623       if (ids.length < 2 || ids.length !== geometries.line.length) {
18624         return "not_eligible";
18625       }
18626       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
18627       if (joined.length > 1) {
18628         return "not_adjacent";
18629       }
18630       var i3;
18631       var sortedParentRelations = function(id2) {
18632         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a4, b3) => a4.id.localeCompare(b3.id));
18633       };
18634       var relsA = sortedParentRelations(ids[0]);
18635       for (i3 = 1; i3 < ids.length; i3++) {
18636         var relsB = sortedParentRelations(ids[i3]);
18637         if (!utilArrayIdentical(relsA, relsB)) {
18638           return "conflicting_relations";
18639         }
18640       }
18641       for (i3 = 0; i3 < ids.length - 1; i3++) {
18642         for (var j3 = i3 + 1; j3 < ids.length; j3++) {
18643           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
18644             return e3.loc;
18645           });
18646           var path2 = graph.childNodes(graph.entity(ids[j3])).map(function(e3) {
18647             return e3.loc;
18648           });
18649           var intersections = geoPathIntersections(path1, path2);
18650           var common = utilArrayIntersection(
18651             joined[0].nodes.map(function(n3) {
18652               return n3.loc.toString();
18653             }),
18654             intersections.map(function(n3) {
18655               return n3.toString();
18656             })
18657           );
18658           if (common.length !== intersections.length) {
18659             return "paths_intersect";
18660           }
18661         }
18662       }
18663       var nodeIds = joined[0].nodes.map(function(n3) {
18664         return n3.id;
18665       }).slice(1, -1);
18666       var relation;
18667       var tags = {};
18668       var conflicting = false;
18669       joined[0].forEach(function(way) {
18670         var parents = graph.parentRelations(way);
18671         parents.forEach(function(parent2) {
18672           if ((parent2.isRestriction() || parent2.isConnectivity()) && parent2.members.some(function(m3) {
18673             return nodeIds.indexOf(m3.id) >= 0;
18674           })) {
18675             relation = parent2;
18676           }
18677         });
18678         for (var k3 in way.tags) {
18679           if (!(k3 in tags)) {
18680             tags[k3] = way.tags[k3];
18681           } else if (canSumTags(k3, tags, way.tags)) {
18682             tags[k3] = (+tags[k3] + +way.tags[k3]).toString();
18683           } else if (tags[k3] && osmIsInterestingTag(k3) && tags[k3] !== way.tags[k3]) {
18684             conflicting = true;
18685           }
18686         }
18687       });
18688       if (relation) {
18689         return relation.isRestriction() ? "restriction" : "connectivity";
18690       }
18691       if (conflicting) {
18692         return "conflicting_tags";
18693       }
18694     };
18695     function canSumTags(key, tagsA, tagsB) {
18696       return osmSummableTags.has(key) && isFinite(tagsA[key] && isFinite(tagsB[key]));
18697     }
18698     return action;
18699   }
18700   var init_join2 = __esm({
18701     "modules/actions/join.js"() {
18702       "use strict";
18703       init_delete_relation();
18704       init_delete_way();
18705       init_tags();
18706       init_multipolygon();
18707       init_geo2();
18708       init_util();
18709     }
18710   });
18711
18712   // modules/actions/merge.js
18713   var merge_exports = {};
18714   __export(merge_exports, {
18715     actionMerge: () => actionMerge
18716   });
18717   function actionMerge(ids) {
18718     function groupEntitiesByGeometry(graph) {
18719       var entities = ids.map(function(id2) {
18720         return graph.entity(id2);
18721       });
18722       return Object.assign(
18723         { point: [], area: [], line: [], relation: [] },
18724         utilArrayGroupBy(entities, function(entity) {
18725           return entity.geometry(graph);
18726         })
18727       );
18728     }
18729     var action = function(graph) {
18730       var geometries = groupEntitiesByGeometry(graph);
18731       var target = geometries.area[0] || geometries.line[0];
18732       var points = geometries.point;
18733       points.forEach(function(point) {
18734         target = target.mergeTags(point.tags);
18735         graph = graph.replace(target);
18736         graph.parentRelations(point).forEach(function(parent2) {
18737           graph = graph.replace(parent2.replaceMember(point, target));
18738         });
18739         var nodes = utilArrayUniq(graph.childNodes(target));
18740         var removeNode = point;
18741         if (!point.isNew()) {
18742           var inserted = false;
18743           var canBeReplaced = function(node2) {
18744             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
18745           };
18746           var replaceNode = function(node2) {
18747             graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
18748             target = target.replaceNode(node2.id, point.id);
18749             graph = graph.replace(target);
18750             removeNode = node2;
18751             inserted = true;
18752           };
18753           var i3;
18754           var node;
18755           for (i3 = 0; i3 < nodes.length; i3++) {
18756             node = nodes[i3];
18757             if (canBeReplaced(node) && node.isNew()) {
18758               replaceNode(node);
18759               break;
18760             }
18761           }
18762           if (!inserted && point.hasInterestingTags()) {
18763             for (i3 = 0; i3 < nodes.length; i3++) {
18764               node = nodes[i3];
18765               if (canBeReplaced(node) && !node.hasInterestingTags()) {
18766                 replaceNode(node);
18767                 break;
18768               }
18769             }
18770             if (!inserted) {
18771               for (i3 = 0; i3 < nodes.length; i3++) {
18772                 node = nodes[i3];
18773                 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
18774                   replaceNode(node);
18775                   break;
18776                 }
18777               }
18778             }
18779           }
18780         }
18781         graph = graph.remove(removeNode);
18782       });
18783       if (target.tags.area === "yes") {
18784         var tags = Object.assign({}, target.tags);
18785         delete tags.area;
18786         if (osmTagSuggestingArea(tags)) {
18787           target = target.update({ tags });
18788           graph = graph.replace(target);
18789         }
18790       }
18791       return graph;
18792     };
18793     action.disabled = function(graph) {
18794       var geometries = groupEntitiesByGeometry(graph);
18795       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
18796         return "not_eligible";
18797       }
18798     };
18799     return action;
18800   }
18801   var init_merge5 = __esm({
18802     "modules/actions/merge.js"() {
18803       "use strict";
18804       init_tags();
18805       init_util();
18806     }
18807   });
18808
18809   // modules/actions/merge_nodes.js
18810   var merge_nodes_exports = {};
18811   __export(merge_nodes_exports, {
18812     actionMergeNodes: () => actionMergeNodes
18813   });
18814   function actionMergeNodes(nodeIDs, loc) {
18815     function chooseLoc(graph) {
18816       if (!nodeIDs.length) return null;
18817       var sum = [0, 0];
18818       var interestingCount = 0;
18819       var interestingLoc;
18820       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
18821         var node = graph.entity(nodeIDs[i3]);
18822         if (node.hasInterestingTags()) {
18823           interestingLoc = ++interestingCount === 1 ? node.loc : null;
18824         }
18825         sum = geoVecAdd(sum, node.loc);
18826       }
18827       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
18828     }
18829     var action = function(graph) {
18830       if (nodeIDs.length < 2) return graph;
18831       var toLoc = loc;
18832       if (!toLoc) {
18833         toLoc = chooseLoc(graph);
18834       }
18835       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
18836         var node = graph.entity(nodeIDs[i3]);
18837         if (node.loc !== toLoc) {
18838           graph = graph.replace(node.move(toLoc));
18839         }
18840       }
18841       return actionConnect(nodeIDs)(graph);
18842     };
18843     action.disabled = function(graph) {
18844       if (nodeIDs.length < 2) return "not_eligible";
18845       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
18846         var entity = graph.entity(nodeIDs[i3]);
18847         if (entity.type !== "node") return "not_eligible";
18848       }
18849       return actionConnect(nodeIDs).disabled(graph);
18850     };
18851     return action;
18852   }
18853   var init_merge_nodes = __esm({
18854     "modules/actions/merge_nodes.js"() {
18855       "use strict";
18856       init_connect();
18857       init_geo2();
18858     }
18859   });
18860
18861   // modules/osm/changeset.js
18862   var changeset_exports = {};
18863   __export(changeset_exports, {
18864     osmChangeset: () => osmChangeset
18865   });
18866   function osmChangeset() {
18867     if (!(this instanceof osmChangeset)) {
18868       return new osmChangeset().initialize(arguments);
18869     } else if (arguments.length) {
18870       this.initialize(arguments);
18871     }
18872   }
18873   var init_changeset = __esm({
18874     "modules/osm/changeset.js"() {
18875       "use strict";
18876       init_entity();
18877       init_geo2();
18878       osmEntity.changeset = osmChangeset;
18879       osmChangeset.prototype = Object.create(osmEntity.prototype);
18880       Object.assign(osmChangeset.prototype, {
18881         type: "changeset",
18882         extent: function() {
18883           return new geoExtent();
18884         },
18885         geometry: function() {
18886           return "changeset";
18887         },
18888         asJXON: function() {
18889           return {
18890             osm: {
18891               changeset: {
18892                 tag: Object.keys(this.tags).map(function(k3) {
18893                   return { "@k": k3, "@v": this.tags[k3] };
18894                 }, this),
18895                 "@version": 0.6,
18896                 "@generator": "iD"
18897               }
18898             }
18899           };
18900         },
18901         // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
18902         // XML. Returns a string.
18903         osmChangeJXON: function(changes) {
18904           var changeset_id = this.id;
18905           function nest(x2, order) {
18906             var groups = {};
18907             for (var i3 = 0; i3 < x2.length; i3++) {
18908               var tagName = Object.keys(x2[i3])[0];
18909               if (!groups[tagName]) groups[tagName] = [];
18910               groups[tagName].push(x2[i3][tagName]);
18911             }
18912             var ordered = {};
18913             order.forEach(function(o2) {
18914               if (groups[o2]) ordered[o2] = groups[o2];
18915             });
18916             return ordered;
18917           }
18918           function sort(changes2) {
18919             function resolve(item) {
18920               return relations.find(function(relation2) {
18921                 return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
18922               });
18923             }
18924             function isNew(item) {
18925               return !sorted[item["@id"]] && !processing.find(function(proc) {
18926                 return proc["@id"] === item["@id"];
18927               });
18928             }
18929             var processing = [];
18930             var sorted = {};
18931             var relations = changes2.relation;
18932             if (!relations) return changes2;
18933             for (var i3 = 0; i3 < relations.length; i3++) {
18934               var relation = relations[i3];
18935               if (!sorted[relation["@id"]]) {
18936                 processing.push(relation);
18937               }
18938               while (processing.length > 0) {
18939                 var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
18940                 if (deps.length === 0) {
18941                   sorted[next["@id"]] = next;
18942                   processing.shift();
18943                 } else {
18944                   processing = deps.concat(processing);
18945                 }
18946               }
18947             }
18948             changes2.relation = Object.values(sorted);
18949             return changes2;
18950           }
18951           function rep(entity) {
18952             return entity.asJXON(changeset_id);
18953           }
18954           return {
18955             osmChange: {
18956               "@version": 0.6,
18957               "@generator": "iD",
18958               "create": sort(nest(changes.created.map(rep), ["node", "way", "relation"])),
18959               "modify": nest(changes.modified.map(rep), ["node", "way", "relation"]),
18960               "delete": Object.assign(nest(changes.deleted.map(rep), ["relation", "way", "node"]), { "@if-unused": true })
18961             }
18962           };
18963         },
18964         asGeoJSON: function() {
18965           return {};
18966         }
18967       });
18968     }
18969   });
18970
18971   // modules/osm/note.js
18972   var note_exports = {};
18973   __export(note_exports, {
18974     osmNote: () => osmNote
18975   });
18976   function osmNote() {
18977     if (!(this instanceof osmNote)) {
18978       return new osmNote().initialize(arguments);
18979     } else if (arguments.length) {
18980       this.initialize(arguments);
18981     }
18982   }
18983   var init_note = __esm({
18984     "modules/osm/note.js"() {
18985       "use strict";
18986       init_geo2();
18987       osmNote.id = function() {
18988         return osmNote.id.next--;
18989       };
18990       osmNote.id.next = -1;
18991       Object.assign(osmNote.prototype, {
18992         type: "note",
18993         initialize: function(sources) {
18994           for (var i3 = 0; i3 < sources.length; ++i3) {
18995             var source = sources[i3];
18996             for (var prop in source) {
18997               if (Object.prototype.hasOwnProperty.call(source, prop)) {
18998                 if (source[prop] === void 0) {
18999                   delete this[prop];
19000                 } else {
19001                   this[prop] = source[prop];
19002                 }
19003               }
19004             }
19005           }
19006           if (!this.id) {
19007             this.id = osmNote.id().toString();
19008           }
19009           return this;
19010         },
19011         extent: function() {
19012           return new geoExtent(this.loc);
19013         },
19014         update: function(attrs) {
19015           return osmNote(this, attrs);
19016         },
19017         isNew: function() {
19018           return this.id < 0;
19019         },
19020         move: function(loc) {
19021           return this.update({ loc });
19022         }
19023       });
19024     }
19025   });
19026
19027   // modules/osm/relation.js
19028   var relation_exports = {};
19029   __export(relation_exports, {
19030     osmRelation: () => osmRelation
19031   });
19032   function osmRelation() {
19033     if (!(this instanceof osmRelation)) {
19034       return new osmRelation().initialize(arguments);
19035     } else if (arguments.length) {
19036       this.initialize(arguments);
19037     }
19038   }
19039   var prototype2;
19040   var init_relation = __esm({
19041     "modules/osm/relation.js"() {
19042       "use strict";
19043       init_src2();
19044       init_entity();
19045       init_multipolygon();
19046       init_geo2();
19047       osmEntity.relation = osmRelation;
19048       osmRelation.prototype = Object.create(osmEntity.prototype);
19049       osmRelation.creationOrder = function(a4, b3) {
19050         var aId = parseInt(osmEntity.id.toOSM(a4.id), 10);
19051         var bId = parseInt(osmEntity.id.toOSM(b3.id), 10);
19052         if (aId < 0 || bId < 0) return aId - bId;
19053         return bId - aId;
19054       };
19055       prototype2 = {
19056         type: "relation",
19057         members: [],
19058         copy: function(resolver, copies) {
19059           if (copies[this.id]) return copies[this.id];
19060           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
19061           var members = this.members.map(function(member) {
19062             return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
19063           });
19064           copy2 = copy2.update({ members });
19065           copies[this.id] = copy2;
19066           return copy2;
19067         },
19068         extent: function(resolver, memo) {
19069           return resolver.transient(this, "extent", function() {
19070             if (memo && memo[this.id]) return geoExtent();
19071             memo = memo || {};
19072             memo[this.id] = true;
19073             var extent = geoExtent();
19074             for (var i3 = 0; i3 < this.members.length; i3++) {
19075               var member = resolver.hasEntity(this.members[i3].id);
19076               if (member) {
19077                 extent._extend(member.extent(resolver, memo));
19078               }
19079             }
19080             return extent;
19081           });
19082         },
19083         geometry: function(graph) {
19084           return graph.transient(this, "geometry", function() {
19085             return this.isMultipolygon() ? "area" : "relation";
19086           });
19087         },
19088         isDegenerate: function() {
19089           return this.members.length === 0;
19090         },
19091         // Return an array of members, each extended with an 'index' property whose value
19092         // is the member index.
19093         indexedMembers: function() {
19094           var result = new Array(this.members.length);
19095           for (var i3 = 0; i3 < this.members.length; i3++) {
19096             result[i3] = Object.assign({}, this.members[i3], { index: i3 });
19097           }
19098           return result;
19099         },
19100         // Return the first member with the given role. A copy of the member object
19101         // is returned, extended with an 'index' property whose value is the member index.
19102         memberByRole: function(role) {
19103           for (var i3 = 0; i3 < this.members.length; i3++) {
19104             if (this.members[i3].role === role) {
19105               return Object.assign({}, this.members[i3], { index: i3 });
19106             }
19107           }
19108         },
19109         // Same as memberByRole, but returns all members with the given role
19110         membersByRole: function(role) {
19111           var result = [];
19112           for (var i3 = 0; i3 < this.members.length; i3++) {
19113             if (this.members[i3].role === role) {
19114               result.push(Object.assign({}, this.members[i3], { index: i3 }));
19115             }
19116           }
19117           return result;
19118         },
19119         // Return the first member with the given id. A copy of the member object
19120         // is returned, extended with an 'index' property whose value is the member index.
19121         memberById: function(id2) {
19122           for (var i3 = 0; i3 < this.members.length; i3++) {
19123             if (this.members[i3].id === id2) {
19124               return Object.assign({}, this.members[i3], { index: i3 });
19125             }
19126           }
19127         },
19128         // Return the first member with the given id and role. A copy of the member object
19129         // is returned, extended with an 'index' property whose value is the member index.
19130         memberByIdAndRole: function(id2, role) {
19131           for (var i3 = 0; i3 < this.members.length; i3++) {
19132             if (this.members[i3].id === id2 && this.members[i3].role === role) {
19133               return Object.assign({}, this.members[i3], { index: i3 });
19134             }
19135           }
19136         },
19137         addMember: function(member, index) {
19138           var members = this.members.slice();
19139           members.splice(index === void 0 ? members.length : index, 0, member);
19140           return this.update({ members });
19141         },
19142         updateMember: function(member, index) {
19143           var members = this.members.slice();
19144           members.splice(index, 1, Object.assign({}, members[index], member));
19145           return this.update({ members });
19146         },
19147         removeMember: function(index) {
19148           var members = this.members.slice();
19149           members.splice(index, 1);
19150           return this.update({ members });
19151         },
19152         removeMembersWithID: function(id2) {
19153           var members = this.members.filter(function(m3) {
19154             return m3.id !== id2;
19155           });
19156           return this.update({ members });
19157         },
19158         moveMember: function(fromIndex, toIndex) {
19159           var members = this.members.slice();
19160           members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
19161           return this.update({ members });
19162         },
19163         // Wherever a member appears with id `needle.id`, replace it with a member
19164         // with id `replacement.id`, type `replacement.type`, and the original role,
19165         // By default, adding a duplicate member (by id and role) is prevented.
19166         // Return an updated relation.
19167         replaceMember: function(needle, replacement, keepDuplicates) {
19168           if (!this.memberById(needle.id)) return this;
19169           var members = [];
19170           for (var i3 = 0; i3 < this.members.length; i3++) {
19171             var member = this.members[i3];
19172             if (member.id !== needle.id) {
19173               members.push(member);
19174             } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
19175               members.push({ id: replacement.id, type: replacement.type, role: member.role });
19176             }
19177           }
19178           return this.update({ members });
19179         },
19180         asJXON: function(changeset_id) {
19181           var r2 = {
19182             relation: {
19183               "@id": this.osmId(),
19184               "@version": this.version || 0,
19185               member: this.members.map(function(member) {
19186                 return {
19187                   keyAttributes: {
19188                     type: member.type,
19189                     role: member.role,
19190                     ref: osmEntity.id.toOSM(member.id)
19191                   }
19192                 };
19193               }, this),
19194               tag: Object.keys(this.tags).map(function(k3) {
19195                 return { keyAttributes: { k: k3, v: this.tags[k3] } };
19196               }, this)
19197             }
19198           };
19199           if (changeset_id) {
19200             r2.relation["@changeset"] = changeset_id;
19201           }
19202           return r2;
19203         },
19204         asGeoJSON: function(resolver) {
19205           return resolver.transient(this, "GeoJSON", function() {
19206             if (this.isMultipolygon()) {
19207               return {
19208                 type: "MultiPolygon",
19209                 coordinates: this.multipolygon(resolver)
19210               };
19211             } else {
19212               return {
19213                 type: "FeatureCollection",
19214                 properties: this.tags,
19215                 features: this.members.map(function(member) {
19216                   return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
19217                 })
19218               };
19219             }
19220           });
19221         },
19222         area: function(resolver) {
19223           return resolver.transient(this, "area", function() {
19224             return area_default(this.asGeoJSON(resolver));
19225           });
19226         },
19227         isMultipolygon: function() {
19228           return this.tags.type === "multipolygon";
19229         },
19230         isComplete: function(resolver) {
19231           for (var i3 = 0; i3 < this.members.length; i3++) {
19232             if (!resolver.hasEntity(this.members[i3].id)) {
19233               return false;
19234             }
19235           }
19236           return true;
19237         },
19238         hasFromViaTo: function() {
19239           return this.members.some(function(m3) {
19240             return m3.role === "from";
19241           }) && this.members.some(
19242             (m3) => m3.role === "via" || m3.role === "intersection" && this.tags.type === "destination_sign"
19243           ) && this.members.some(function(m3) {
19244             return m3.role === "to";
19245           });
19246         },
19247         isRestriction: function() {
19248           return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
19249         },
19250         isValidRestriction: function() {
19251           if (!this.isRestriction()) return false;
19252           var froms = this.members.filter(function(m3) {
19253             return m3.role === "from";
19254           });
19255           var vias = this.members.filter(function(m3) {
19256             return m3.role === "via";
19257           });
19258           var tos = this.members.filter(function(m3) {
19259             return m3.role === "to";
19260           });
19261           if (froms.length !== 1 && this.tags.restriction !== "no_entry") return false;
19262           if (froms.some(function(m3) {
19263             return m3.type !== "way";
19264           })) return false;
19265           if (tos.length !== 1 && this.tags.restriction !== "no_exit") return false;
19266           if (tos.some(function(m3) {
19267             return m3.type !== "way";
19268           })) return false;
19269           if (vias.length === 0) return false;
19270           if (vias.length > 1 && vias.some(function(m3) {
19271             return m3.type !== "way";
19272           })) return false;
19273           return true;
19274         },
19275         isConnectivity: function() {
19276           return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
19277         },
19278         // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
19279         // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
19280         //
19281         // This corresponds to the structure needed for rendering a multipolygon path using a
19282         // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
19283         //
19284         // In the case of invalid geometries, this function will still return a result which
19285         // includes the nodes of all way members, but some Nds may be unclosed and some inner
19286         // rings not matched with the intended outer ring.
19287         //
19288         multipolygon: function(resolver) {
19289           var outers = this.members.filter(function(m3) {
19290             return "outer" === (m3.role || "outer");
19291           });
19292           var inners = this.members.filter(function(m3) {
19293             return "inner" === m3.role;
19294           });
19295           outers = osmJoinWays(outers, resolver);
19296           inners = osmJoinWays(inners, resolver);
19297           var sequenceToLineString = function(sequence) {
19298             if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
19299               sequence.nodes.push(sequence.nodes[0]);
19300             }
19301             return sequence.nodes.map(function(node) {
19302               return node.loc;
19303             });
19304           };
19305           outers = outers.map(sequenceToLineString);
19306           inners = inners.map(sequenceToLineString);
19307           var result = outers.map(function(o3) {
19308             return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
19309           });
19310           function findOuter(inner2) {
19311             var o3, outer;
19312             for (o3 = 0; o3 < outers.length; o3++) {
19313               outer = outers[o3];
19314               if (geoPolygonContainsPolygon(outer, inner2)) {
19315                 return o3;
19316               }
19317             }
19318             for (o3 = 0; o3 < outers.length; o3++) {
19319               outer = outers[o3];
19320               if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
19321                 return o3;
19322               }
19323             }
19324           }
19325           for (var i3 = 0; i3 < inners.length; i3++) {
19326             var inner = inners[i3];
19327             if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
19328               inner = inner.reverse();
19329             }
19330             var o2 = findOuter(inners[i3]);
19331             if (o2 !== void 0) {
19332               result[o2].push(inners[i3]);
19333             } else {
19334               result.push([inners[i3]]);
19335             }
19336           }
19337           return result;
19338         }
19339       };
19340       Object.assign(osmRelation.prototype, prototype2);
19341     }
19342   });
19343
19344   // modules/osm/qa_item.js
19345   var qa_item_exports = {};
19346   __export(qa_item_exports, {
19347     QAItem: () => QAItem
19348   });
19349   var QAItem;
19350   var init_qa_item = __esm({
19351     "modules/osm/qa_item.js"() {
19352       "use strict";
19353       QAItem = class _QAItem {
19354         constructor(loc, service, itemType, id2, props) {
19355           this.loc = loc;
19356           this.service = service.title;
19357           this.itemType = itemType;
19358           this.id = id2 ? id2 : `${_QAItem.id()}`;
19359           this.update(props);
19360           if (service && typeof service.getIcon === "function") {
19361             this.icon = service.getIcon(itemType);
19362           }
19363         }
19364         update(props) {
19365           const { loc, service, itemType, id: id2 } = this;
19366           Object.keys(props).forEach((prop) => this[prop] = props[prop]);
19367           this.loc = loc;
19368           this.service = service;
19369           this.itemType = itemType;
19370           this.id = id2;
19371           return this;
19372         }
19373         // Generic handling for newly created QAItems
19374         static id() {
19375           return this.nextId--;
19376         }
19377       };
19378       QAItem.nextId = -1;
19379     }
19380   });
19381
19382   // modules/actions/split.js
19383   var split_exports = {};
19384   __export(split_exports, {
19385     actionSplit: () => actionSplit
19386   });
19387   function actionSplit(nodeIds, newWayIds) {
19388     if (typeof nodeIds === "string") nodeIds = [nodeIds];
19389     var _wayIDs;
19390     var _keepHistoryOn = "longest";
19391     const circularJunctions = ["roundabout", "circular"];
19392     var _createdWayIDs = [];
19393     function dist(graph, nA, nB) {
19394       var locA = graph.entity(nA).loc;
19395       var locB = graph.entity(nB).loc;
19396       var epsilon3 = 1e-6;
19397       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
19398     }
19399     function splitArea(nodes, idxA, graph) {
19400       var lengths = new Array(nodes.length);
19401       var length2;
19402       var i3;
19403       var best = 0;
19404       var idxB;
19405       function wrap2(index) {
19406         return utilWrap(index, nodes.length);
19407       }
19408       length2 = 0;
19409       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
19410         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
19411         lengths[i3] = length2;
19412       }
19413       length2 = 0;
19414       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
19415         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
19416         if (length2 < lengths[i3]) {
19417           lengths[i3] = length2;
19418         }
19419       }
19420       for (i3 = 0; i3 < nodes.length; i3++) {
19421         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
19422         if (cost > best) {
19423           idxB = i3;
19424           best = cost;
19425         }
19426       }
19427       return idxB;
19428     }
19429     function totalLengthBetweenNodes(graph, nodes) {
19430       var totalLength = 0;
19431       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
19432         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
19433       }
19434       return totalLength;
19435     }
19436     function split(graph, nodeId, wayA, newWayId, otherNodeIds) {
19437       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
19438       var nodesA;
19439       var nodesB;
19440       var isArea = wayA.isArea();
19441       if (wayA.isClosed()) {
19442         var nodes = wayA.nodes.slice(0, -1);
19443         var idxA = nodes.indexOf(nodeId);
19444         var idxB = otherNodeIds.length > 0 ? nodes.indexOf(otherNodeIds[0]) : splitArea(nodes, idxA, graph);
19445         if (idxB < idxA) {
19446           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
19447           nodesB = nodes.slice(idxB, idxA + 1);
19448         } else {
19449           nodesA = nodes.slice(idxA, idxB + 1);
19450           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
19451         }
19452       } else {
19453         var idx = wayA.nodes.indexOf(nodeId, 1);
19454         nodesA = wayA.nodes.slice(0, idx + 1);
19455         nodesB = wayA.nodes.slice(idx);
19456       }
19457       var lengthA = totalLengthBetweenNodes(graph, nodesA);
19458       var lengthB = totalLengthBetweenNodes(graph, nodesB);
19459       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
19460         wayA = wayA.update({ nodes: nodesB });
19461         wayB = wayB.update({ nodes: nodesA });
19462         var temp = lengthA;
19463         lengthA = lengthB;
19464         lengthB = temp;
19465       } else {
19466         wayA = wayA.update({ nodes: nodesA });
19467         wayB = wayB.update({ nodes: nodesB });
19468       }
19469       for (const key in wayA.tags) {
19470         if (!osmSummableTags.has(key)) continue;
19471         var count = Number(wayA.tags[key]);
19472         if (count && // ensure a number
19473         isFinite(count) && // ensure positive
19474         count > 0 && // ensure integer
19475         Math.round(count) === count) {
19476           var tagsA = Object.assign({}, wayA.tags);
19477           var tagsB = Object.assign({}, wayB.tags);
19478           var ratioA = lengthA / (lengthA + lengthB);
19479           var countA = Math.round(count * ratioA);
19480           tagsA[key] = countA.toString();
19481           tagsB[key] = (count - countA).toString();
19482           wayA = wayA.update({ tags: tagsA });
19483           wayB = wayB.update({ tags: tagsB });
19484         }
19485       }
19486       graph = graph.replace(wayA);
19487       graph = graph.replace(wayB);
19488       graph.parentRelations(wayA).forEach(function(relation) {
19489         if (relation.hasFromViaTo()) {
19490           var f2 = relation.memberByRole("from");
19491           var v3 = [
19492             ...relation.membersByRole("via"),
19493             ...relation.membersByRole("intersection")
19494           ];
19495           var t2 = relation.memberByRole("to");
19496           var i3;
19497           if (f2.id === wayA.id || t2.id === wayA.id) {
19498             var keepB = false;
19499             if (v3.length === 1 && v3[0].type === "node") {
19500               keepB = wayB.contains(v3[0].id);
19501             } else {
19502               for (i3 = 0; i3 < v3.length; i3++) {
19503                 if (v3[i3].type === "way") {
19504                   var wayVia = graph.hasEntity(v3[i3].id);
19505                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
19506                     keepB = true;
19507                     break;
19508                   }
19509                 }
19510               }
19511             }
19512             if (keepB) {
19513               relation = relation.replaceMember(wayA, wayB);
19514               graph = graph.replace(relation);
19515             }
19516           } else {
19517             for (i3 = 0; i3 < v3.length; i3++) {
19518               if (v3[i3].type === "way" && v3[i3].id === wayA.id) {
19519                 graph = splitWayMember(graph, relation.id, wayA, wayB);
19520               }
19521             }
19522           }
19523         } else {
19524           graph = splitWayMember(graph, relation.id, wayA, wayB);
19525         }
19526       });
19527       if (isArea) {
19528         var multipolygon = osmRelation({
19529           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
19530           members: [
19531             { id: wayA.id, role: "outer", type: "way" },
19532             { id: wayB.id, role: "outer", type: "way" }
19533           ]
19534         });
19535         graph = graph.replace(multipolygon);
19536         graph = graph.replace(wayA.update({ tags: {} }));
19537         graph = graph.replace(wayB.update({ tags: {} }));
19538       }
19539       _createdWayIDs.push(wayB.id);
19540       return graph;
19541     }
19542     function splitWayMember(graph, relationId, wayA, wayB) {
19543       function connects(way1, way2) {
19544         if (way1.nodes.length < 2 || way2.nodes.length < 2) return false;
19545         if (circularJunctions.includes(way1.tags.junction) && way1.isClosed()) {
19546           return way1.nodes.some((nodeId) => nodeId === way2.nodes[0] || nodeId === way2.nodes[way2.nodes.length - 1]);
19547         } else if (circularJunctions.includes(way2.tags.junction) && way2.isClosed()) {
19548           return way2.nodes.some((nodeId) => nodeId === way1.nodes[0] || nodeId === way1.nodes[way1.nodes.length - 1]);
19549         }
19550         if (way1.nodes[0] === way2.nodes[0]) return true;
19551         if (way1.nodes[0] === way2.nodes[way2.nodes.length - 1]) return true;
19552         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[way2.nodes.length - 1]) return true;
19553         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[0]) return true;
19554         return false;
19555       }
19556       let relation = graph.entity(relationId);
19557       const insertMembers = [];
19558       const members = relation.members;
19559       for (let i3 = 0; i3 < members.length; i3++) {
19560         const member = members[i3];
19561         if (member.id === wayA.id) {
19562           let wayAconnectsPrev = false;
19563           let wayAconnectsNext = false;
19564           let wayBconnectsPrev = false;
19565           let wayBconnectsNext = false;
19566           if (i3 > 0 && graph.hasEntity(members[i3 - 1].id)) {
19567             const prevEntity = graph.entity(members[i3 - 1].id);
19568             if (prevEntity.type === "way") {
19569               wayAconnectsPrev = connects(prevEntity, wayA);
19570               wayBconnectsPrev = connects(prevEntity, wayB);
19571             }
19572           }
19573           if (i3 < members.length - 1 && graph.hasEntity(members[i3 + 1].id)) {
19574             const nextEntity = graph.entity(members[i3 + 1].id);
19575             if (nextEntity.type === "way") {
19576               wayAconnectsNext = connects(nextEntity, wayA);
19577               wayBconnectsNext = connects(nextEntity, wayB);
19578             }
19579           }
19580           if (wayAconnectsPrev && !wayAconnectsNext || !wayBconnectsPrev && wayBconnectsNext && !(!wayAconnectsPrev && wayAconnectsNext)) {
19581             insertMembers.push({ at: i3 + 1, role: member.role });
19582             continue;
19583           }
19584           if (!wayAconnectsPrev && wayAconnectsNext || wayBconnectsPrev && !wayBconnectsNext && !(wayAconnectsPrev && !wayAconnectsNext)) {
19585             insertMembers.push({ at: i3, role: member.role });
19586             continue;
19587           }
19588           if (wayAconnectsPrev && wayBconnectsPrev && wayAconnectsNext && wayBconnectsNext) {
19589             if (i3 > 2 && graph.hasEntity(members[i3 - 2].id)) {
19590               const prev2Entity = graph.entity(members[i3 - 2].id);
19591               if (connects(prev2Entity, wayA) && !connects(prev2Entity, wayB)) {
19592                 insertMembers.push({ at: i3, role: member.role });
19593                 continue;
19594               }
19595               if (connects(prev2Entity, wayB) && !connects(prev2Entity, wayA)) {
19596                 insertMembers.push({ at: i3 + 1, role: member.role });
19597                 continue;
19598               }
19599             }
19600             if (i3 < members.length - 2 && graph.hasEntity(members[i3 + 2].id)) {
19601               const next2Entity = graph.entity(members[i3 + 2].id);
19602               if (connects(next2Entity, wayA) && !connects(next2Entity, wayB)) {
19603                 insertMembers.push({ at: i3 + 1, role: member.role });
19604                 continue;
19605               }
19606               if (connects(next2Entity, wayB) && !connects(next2Entity, wayA)) {
19607                 insertMembers.push({ at: i3, role: member.role });
19608                 continue;
19609               }
19610             }
19611           }
19612           if (wayA.nodes[wayA.nodes.length - 1] === wayB.nodes[0]) {
19613             insertMembers.push({ at: i3 + 1, role: member.role });
19614           } else {
19615             insertMembers.push({ at: i3, role: member.role });
19616           }
19617         }
19618       }
19619       insertMembers.reverse().forEach((item) => {
19620         graph = graph.replace(relation.addMember({
19621           id: wayB.id,
19622           type: "way",
19623           role: item.role
19624         }, item.at));
19625         relation = graph.entity(relation.id);
19626       });
19627       return graph;
19628     }
19629     const action = function(graph) {
19630       _createdWayIDs = [];
19631       let newWayIndex = 0;
19632       for (const i3 in nodeIds) {
19633         const nodeId = nodeIds[i3];
19634         const candidates = waysForNodes(nodeIds.slice(i3), graph);
19635         for (const candidate of candidates) {
19636           graph = split(graph, nodeId, candidate, newWayIds && newWayIds[newWayIndex], nodeIds.slice(i3 + 1));
19637           newWayIndex += 1;
19638         }
19639       }
19640       return graph;
19641     };
19642     action.getCreatedWayIDs = function() {
19643       return _createdWayIDs;
19644     };
19645     function waysForNodes(nodeIds2, graph) {
19646       const splittableWays = nodeIds2.map((nodeId) => waysForNode(nodeId, graph)).reduce((cur, acc) => utilArrayIntersection(cur, acc));
19647       if (!_wayIDs) {
19648         const hasLine = splittableWays.some((way) => way.geometry(graph) === "line");
19649         if (hasLine) {
19650           return splittableWays.filter((way) => way.geometry(graph) === "line");
19651         }
19652       }
19653       return splittableWays;
19654     }
19655     function waysForNode(nodeId, graph) {
19656       const node = graph.entity(nodeId);
19657       return graph.parentWays(node).filter(isSplittable);
19658       function isSplittable(way) {
19659         if (_wayIDs && _wayIDs.indexOf(way.id) === -1) return false;
19660         if (way.isClosed()) return true;
19661         for (let i3 = 1; i3 < way.nodes.length - 1; i3++) {
19662           if (way.nodes[i3] === nodeId) return true;
19663         }
19664         return false;
19665       }
19666     }
19667     ;
19668     action.ways = function(graph) {
19669       return waysForNodes(nodeIds, graph);
19670     };
19671     action.disabled = function(graph) {
19672       const candidates = waysForNodes(nodeIds, graph);
19673       if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
19674         return "not_eligible";
19675       }
19676       for (const way of candidates) {
19677         const parentRelations = graph.parentRelations(way);
19678         for (const parentRelation of parentRelations) {
19679           if (parentRelation.hasFromViaTo()) {
19680             const vias = [
19681               ...parentRelation.membersByRole("via"),
19682               ...parentRelation.membersByRole("intersection")
19683             ];
19684             if (!vias.every((via) => graph.hasEntity(via.id))) {
19685               return "parent_incomplete";
19686             }
19687           } else {
19688             for (let i3 = 0; i3 < parentRelation.members.length; i3++) {
19689               if (parentRelation.members[i3].id === way.id) {
19690                 const memberBeforePresent = i3 > 0 && graph.hasEntity(parentRelation.members[i3 - 1].id);
19691                 const memberAfterPresent = i3 < parentRelation.members.length - 1 && graph.hasEntity(parentRelation.members[i3 + 1].id);
19692                 if (!memberBeforePresent && !memberAfterPresent && parentRelation.members.length > 1) {
19693                   return "parent_incomplete";
19694                 }
19695               }
19696             }
19697           }
19698           const relTypesExceptions = ["junction", "enforcement"];
19699           if (circularJunctions.includes(way.tags.junction) && way.isClosed() && !relTypesExceptions.includes(parentRelation.tags.type)) {
19700             return "simple_roundabout";
19701           }
19702         }
19703       }
19704     };
19705     action.limitWays = function(val) {
19706       if (!arguments.length) return _wayIDs;
19707       _wayIDs = val;
19708       return action;
19709     };
19710     action.keepHistoryOn = function(val) {
19711       if (!arguments.length) return _keepHistoryOn;
19712       _keepHistoryOn = val;
19713       return action;
19714     };
19715     return action;
19716   }
19717   var init_split = __esm({
19718     "modules/actions/split.js"() {
19719       "use strict";
19720       init_geo();
19721       init_relation();
19722       init_way();
19723       init_util();
19724       init_tags();
19725     }
19726   });
19727
19728   // modules/core/graph.js
19729   var graph_exports = {};
19730   __export(graph_exports, {
19731     coreGraph: () => coreGraph
19732   });
19733   function coreGraph(other, mutable) {
19734     if (!(this instanceof coreGraph)) return new coreGraph(other, mutable);
19735     if (other instanceof coreGraph) {
19736       var base = other.base();
19737       this.entities = Object.assign(Object.create(base.entities), other.entities);
19738       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
19739       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
19740     } else {
19741       this.entities = /* @__PURE__ */ Object.create({});
19742       this._parentWays = /* @__PURE__ */ Object.create({});
19743       this._parentRels = /* @__PURE__ */ Object.create({});
19744       this.rebase(other || [], [this]);
19745     }
19746     this.transients = {};
19747     this._childNodes = {};
19748     this.frozen = !mutable;
19749   }
19750   var init_graph = __esm({
19751     "modules/core/graph.js"() {
19752       "use strict";
19753       init_index();
19754       init_util();
19755       coreGraph.prototype = {
19756         hasEntity: function(id2) {
19757           return this.entities[id2];
19758         },
19759         entity: function(id2) {
19760           var entity = this.entities[id2];
19761           if (!entity) {
19762             throw new Error("entity " + id2 + " not found");
19763           }
19764           return entity;
19765         },
19766         geometry: function(id2) {
19767           return this.entity(id2).geometry(this);
19768         },
19769         transient: function(entity, key, fn) {
19770           var id2 = entity.id;
19771           var transients = this.transients[id2] || (this.transients[id2] = {});
19772           if (transients[key] !== void 0) {
19773             return transients[key];
19774           }
19775           transients[key] = fn.call(entity);
19776           return transients[key];
19777         },
19778         parentWays: function(entity) {
19779           var parents = this._parentWays[entity.id];
19780           var result = [];
19781           if (parents) {
19782             parents.forEach(function(id2) {
19783               result.push(this.entity(id2));
19784             }, this);
19785           }
19786           return result;
19787         },
19788         isPoi: function(entity) {
19789           var parents = this._parentWays[entity.id];
19790           return !parents || parents.size === 0;
19791         },
19792         isShared: function(entity) {
19793           var parents = this._parentWays[entity.id];
19794           return parents && parents.size > 1;
19795         },
19796         parentRelations: function(entity) {
19797           var parents = this._parentRels[entity.id];
19798           var result = [];
19799           if (parents) {
19800             parents.forEach(function(id2) {
19801               result.push(this.entity(id2));
19802             }, this);
19803           }
19804           return result;
19805         },
19806         parentMultipolygons: function(entity) {
19807           return this.parentRelations(entity).filter(function(relation) {
19808             return relation.isMultipolygon();
19809           });
19810         },
19811         childNodes: function(entity) {
19812           if (this._childNodes[entity.id]) return this._childNodes[entity.id];
19813           if (!entity.nodes) return [];
19814           var nodes = [];
19815           for (var i3 = 0; i3 < entity.nodes.length; i3++) {
19816             nodes[i3] = this.entity(entity.nodes[i3]);
19817           }
19818           if (debug) Object.freeze(nodes);
19819           this._childNodes[entity.id] = nodes;
19820           return this._childNodes[entity.id];
19821         },
19822         base: function() {
19823           return {
19824             "entities": Object.getPrototypeOf(this.entities),
19825             "parentWays": Object.getPrototypeOf(this._parentWays),
19826             "parentRels": Object.getPrototypeOf(this._parentRels)
19827           };
19828         },
19829         // Unlike other graph methods, rebase mutates in place. This is because it
19830         // is used only during the history operation that merges newly downloaded
19831         // data into each state. To external consumers, it should appear as if the
19832         // graph always contained the newly downloaded data.
19833         rebase: function(entities, stack, force) {
19834           var base = this.base();
19835           var i3, j3, k3, id2;
19836           for (i3 = 0; i3 < entities.length; i3++) {
19837             var entity = entities[i3];
19838             if (!entity.visible || !force && base.entities[entity.id]) continue;
19839             base.entities[entity.id] = entity;
19840             this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
19841             if (entity.type === "way") {
19842               for (j3 = 0; j3 < entity.nodes.length; j3++) {
19843                 id2 = entity.nodes[j3];
19844                 for (k3 = 1; k3 < stack.length; k3++) {
19845                   var ents = stack[k3].entities;
19846                   if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
19847                     delete ents[id2];
19848                   }
19849                 }
19850               }
19851             }
19852           }
19853           for (i3 = 0; i3 < stack.length; i3++) {
19854             stack[i3]._updateRebased();
19855           }
19856         },
19857         _updateRebased: function() {
19858           var base = this.base();
19859           Object.keys(this._parentWays).forEach(function(child) {
19860             if (base.parentWays[child]) {
19861               base.parentWays[child].forEach(function(id2) {
19862                 if (!this.entities.hasOwnProperty(id2)) {
19863                   this._parentWays[child].add(id2);
19864                 }
19865               }, this);
19866             }
19867           }, this);
19868           Object.keys(this._parentRels).forEach(function(child) {
19869             if (base.parentRels[child]) {
19870               base.parentRels[child].forEach(function(id2) {
19871                 if (!this.entities.hasOwnProperty(id2)) {
19872                   this._parentRels[child].add(id2);
19873                 }
19874               }, this);
19875             }
19876           }, this);
19877           this.transients = {};
19878         },
19879         // Updates calculated properties (parentWays, parentRels) for the specified change
19880         _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
19881           parentWays = parentWays || this._parentWays;
19882           parentRels = parentRels || this._parentRels;
19883           var type2 = entity && entity.type || oldentity && oldentity.type;
19884           var removed, added, i3;
19885           if (type2 === "way") {
19886             if (oldentity && entity) {
19887               removed = utilArrayDifference(oldentity.nodes, entity.nodes);
19888               added = utilArrayDifference(entity.nodes, oldentity.nodes);
19889             } else if (oldentity) {
19890               removed = oldentity.nodes;
19891               added = [];
19892             } else if (entity) {
19893               removed = [];
19894               added = entity.nodes;
19895             }
19896             for (i3 = 0; i3 < removed.length; i3++) {
19897               parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
19898               parentWays[removed[i3]].delete(oldentity.id);
19899             }
19900             for (i3 = 0; i3 < added.length; i3++) {
19901               parentWays[added[i3]] = new Set(parentWays[added[i3]]);
19902               parentWays[added[i3]].add(entity.id);
19903             }
19904           } else if (type2 === "relation") {
19905             var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m3) {
19906               return m3.id;
19907             }) : [];
19908             var entityMemberIDs = entity ? entity.members.map(function(m3) {
19909               return m3.id;
19910             }) : [];
19911             if (oldentity && entity) {
19912               removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
19913               added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
19914             } else if (oldentity) {
19915               removed = oldentityMemberIDs;
19916               added = [];
19917             } else if (entity) {
19918               removed = [];
19919               added = entityMemberIDs;
19920             }
19921             for (i3 = 0; i3 < removed.length; i3++) {
19922               parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
19923               parentRels[removed[i3]].delete(oldentity.id);
19924             }
19925             for (i3 = 0; i3 < added.length; i3++) {
19926               parentRels[added[i3]] = new Set(parentRels[added[i3]]);
19927               parentRels[added[i3]].add(entity.id);
19928             }
19929           }
19930         },
19931         replace: function(entity) {
19932           if (this.entities[entity.id] === entity) return this;
19933           return this.update(function() {
19934             this._updateCalculated(this.entities[entity.id], entity);
19935             this.entities[entity.id] = entity;
19936           });
19937         },
19938         remove: function(entity) {
19939           return this.update(function() {
19940             this._updateCalculated(entity, void 0);
19941             this.entities[entity.id] = void 0;
19942           });
19943         },
19944         revert: function(id2) {
19945           var baseEntity = this.base().entities[id2];
19946           var headEntity = this.entities[id2];
19947           if (headEntity === baseEntity) return this;
19948           return this.update(function() {
19949             this._updateCalculated(headEntity, baseEntity);
19950             delete this.entities[id2];
19951           });
19952         },
19953         update: function() {
19954           var graph = this.frozen ? coreGraph(this, true) : this;
19955           for (var i3 = 0; i3 < arguments.length; i3++) {
19956             arguments[i3].call(graph, graph);
19957           }
19958           if (this.frozen) graph.frozen = true;
19959           return graph;
19960         },
19961         // Obliterates any existing entities
19962         load: function(entities) {
19963           var base = this.base();
19964           this.entities = Object.create(base.entities);
19965           for (var i3 in entities) {
19966             this.entities[i3] = entities[i3];
19967             this._updateCalculated(base.entities[i3], this.entities[i3]);
19968           }
19969           return this;
19970         }
19971       };
19972     }
19973   });
19974
19975   // modules/osm/intersection.js
19976   var intersection_exports = {};
19977   __export(intersection_exports, {
19978     osmInferRestriction: () => osmInferRestriction,
19979     osmIntersection: () => osmIntersection,
19980     osmTurn: () => osmTurn
19981   });
19982   function osmTurn(turn) {
19983     if (!(this instanceof osmTurn)) {
19984       return new osmTurn(turn);
19985     }
19986     Object.assign(this, turn);
19987   }
19988   function osmIntersection(graph, startVertexId, maxDistance) {
19989     maxDistance = maxDistance || 30;
19990     var vgraph = coreGraph();
19991     var i3, j3, k3;
19992     function memberOfRestriction(entity) {
19993       return graph.parentRelations(entity).some(function(r2) {
19994         return r2.isRestriction();
19995       });
19996     }
19997     function isRoad(way2) {
19998       if (way2.isArea() || way2.isDegenerate()) return false;
19999       var roads = {
20000         "motorway": true,
20001         "motorway_link": true,
20002         "trunk": true,
20003         "trunk_link": true,
20004         "primary": true,
20005         "primary_link": true,
20006         "secondary": true,
20007         "secondary_link": true,
20008         "tertiary": true,
20009         "tertiary_link": true,
20010         "residential": true,
20011         "unclassified": true,
20012         "living_street": true,
20013         "service": true,
20014         "busway": true,
20015         "road": true,
20016         "track": true
20017       };
20018       return roads[way2.tags.highway];
20019     }
20020     var startNode = graph.entity(startVertexId);
20021     var checkVertices = [startNode];
20022     var checkWays;
20023     var vertices = [];
20024     var vertexIds = [];
20025     var vertex;
20026     var ways = [];
20027     var wayIds = [];
20028     var way;
20029     var nodes = [];
20030     var node;
20031     var parents = [];
20032     var parent2;
20033     var actions = [];
20034     while (checkVertices.length) {
20035       vertex = checkVertices.pop();
20036       checkWays = graph.parentWays(vertex);
20037       var hasWays = false;
20038       for (i3 = 0; i3 < checkWays.length; i3++) {
20039         way = checkWays[i3];
20040         if (!isRoad(way) && !memberOfRestriction(way)) continue;
20041         ways.push(way);
20042         hasWays = true;
20043         nodes = utilArrayUniq(graph.childNodes(way));
20044         for (j3 = 0; j3 < nodes.length; j3++) {
20045           node = nodes[j3];
20046           if (node === vertex) continue;
20047           if (vertices.indexOf(node) !== -1) continue;
20048           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue;
20049           var hasParents = false;
20050           parents = graph.parentWays(node);
20051           for (k3 = 0; k3 < parents.length; k3++) {
20052             parent2 = parents[k3];
20053             if (parent2 === way) continue;
20054             if (ways.indexOf(parent2) !== -1) continue;
20055             if (!isRoad(parent2)) continue;
20056             hasParents = true;
20057             break;
20058           }
20059           if (hasParents) {
20060             checkVertices.push(node);
20061           }
20062         }
20063       }
20064       if (hasWays) {
20065         vertices.push(vertex);
20066       }
20067     }
20068     vertices = utilArrayUniq(vertices);
20069     ways = utilArrayUniq(ways);
20070     ways.forEach(function(way2) {
20071       graph.childNodes(way2).forEach(function(node2) {
20072         vgraph = vgraph.replace(node2);
20073       });
20074       vgraph = vgraph.replace(way2);
20075       graph.parentRelations(way2).forEach(function(relation) {
20076         if (relation.isRestriction()) {
20077           if (relation.isValidRestriction(graph)) {
20078             vgraph = vgraph.replace(relation);
20079           } else if (relation.isComplete(graph)) {
20080             actions.push(actionDeleteRelation(relation.id));
20081           }
20082         }
20083       });
20084     });
20085     ways.forEach(function(w3) {
20086       var way2 = vgraph.entity(w3.id);
20087       if (way2.tags.oneway === "-1") {
20088         var action = actionReverse(way2.id, { reverseOneway: true });
20089         actions.push(action);
20090         vgraph = action(vgraph);
20091       }
20092     });
20093     var origCount = osmEntity.id.next.way;
20094     vertices.forEach(function(v3) {
20095       var splitAll = actionSplit([v3.id]).keepHistoryOn("first");
20096       if (!splitAll.disabled(vgraph)) {
20097         splitAll.ways(vgraph).forEach(function(way2) {
20098           var splitOne = actionSplit([v3.id]).limitWays([way2.id]).keepHistoryOn("first");
20099           actions.push(splitOne);
20100           vgraph = splitOne(vgraph);
20101         });
20102       }
20103     });
20104     osmEntity.id.next.way = origCount;
20105     vertexIds = vertices.map(function(v3) {
20106       return v3.id;
20107     });
20108     vertices = [];
20109     ways = [];
20110     vertexIds.forEach(function(id2) {
20111       var vertex2 = vgraph.entity(id2);
20112       var parents2 = vgraph.parentWays(vertex2);
20113       vertices.push(vertex2);
20114       ways = ways.concat(parents2);
20115     });
20116     vertices = utilArrayUniq(vertices);
20117     ways = utilArrayUniq(ways);
20118     vertexIds = vertices.map(function(v3) {
20119       return v3.id;
20120     });
20121     wayIds = ways.map(function(w3) {
20122       return w3.id;
20123     });
20124     function withMetadata(way2, vertexIds2) {
20125       var __oneWay = way2.isOneWay() && !way2.isBiDirectional();
20126       var __first = vertexIds2.indexOf(way2.first()) !== -1;
20127       var __last = vertexIds2.indexOf(way2.last()) !== -1;
20128       var __via = __first && __last;
20129       var __from = __first && !__oneWay || __last;
20130       var __to = __first || __last && !__oneWay;
20131       return way2.update({
20132         __first,
20133         __last,
20134         __from,
20135         __via,
20136         __to,
20137         __oneWay
20138       });
20139     }
20140     ways = [];
20141     wayIds.forEach(function(id2) {
20142       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
20143       vgraph = vgraph.replace(way2);
20144       ways.push(way2);
20145     });
20146     var keepGoing;
20147     var removeWayIds = [];
20148     var removeVertexIds = [];
20149     do {
20150       keepGoing = false;
20151       checkVertices = vertexIds.slice();
20152       for (i3 = 0; i3 < checkVertices.length; i3++) {
20153         var vertexId = checkVertices[i3];
20154         vertex = vgraph.hasEntity(vertexId);
20155         if (!vertex) {
20156           if (vertexIds.indexOf(vertexId) !== -1) {
20157             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
20158           }
20159           removeVertexIds.push(vertexId);
20160           continue;
20161         }
20162         parents = vgraph.parentWays(vertex);
20163         if (parents.length < 3) {
20164           if (vertexIds.indexOf(vertexId) !== -1) {
20165             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
20166           }
20167         }
20168         if (parents.length === 2) {
20169           var a4 = parents[0];
20170           var b3 = parents[1];
20171           var aIsLeaf = a4 && !a4.__via;
20172           var bIsLeaf = b3 && !b3.__via;
20173           var leaf, survivor;
20174           if (aIsLeaf && !bIsLeaf) {
20175             leaf = a4;
20176             survivor = b3;
20177           } else if (!aIsLeaf && bIsLeaf) {
20178             leaf = b3;
20179             survivor = a4;
20180           }
20181           if (leaf && survivor) {
20182             survivor = withMetadata(survivor, vertexIds);
20183             vgraph = vgraph.replace(survivor).remove(leaf);
20184             removeWayIds.push(leaf.id);
20185             keepGoing = true;
20186           }
20187         }
20188         parents = vgraph.parentWays(vertex);
20189         if (parents.length < 2) {
20190           if (vertexIds.indexOf(vertexId) !== -1) {
20191             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
20192           }
20193           removeVertexIds.push(vertexId);
20194           keepGoing = true;
20195         }
20196         if (parents.length < 1) {
20197           vgraph = vgraph.remove(vertex);
20198         }
20199       }
20200     } while (keepGoing);
20201     vertices = vertices.filter(function(vertex2) {
20202       return removeVertexIds.indexOf(vertex2.id) === -1;
20203     }).map(function(vertex2) {
20204       return vgraph.entity(vertex2.id);
20205     });
20206     ways = ways.filter(function(way2) {
20207       return removeWayIds.indexOf(way2.id) === -1;
20208     }).map(function(way2) {
20209       return vgraph.entity(way2.id);
20210     });
20211     var intersection2 = {
20212       graph: vgraph,
20213       actions,
20214       vertices,
20215       ways
20216     };
20217     intersection2.turns = function(fromWayId, maxViaWay) {
20218       if (!fromWayId) return [];
20219       if (!maxViaWay) maxViaWay = 0;
20220       var vgraph2 = intersection2.graph;
20221       var keyVertexIds = intersection2.vertices.map(function(v3) {
20222         return v3.id;
20223       });
20224       var start2 = vgraph2.entity(fromWayId);
20225       if (!start2 || !(start2.__from || start2.__via)) return [];
20226       var maxPathLength = maxViaWay * 2 + 3;
20227       var turns = [];
20228       step(start2);
20229       return turns;
20230       function step(entity, currPath, currRestrictions, matchedRestriction) {
20231         currPath = (currPath || []).slice();
20232         if (currPath.length >= maxPathLength) return;
20233         currPath.push(entity.id);
20234         currRestrictions = (currRestrictions || []).slice();
20235         if (entity.type === "node") {
20236           stepNode(entity, currPath, currRestrictions);
20237         } else {
20238           stepWay(entity, currPath, currRestrictions, matchedRestriction);
20239         }
20240       }
20241       function stepNode(entity, currPath, currRestrictions) {
20242         var i4, j4;
20243         var parents2 = vgraph2.parentWays(entity);
20244         var nextWays = [];
20245         for (i4 = 0; i4 < parents2.length; i4++) {
20246           var way2 = parents2[i4];
20247           if (way2.__oneWay && way2.nodes[0] !== entity.id) continue;
20248           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3) continue;
20249           var restrict = null;
20250           for (j4 = 0; j4 < currRestrictions.length; j4++) {
20251             var restriction = currRestrictions[j4];
20252             var f2 = restriction.memberByRole("from");
20253             var v3 = restriction.membersByRole("via");
20254             var t2 = restriction.memberByRole("to");
20255             var isNo = /^no_/.test(restriction.tags.restriction);
20256             var isOnly = /^only_/.test(restriction.tags.restriction);
20257             if (!(isNo || isOnly)) {
20258               continue;
20259             }
20260             var matchesFrom = f2.id === fromWayId;
20261             var matchesViaTo = false;
20262             var isAlongOnlyPath = false;
20263             if (t2.id === way2.id) {
20264               if (v3.length === 1 && v3[0].type === "node") {
20265                 matchesViaTo = v3[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
20266               } else {
20267                 var pathVias = [];
20268                 for (k3 = 2; k3 < currPath.length; k3 += 2) {
20269                   pathVias.push(currPath[k3]);
20270                 }
20271                 var restrictionVias = [];
20272                 for (k3 = 0; k3 < v3.length; k3++) {
20273                   if (v3[k3].type === "way") {
20274                     restrictionVias.push(v3[k3].id);
20275                   }
20276                 }
20277                 var diff = utilArrayDifference(pathVias, restrictionVias);
20278                 matchesViaTo = !diff.length;
20279               }
20280             } else if (isOnly) {
20281               for (k3 = 0; k3 < v3.length; k3++) {
20282                 if (v3[k3].type === "way" && v3[k3].id === way2.id) {
20283                   isAlongOnlyPath = true;
20284                   break;
20285                 }
20286               }
20287             }
20288             if (matchesViaTo) {
20289               if (isOnly) {
20290                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
20291               } else {
20292                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
20293               }
20294             } else {
20295               if (isAlongOnlyPath) {
20296                 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
20297               } else if (isOnly) {
20298                 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
20299               }
20300             }
20301             if (restrict && restrict.direct) break;
20302           }
20303           nextWays.push({ way: way2, restrict });
20304         }
20305         nextWays.forEach(function(nextWay) {
20306           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
20307         });
20308       }
20309       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
20310         var i4;
20311         if (currPath.length >= 3) {
20312           var turnPath = currPath.slice();
20313           if (matchedRestriction && matchedRestriction.direct === false) {
20314             for (i4 = 0; i4 < turnPath.length; i4++) {
20315               if (turnPath[i4] === matchedRestriction.from) {
20316                 turnPath = turnPath.slice(i4);
20317                 break;
20318               }
20319             }
20320           }
20321           var turn = pathToTurn(turnPath);
20322           if (turn) {
20323             if (matchedRestriction) {
20324               turn.restrictionID = matchedRestriction.id;
20325               turn.no = matchedRestriction.no;
20326               turn.only = matchedRestriction.only;
20327               turn.direct = matchedRestriction.direct;
20328             }
20329             turns.push(osmTurn(turn));
20330           }
20331           if (currPath[0] === currPath[2]) return;
20332         }
20333         if (matchedRestriction && matchedRestriction.end) return;
20334         var n1 = vgraph2.entity(entity.first());
20335         var n22 = vgraph2.entity(entity.last());
20336         var dist = geoSphericalDistance(n1.loc, n22.loc);
20337         var nextNodes = [];
20338         if (currPath.length > 1) {
20339           if (dist > maxDistance) return;
20340           if (!entity.__via) return;
20341         }
20342         if (!entity.__oneWay && // bidirectional..
20343         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
20344         currPath.indexOf(n1.id) === -1) {
20345           nextNodes.push(n1);
20346         }
20347         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
20348         currPath.indexOf(n22.id) === -1) {
20349           nextNodes.push(n22);
20350         }
20351         nextNodes.forEach(function(nextNode) {
20352           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
20353             if (!r2.isRestriction()) return false;
20354             var f2 = r2.memberByRole("from");
20355             if (!f2 || f2.id !== entity.id) return false;
20356             var isOnly = /^only_/.test(r2.tags.restriction);
20357             if (!isOnly) return true;
20358             var isOnlyVia = false;
20359             var v3 = r2.membersByRole("via");
20360             if (v3.length === 1 && v3[0].type === "node") {
20361               isOnlyVia = v3[0].id === nextNode.id;
20362             } else {
20363               for (var i5 = 0; i5 < v3.length; i5++) {
20364                 if (v3[i5].type !== "way") continue;
20365                 var viaWay = vgraph2.entity(v3[i5].id);
20366                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
20367                   isOnlyVia = true;
20368                   break;
20369                 }
20370               }
20371             }
20372             return isOnlyVia;
20373           });
20374           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
20375         });
20376       }
20377       function pathToTurn(path) {
20378         if (path.length < 3) return;
20379         var fromWayId2, fromNodeId, fromVertexId;
20380         var toWayId, toNodeId, toVertexId;
20381         var viaWayIds, viaNodeId, isUturn;
20382         fromWayId2 = path[0];
20383         toWayId = path[path.length - 1];
20384         if (path.length === 3 && fromWayId2 === toWayId) {
20385           var way2 = vgraph2.entity(fromWayId2);
20386           if (way2.__oneWay) return null;
20387           isUturn = true;
20388           viaNodeId = fromVertexId = toVertexId = path[1];
20389           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
20390         } else {
20391           isUturn = false;
20392           fromVertexId = path[1];
20393           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
20394           toVertexId = path[path.length - 2];
20395           toNodeId = adjacentNode(toWayId, toVertexId);
20396           if (path.length === 3) {
20397             viaNodeId = path[1];
20398           } else {
20399             viaWayIds = path.filter(function(entityId) {
20400               return entityId[0] === "w";
20401             });
20402             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
20403           }
20404         }
20405         return {
20406           key: path.join("_"),
20407           path,
20408           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
20409           via: { node: viaNodeId, ways: viaWayIds },
20410           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
20411           u: isUturn
20412         };
20413         function adjacentNode(wayId, affixId) {
20414           var nodes2 = vgraph2.entity(wayId).nodes;
20415           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
20416         }
20417       }
20418     };
20419     return intersection2;
20420   }
20421   function osmInferRestriction(graph, turn, projection2) {
20422     var fromWay = graph.entity(turn.from.way);
20423     var fromNode = graph.entity(turn.from.node);
20424     var fromVertex = graph.entity(turn.from.vertex);
20425     var toWay = graph.entity(turn.to.way);
20426     var toNode = graph.entity(turn.to.node);
20427     var toVertex = graph.entity(turn.to.vertex);
20428     var fromOneWay = fromWay.tags.oneway === "yes";
20429     var toOneWay = toWay.tags.oneway === "yes";
20430     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
20431     while (angle2 < 0) {
20432       angle2 += 360;
20433     }
20434     if (fromNode === toNode) {
20435       return "no_u_turn";
20436     }
20437     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
20438       return "no_u_turn";
20439     }
20440     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
20441       return "no_u_turn";
20442     }
20443     if (angle2 < 158) {
20444       return "no_right_turn";
20445     }
20446     if (angle2 > 202) {
20447       return "no_left_turn";
20448     }
20449     return "no_straight_on";
20450   }
20451   var init_intersection = __esm({
20452     "modules/osm/intersection.js"() {
20453       "use strict";
20454       init_delete_relation();
20455       init_reverse();
20456       init_split();
20457       init_graph();
20458       init_geo2();
20459       init_entity();
20460       init_util();
20461     }
20462   });
20463
20464   // modules/osm/lanes.js
20465   var lanes_exports = {};
20466   __export(lanes_exports, {
20467     osmLanes: () => osmLanes
20468   });
20469   function osmLanes(entity) {
20470     if (entity.type !== "way") return null;
20471     if (!entity.tags.highway) return null;
20472     var tags = entity.tags;
20473     var isOneWay = entity.isOneWay();
20474     var laneCount = getLaneCount(tags, isOneWay);
20475     var maxspeed = parseMaxspeed(tags);
20476     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
20477     var forward = laneDirections.forward;
20478     var backward = laneDirections.backward;
20479     var bothways = laneDirections.bothways;
20480     var turnLanes = {};
20481     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
20482     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
20483     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
20484     var maxspeedLanes = {};
20485     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
20486     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
20487     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
20488     var psvLanes = {};
20489     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
20490     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
20491     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
20492     var busLanes = {};
20493     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
20494     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
20495     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
20496     var taxiLanes = {};
20497     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
20498     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
20499     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
20500     var hovLanes = {};
20501     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
20502     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
20503     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
20504     var hgvLanes = {};
20505     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
20506     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
20507     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
20508     var bicyclewayLanes = {};
20509     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
20510     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
20511     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
20512     var lanesObj = {
20513       forward: [],
20514       backward: [],
20515       unspecified: []
20516     };
20517     mapToLanesObj(lanesObj, turnLanes, "turnLane");
20518     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
20519     mapToLanesObj(lanesObj, psvLanes, "psv");
20520     mapToLanesObj(lanesObj, busLanes, "bus");
20521     mapToLanesObj(lanesObj, taxiLanes, "taxi");
20522     mapToLanesObj(lanesObj, hovLanes, "hov");
20523     mapToLanesObj(lanesObj, hgvLanes, "hgv");
20524     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
20525     return {
20526       metadata: {
20527         count: laneCount,
20528         oneway: isOneWay,
20529         forward,
20530         backward,
20531         bothways,
20532         turnLanes,
20533         maxspeed,
20534         maxspeedLanes,
20535         psvLanes,
20536         busLanes,
20537         taxiLanes,
20538         hovLanes,
20539         hgvLanes,
20540         bicyclewayLanes
20541       },
20542       lanes: lanesObj
20543     };
20544   }
20545   function getLaneCount(tags, isOneWay) {
20546     var count;
20547     if (tags.lanes) {
20548       count = parseInt(tags.lanes, 10);
20549       if (count > 0) {
20550         return count;
20551       }
20552     }
20553     switch (tags.highway) {
20554       case "trunk":
20555       case "motorway":
20556         count = isOneWay ? 2 : 4;
20557         break;
20558       default:
20559         count = isOneWay ? 1 : 2;
20560         break;
20561     }
20562     return count;
20563   }
20564   function parseMaxspeed(tags) {
20565     var maxspeed = tags.maxspeed;
20566     if (!maxspeed) return;
20567     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
20568     if (!maxspeedRegex.test(maxspeed)) return;
20569     return parseInt(maxspeed, 10);
20570   }
20571   function parseLaneDirections(tags, isOneWay, laneCount) {
20572     var forward = parseInt(tags["lanes:forward"], 10);
20573     var backward = parseInt(tags["lanes:backward"], 10);
20574     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
20575     if (parseInt(tags.oneway, 10) === -1) {
20576       forward = 0;
20577       bothways = 0;
20578       backward = laneCount;
20579     } else if (isOneWay) {
20580       forward = laneCount;
20581       bothways = 0;
20582       backward = 0;
20583     } else if (isNaN(forward) && isNaN(backward)) {
20584       backward = Math.floor((laneCount - bothways) / 2);
20585       forward = laneCount - bothways - backward;
20586     } else if (isNaN(forward)) {
20587       if (backward > laneCount - bothways) {
20588         backward = laneCount - bothways;
20589       }
20590       forward = laneCount - bothways - backward;
20591     } else if (isNaN(backward)) {
20592       if (forward > laneCount - bothways) {
20593         forward = laneCount - bothways;
20594       }
20595       backward = laneCount - bothways - forward;
20596     }
20597     return {
20598       forward,
20599       backward,
20600       bothways
20601     };
20602   }
20603   function parseTurnLanes(tag) {
20604     if (!tag) return;
20605     var validValues = [
20606       "left",
20607       "slight_left",
20608       "sharp_left",
20609       "through",
20610       "right",
20611       "slight_right",
20612       "sharp_right",
20613       "reverse",
20614       "merge_to_left",
20615       "merge_to_right",
20616       "none"
20617     ];
20618     return tag.split("|").map(function(s2) {
20619       if (s2 === "") s2 = "none";
20620       return s2.split(";").map(function(d2) {
20621         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
20622       });
20623     });
20624   }
20625   function parseMaxspeedLanes(tag, maxspeed) {
20626     if (!tag) return;
20627     return tag.split("|").map(function(s2) {
20628       if (s2 === "none") return s2;
20629       var m3 = parseInt(s2, 10);
20630       if (s2 === "" || m3 === maxspeed) return null;
20631       return isNaN(m3) ? "unknown" : m3;
20632     });
20633   }
20634   function parseMiscLanes(tag) {
20635     if (!tag) return;
20636     var validValues = [
20637       "yes",
20638       "no",
20639       "designated"
20640     ];
20641     return tag.split("|").map(function(s2) {
20642       if (s2 === "") s2 = "no";
20643       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
20644     });
20645   }
20646   function parseBicycleWay(tag) {
20647     if (!tag) return;
20648     var validValues = [
20649       "yes",
20650       "no",
20651       "designated",
20652       "lane"
20653     ];
20654     return tag.split("|").map(function(s2) {
20655       if (s2 === "") s2 = "no";
20656       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
20657     });
20658   }
20659   function mapToLanesObj(lanesObj, data, key) {
20660     if (data.forward) {
20661       data.forward.forEach(function(l2, i3) {
20662         if (!lanesObj.forward[i3]) lanesObj.forward[i3] = {};
20663         lanesObj.forward[i3][key] = l2;
20664       });
20665     }
20666     if (data.backward) {
20667       data.backward.forEach(function(l2, i3) {
20668         if (!lanesObj.backward[i3]) lanesObj.backward[i3] = {};
20669         lanesObj.backward[i3][key] = l2;
20670       });
20671     }
20672     if (data.unspecified) {
20673       data.unspecified.forEach(function(l2, i3) {
20674         if (!lanesObj.unspecified[i3]) lanesObj.unspecified[i3] = {};
20675         lanesObj.unspecified[i3][key] = l2;
20676       });
20677     }
20678   }
20679   var init_lanes = __esm({
20680     "modules/osm/lanes.js"() {
20681       "use strict";
20682     }
20683   });
20684
20685   // modules/osm/index.js
20686   var osm_exports = {};
20687   __export(osm_exports, {
20688     QAItem: () => QAItem,
20689     osmAreaKeys: () => osmAreaKeys,
20690     osmChangeset: () => osmChangeset,
20691     osmEntity: () => osmEntity,
20692     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
20693     osmInferRestriction: () => osmInferRestriction,
20694     osmIntersection: () => osmIntersection,
20695     osmIsInterestingTag: () => osmIsInterestingTag,
20696     osmJoinWays: () => osmJoinWays,
20697     osmLanes: () => osmLanes,
20698     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
20699     osmNode: () => osmNode,
20700     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
20701     osmNote: () => osmNote,
20702     osmPavedTags: () => osmPavedTags,
20703     osmPointTags: () => osmPointTags,
20704     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
20705     osmRelation: () => osmRelation,
20706     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
20707     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
20708     osmSetAreaKeys: () => osmSetAreaKeys,
20709     osmSetPointTags: () => osmSetPointTags,
20710     osmSetVertexTags: () => osmSetVertexTags,
20711     osmTagSuggestingArea: () => osmTagSuggestingArea,
20712     osmTurn: () => osmTurn,
20713     osmVertexTags: () => osmVertexTags,
20714     osmWay: () => osmWay
20715   });
20716   var init_osm = __esm({
20717     "modules/osm/index.js"() {
20718       "use strict";
20719       init_changeset();
20720       init_entity();
20721       init_node2();
20722       init_note();
20723       init_relation();
20724       init_way();
20725       init_qa_item();
20726       init_intersection();
20727       init_lanes();
20728       init_multipolygon();
20729       init_tags();
20730     }
20731   });
20732
20733   // modules/actions/merge_polygon.js
20734   var merge_polygon_exports = {};
20735   __export(merge_polygon_exports, {
20736     actionMergePolygon: () => actionMergePolygon
20737   });
20738   function actionMergePolygon(ids, newRelationId) {
20739     function groupEntities(graph) {
20740       var entities = ids.map(function(id2) {
20741         return graph.entity(id2);
20742       });
20743       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
20744         if (entity.type === "way" && entity.isClosed()) {
20745           return "closedWay";
20746         } else if (entity.type === "relation" && entity.isMultipolygon()) {
20747           return "multipolygon";
20748         } else {
20749           return "other";
20750         }
20751       });
20752       return Object.assign(
20753         { closedWay: [], multipolygon: [], other: [] },
20754         geometryGroups
20755       );
20756     }
20757     var action = function(graph) {
20758       var entities = groupEntities(graph);
20759       var polygons = entities.multipolygon.reduce(function(polygons2, m3) {
20760         return polygons2.concat(osmJoinWays(m3.members, graph));
20761       }, []).concat(entities.closedWay.map(function(d2) {
20762         var member = [{ id: d2.id }];
20763         member.nodes = graph.childNodes(d2);
20764         return member;
20765       }));
20766       var contained = polygons.map(function(w3, i3) {
20767         return polygons.map(function(d2, n3) {
20768           if (i3 === n3) return null;
20769           return geoPolygonContainsPolygon(
20770             d2.nodes.map(function(n4) {
20771               return n4.loc;
20772             }),
20773             w3.nodes.map(function(n4) {
20774               return n4.loc;
20775             })
20776           );
20777         });
20778       });
20779       var members = [];
20780       var outer = true;
20781       while (polygons.length) {
20782         extractUncontained(polygons);
20783         polygons = polygons.filter(isContained);
20784         contained = contained.filter(isContained).map(filterContained);
20785       }
20786       function isContained(d2, i3) {
20787         return contained[i3].some(function(val) {
20788           return val;
20789         });
20790       }
20791       function filterContained(d2) {
20792         return d2.filter(isContained);
20793       }
20794       function extractUncontained(polygons2) {
20795         polygons2.forEach(function(d2, i3) {
20796           if (!isContained(d2, i3)) {
20797             d2.forEach(function(member) {
20798               members.push({
20799                 type: "way",
20800                 id: member.id,
20801                 role: outer ? "outer" : "inner"
20802               });
20803             });
20804           }
20805         });
20806         outer = !outer;
20807       }
20808       var relation;
20809       if (entities.multipolygon.length > 0) {
20810         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
20811         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
20812       } else {
20813         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
20814       }
20815       entities.multipolygon.forEach(function(m3) {
20816         if (m3.id !== relation.id) {
20817           relation = relation.mergeTags(m3.tags);
20818           graph = graph.remove(m3);
20819         }
20820       });
20821       entities.closedWay.forEach(function(way) {
20822         function isThisOuter(m3) {
20823           return m3.id === way.id && m3.role !== "inner";
20824         }
20825         if (members.some(isThisOuter)) {
20826           relation = relation.mergeTags(way.tags);
20827           graph = graph.replace(way.update({ tags: {} }));
20828         }
20829       });
20830       return graph.replace(relation.update({
20831         members,
20832         tags: utilObjectOmit(relation.tags, ["area"])
20833       }));
20834     };
20835     action.disabled = function(graph) {
20836       var entities = groupEntities(graph);
20837       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
20838         return "not_eligible";
20839       }
20840       if (!entities.multipolygon.every(function(r2) {
20841         return r2.isComplete(graph);
20842       })) {
20843         return "incomplete_relation";
20844       }
20845       if (!entities.multipolygon.length) {
20846         var sharedMultipolygons = [];
20847         entities.closedWay.forEach(function(way, i3) {
20848           if (i3 === 0) {
20849             sharedMultipolygons = graph.parentMultipolygons(way);
20850           } else {
20851             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
20852           }
20853         });
20854         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
20855           return relation.members.length === entities.closedWay.length;
20856         });
20857         if (sharedMultipolygons.length) {
20858           return "not_eligible";
20859         }
20860       } else if (entities.closedWay.some(function(way) {
20861         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
20862       })) {
20863         return "not_eligible";
20864       }
20865     };
20866     return action;
20867   }
20868   var init_merge_polygon = __esm({
20869     "modules/actions/merge_polygon.js"() {
20870       "use strict";
20871       init_geo2();
20872       init_osm();
20873       init_util();
20874     }
20875   });
20876
20877   // node_modules/fast-deep-equal/index.js
20878   var require_fast_deep_equal = __commonJS({
20879     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
20880       "use strict";
20881       module2.exports = function equal(a4, b3) {
20882         if (a4 === b3) return true;
20883         if (a4 && b3 && typeof a4 == "object" && typeof b3 == "object") {
20884           if (a4.constructor !== b3.constructor) return false;
20885           var length2, i3, keys2;
20886           if (Array.isArray(a4)) {
20887             length2 = a4.length;
20888             if (length2 != b3.length) return false;
20889             for (i3 = length2; i3-- !== 0; )
20890               if (!equal(a4[i3], b3[i3])) return false;
20891             return true;
20892           }
20893           if (a4.constructor === RegExp) return a4.source === b3.source && a4.flags === b3.flags;
20894           if (a4.valueOf !== Object.prototype.valueOf) return a4.valueOf() === b3.valueOf();
20895           if (a4.toString !== Object.prototype.toString) return a4.toString() === b3.toString();
20896           keys2 = Object.keys(a4);
20897           length2 = keys2.length;
20898           if (length2 !== Object.keys(b3).length) return false;
20899           for (i3 = length2; i3-- !== 0; )
20900             if (!Object.prototype.hasOwnProperty.call(b3, keys2[i3])) return false;
20901           for (i3 = length2; i3-- !== 0; ) {
20902             var key = keys2[i3];
20903             if (!equal(a4[key], b3[key])) return false;
20904           }
20905           return true;
20906         }
20907         return a4 !== a4 && b3 !== b3;
20908       };
20909     }
20910   });
20911
20912   // node_modules/node-diff3/index.mjs
20913   function LCS(buffer1, buffer2) {
20914     let equivalenceClasses = {};
20915     for (let j3 = 0; j3 < buffer2.length; j3++) {
20916       const item = buffer2[j3];
20917       if (equivalenceClasses[item]) {
20918         equivalenceClasses[item].push(j3);
20919       } else {
20920         equivalenceClasses[item] = [j3];
20921       }
20922     }
20923     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
20924     let candidates = [NULLRESULT];
20925     for (let i3 = 0; i3 < buffer1.length; i3++) {
20926       const item = buffer1[i3];
20927       const buffer2indices = equivalenceClasses[item] || [];
20928       let r2 = 0;
20929       let c2 = candidates[0];
20930       for (let jx = 0; jx < buffer2indices.length; jx++) {
20931         const j3 = buffer2indices[jx];
20932         let s2;
20933         for (s2 = r2; s2 < candidates.length; s2++) {
20934           if (candidates[s2].buffer2index < j3 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j3)) {
20935             break;
20936           }
20937         }
20938         if (s2 < candidates.length) {
20939           const newCandidate = { buffer1index: i3, buffer2index: j3, chain: candidates[s2] };
20940           if (r2 === candidates.length) {
20941             candidates.push(c2);
20942           } else {
20943             candidates[r2] = c2;
20944           }
20945           r2 = s2 + 1;
20946           c2 = newCandidate;
20947           if (r2 === candidates.length) {
20948             break;
20949           }
20950         }
20951       }
20952       candidates[r2] = c2;
20953     }
20954     return candidates[candidates.length - 1];
20955   }
20956   function diffIndices(buffer1, buffer2) {
20957     const lcs = LCS(buffer1, buffer2);
20958     let result = [];
20959     let tail1 = buffer1.length;
20960     let tail2 = buffer2.length;
20961     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
20962       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
20963       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
20964       tail1 = candidate.buffer1index;
20965       tail2 = candidate.buffer2index;
20966       if (mismatchLength1 || mismatchLength2) {
20967         result.push({
20968           buffer1: [tail1 + 1, mismatchLength1],
20969           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
20970           buffer2: [tail2 + 1, mismatchLength2],
20971           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
20972         });
20973       }
20974     }
20975     result.reverse();
20976     return result;
20977   }
20978   function diff3MergeRegions(a4, o2, b3) {
20979     let hunks = [];
20980     function addHunk(h3, ab) {
20981       hunks.push({
20982         ab,
20983         oStart: h3.buffer1[0],
20984         oLength: h3.buffer1[1],
20985         // length of o to remove
20986         abStart: h3.buffer2[0],
20987         abLength: h3.buffer2[1]
20988         // length of a/b to insert
20989         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
20990       });
20991     }
20992     diffIndices(o2, a4).forEach((item) => addHunk(item, "a"));
20993     diffIndices(o2, b3).forEach((item) => addHunk(item, "b"));
20994     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
20995     let results = [];
20996     let currOffset = 0;
20997     function advanceTo(endOffset) {
20998       if (endOffset > currOffset) {
20999         results.push({
21000           stable: true,
21001           buffer: "o",
21002           bufferStart: currOffset,
21003           bufferLength: endOffset - currOffset,
21004           bufferContent: o2.slice(currOffset, endOffset)
21005         });
21006         currOffset = endOffset;
21007       }
21008     }
21009     while (hunks.length) {
21010       let hunk = hunks.shift();
21011       let regionStart = hunk.oStart;
21012       let regionEnd = hunk.oStart + hunk.oLength;
21013       let regionHunks = [hunk];
21014       advanceTo(regionStart);
21015       while (hunks.length) {
21016         const nextHunk = hunks[0];
21017         const nextHunkStart = nextHunk.oStart;
21018         if (nextHunkStart > regionEnd) break;
21019         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
21020         regionHunks.push(hunks.shift());
21021       }
21022       if (regionHunks.length === 1) {
21023         if (hunk.abLength > 0) {
21024           const buffer = hunk.ab === "a" ? a4 : b3;
21025           results.push({
21026             stable: true,
21027             buffer: hunk.ab,
21028             bufferStart: hunk.abStart,
21029             bufferLength: hunk.abLength,
21030             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
21031           });
21032         }
21033       } else {
21034         let bounds = {
21035           a: [a4.length, -1, o2.length, -1],
21036           b: [b3.length, -1, o2.length, -1]
21037         };
21038         while (regionHunks.length) {
21039           hunk = regionHunks.shift();
21040           const oStart = hunk.oStart;
21041           const oEnd = oStart + hunk.oLength;
21042           const abStart = hunk.abStart;
21043           const abEnd = abStart + hunk.abLength;
21044           let b4 = bounds[hunk.ab];
21045           b4[0] = Math.min(abStart, b4[0]);
21046           b4[1] = Math.max(abEnd, b4[1]);
21047           b4[2] = Math.min(oStart, b4[2]);
21048           b4[3] = Math.max(oEnd, b4[3]);
21049         }
21050         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
21051         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
21052         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
21053         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
21054         let result = {
21055           stable: false,
21056           aStart,
21057           aLength: aEnd - aStart,
21058           aContent: a4.slice(aStart, aEnd),
21059           oStart: regionStart,
21060           oLength: regionEnd - regionStart,
21061           oContent: o2.slice(regionStart, regionEnd),
21062           bStart,
21063           bLength: bEnd - bStart,
21064           bContent: b3.slice(bStart, bEnd)
21065         };
21066         results.push(result);
21067       }
21068       currOffset = regionEnd;
21069     }
21070     advanceTo(o2.length);
21071     return results;
21072   }
21073   function diff3Merge(a4, o2, b3, options) {
21074     let defaults = {
21075       excludeFalseConflicts: true,
21076       stringSeparator: /\s+/
21077     };
21078     options = Object.assign(defaults, options);
21079     if (typeof a4 === "string") a4 = a4.split(options.stringSeparator);
21080     if (typeof o2 === "string") o2 = o2.split(options.stringSeparator);
21081     if (typeof b3 === "string") b3 = b3.split(options.stringSeparator);
21082     let results = [];
21083     const regions = diff3MergeRegions(a4, o2, b3);
21084     let okBuffer = [];
21085     function flushOk() {
21086       if (okBuffer.length) {
21087         results.push({ ok: okBuffer });
21088       }
21089       okBuffer = [];
21090     }
21091     function isFalseConflict(a5, b4) {
21092       if (a5.length !== b4.length) return false;
21093       for (let i3 = 0; i3 < a5.length; i3++) {
21094         if (a5[i3] !== b4[i3]) return false;
21095       }
21096       return true;
21097     }
21098     regions.forEach((region) => {
21099       if (region.stable) {
21100         okBuffer.push(...region.bufferContent);
21101       } else {
21102         if (options.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
21103           okBuffer.push(...region.aContent);
21104         } else {
21105           flushOk();
21106           results.push({
21107             conflict: {
21108               a: region.aContent,
21109               aIndex: region.aStart,
21110               o: region.oContent,
21111               oIndex: region.oStart,
21112               b: region.bContent,
21113               bIndex: region.bStart
21114             }
21115           });
21116         }
21117       }
21118     });
21119     flushOk();
21120     return results;
21121   }
21122   var init_node_diff3 = __esm({
21123     "node_modules/node-diff3/index.mjs"() {
21124     }
21125   });
21126
21127   // modules/actions/merge_remote_changes.js
21128   var merge_remote_changes_exports = {};
21129   __export(merge_remote_changes_exports, {
21130     actionMergeRemoteChanges: () => actionMergeRemoteChanges
21131   });
21132   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
21133     discardTags = discardTags || {};
21134     var _option = "safe";
21135     var _conflicts = [];
21136     function user(d2) {
21137       return typeof formatUser === "function" ? formatUser(d2) : escape_default(d2);
21138     }
21139     function mergeLocation(remote, target) {
21140       function pointEqual(a4, b3) {
21141         var epsilon3 = 1e-6;
21142         return Math.abs(a4[0] - b3[0]) < epsilon3 && Math.abs(a4[1] - b3[1]) < epsilon3;
21143       }
21144       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
21145         return target;
21146       }
21147       if (_option === "force_remote") {
21148         return target.update({ loc: remote.loc });
21149       }
21150       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
21151       return target;
21152     }
21153     function mergeNodes(base, remote, target) {
21154       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
21155         return target;
21156       }
21157       if (_option === "force_remote") {
21158         return target.update({ nodes: remote.nodes });
21159       }
21160       var ccount = _conflicts.length;
21161       var o2 = base.nodes || [];
21162       var a4 = target.nodes || [];
21163       var b3 = remote.nodes || [];
21164       var nodes = [];
21165       var hunks = diff3Merge(a4, o2, b3, { excludeFalseConflicts: true });
21166       for (var i3 = 0; i3 < hunks.length; i3++) {
21167         var hunk = hunks[i3];
21168         if (hunk.ok) {
21169           nodes.push.apply(nodes, hunk.ok);
21170         } else {
21171           var c2 = hunk.conflict;
21172           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
21173             nodes.push.apply(nodes, c2.b);
21174           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
21175             nodes.push.apply(nodes, c2.a);
21176           } else {
21177             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
21178             break;
21179           }
21180         }
21181       }
21182       return _conflicts.length === ccount ? target.update({ nodes }) : target;
21183     }
21184     function mergeChildren(targetWay, children2, updates, graph) {
21185       function isUsed(node2, targetWay2) {
21186         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
21187           return way.id !== targetWay2.id;
21188         });
21189         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
21190       }
21191       var ccount = _conflicts.length;
21192       for (var i3 = 0; i3 < children2.length; i3++) {
21193         var id3 = children2[i3];
21194         var node = graph.hasEntity(id3);
21195         if (targetWay.nodes.indexOf(id3) === -1) {
21196           if (node && !isUsed(node, targetWay)) {
21197             updates.removeIds.push(id3);
21198           }
21199           continue;
21200         }
21201         var local = localGraph.hasEntity(id3);
21202         var remote = remoteGraph.hasEntity(id3);
21203         var target;
21204         if (_option === "force_remote" && remote && remote.visible) {
21205           updates.replacements.push(remote);
21206         } else if (_option === "force_local" && local) {
21207           target = osmEntity(local);
21208           if (remote) {
21209             target = target.update({ version: remote.version });
21210           }
21211           updates.replacements.push(target);
21212         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
21213           target = osmEntity(local, { version: remote.version });
21214           if (remote.visible) {
21215             target = mergeLocation(remote, target);
21216           } else {
21217             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
21218           }
21219           if (_conflicts.length !== ccount) break;
21220           updates.replacements.push(target);
21221         }
21222       }
21223       return targetWay;
21224     }
21225     function updateChildren(updates, graph) {
21226       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
21227         graph = graph.replace(updates.replacements[i3]);
21228       }
21229       if (updates.removeIds.length) {
21230         graph = actionDeleteMultiple(updates.removeIds)(graph);
21231       }
21232       return graph;
21233     }
21234     function mergeMembers(remote, target) {
21235       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
21236         return target;
21237       }
21238       if (_option === "force_remote") {
21239         return target.update({ members: remote.members });
21240       }
21241       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
21242       return target;
21243     }
21244     function mergeTags(base, remote, target) {
21245       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
21246         return target;
21247       }
21248       if (_option === "force_remote") {
21249         return target.update({ tags: remote.tags });
21250       }
21251       var ccount = _conflicts.length;
21252       var o2 = base.tags || {};
21253       var a4 = target.tags || {};
21254       var b3 = remote.tags || {};
21255       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a4)), Object.keys(b3)).filter(function(k4) {
21256         return !discardTags[k4];
21257       });
21258       var tags = Object.assign({}, a4);
21259       var changed = false;
21260       for (var i3 = 0; i3 < keys2.length; i3++) {
21261         var k3 = keys2[i3];
21262         if (o2[k3] !== b3[k3] && a4[k3] !== b3[k3]) {
21263           if (o2[k3] !== a4[k3]) {
21264             _conflicts.push(_t.html(
21265               "merge_remote_changes.conflict.tags",
21266               { tag: k3, local: a4[k3], remote: b3[k3], user: { html: user(remote.user) } }
21267             ));
21268           } else {
21269             if (b3.hasOwnProperty(k3)) {
21270               tags[k3] = b3[k3];
21271             } else {
21272               delete tags[k3];
21273             }
21274             changed = true;
21275           }
21276         }
21277       }
21278       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
21279     }
21280     var action = function(graph) {
21281       var updates = { replacements: [], removeIds: [] };
21282       var base = graph.base().entities[id2];
21283       var local = localGraph.entity(id2);
21284       var remote = remoteGraph.entity(id2);
21285       var target = osmEntity(local, { version: remote.version });
21286       if (!remote.visible) {
21287         if (_option === "force_remote") {
21288           return actionDeleteMultiple([id2])(graph);
21289         } else if (_option === "force_local") {
21290           if (target.type === "way") {
21291             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
21292             graph = updateChildren(updates, graph);
21293           }
21294           return graph.replace(target);
21295         } else {
21296           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
21297           return graph;
21298         }
21299       }
21300       if (target.type === "node") {
21301         target = mergeLocation(remote, target);
21302       } else if (target.type === "way") {
21303         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
21304         target = mergeNodes(base, remote, target);
21305         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
21306       } else if (target.type === "relation") {
21307         target = mergeMembers(remote, target);
21308       }
21309       target = mergeTags(base, remote, target);
21310       if (!_conflicts.length) {
21311         graph = updateChildren(updates, graph).replace(target);
21312       }
21313       return graph;
21314     };
21315     action.withOption = function(opt) {
21316       _option = opt;
21317       return action;
21318     };
21319     action.conflicts = function() {
21320       return _conflicts;
21321     };
21322     return action;
21323   }
21324   var import_fast_deep_equal;
21325   var init_merge_remote_changes = __esm({
21326     "modules/actions/merge_remote_changes.js"() {
21327       "use strict";
21328       import_fast_deep_equal = __toESM(require_fast_deep_equal());
21329       init_node_diff3();
21330       init_lodash();
21331       init_localizer();
21332       init_delete_multiple();
21333       init_osm();
21334       init_util();
21335     }
21336   });
21337
21338   // modules/actions/move.js
21339   var move_exports = {};
21340   __export(move_exports, {
21341     actionMove: () => actionMove
21342   });
21343   function actionMove(moveIDs, tryDelta, projection2, cache) {
21344     var _delta = tryDelta;
21345     function setupCache(graph) {
21346       function canMove(nodeID) {
21347         if (moveIDs.indexOf(nodeID) !== -1) return true;
21348         var parents = graph.parentWays(graph.entity(nodeID));
21349         if (parents.length < 3) return true;
21350         var parentsMoving = parents.every(function(way) {
21351           return cache.moving[way.id];
21352         });
21353         if (!parentsMoving) delete cache.moving[nodeID];
21354         return parentsMoving;
21355       }
21356       function cacheEntities(ids) {
21357         for (var i3 = 0; i3 < ids.length; i3++) {
21358           var id2 = ids[i3];
21359           if (cache.moving[id2]) continue;
21360           cache.moving[id2] = true;
21361           var entity = graph.hasEntity(id2);
21362           if (!entity) continue;
21363           if (entity.type === "node") {
21364             cache.nodes.push(id2);
21365             cache.startLoc[id2] = entity.loc;
21366           } else if (entity.type === "way") {
21367             cache.ways.push(id2);
21368             cacheEntities(entity.nodes);
21369           } else {
21370             cacheEntities(entity.members.map(function(member) {
21371               return member.id;
21372             }));
21373           }
21374         }
21375       }
21376       function cacheIntersections(ids) {
21377         function isEndpoint(way2, id3) {
21378           return !way2.isClosed() && !!way2.affix(id3);
21379         }
21380         for (var i3 = 0; i3 < ids.length; i3++) {
21381           var id2 = ids[i3];
21382           var childNodes = graph.childNodes(graph.entity(id2));
21383           for (var j3 = 0; j3 < childNodes.length; j3++) {
21384             var node = childNodes[j3];
21385             var parents = graph.parentWays(node);
21386             if (parents.length !== 2) continue;
21387             var moved = graph.entity(id2);
21388             var unmoved = null;
21389             for (var k3 = 0; k3 < parents.length; k3++) {
21390               var way = parents[k3];
21391               if (!cache.moving[way.id]) {
21392                 unmoved = way;
21393                 break;
21394               }
21395             }
21396             if (!unmoved) continue;
21397             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) continue;
21398             if (moved.isArea() || unmoved.isArea()) continue;
21399             cache.intersections.push({
21400               nodeId: node.id,
21401               movedId: moved.id,
21402               unmovedId: unmoved.id,
21403               movedIsEP: isEndpoint(moved, node.id),
21404               unmovedIsEP: isEndpoint(unmoved, node.id)
21405             });
21406           }
21407         }
21408       }
21409       if (!cache) {
21410         cache = {};
21411       }
21412       if (!cache.ok) {
21413         cache.moving = {};
21414         cache.intersections = [];
21415         cache.replacedVertex = {};
21416         cache.startLoc = {};
21417         cache.nodes = [];
21418         cache.ways = [];
21419         cacheEntities(moveIDs);
21420         cacheIntersections(cache.ways);
21421         cache.nodes = cache.nodes.filter(canMove);
21422         cache.ok = true;
21423       }
21424     }
21425     function replaceMovedVertex(nodeId, wayId, graph, delta) {
21426       var way = graph.entity(wayId);
21427       var moved = graph.entity(nodeId);
21428       var movedIndex = way.nodes.indexOf(nodeId);
21429       var len, prevIndex, nextIndex;
21430       if (way.isClosed()) {
21431         len = way.nodes.length - 1;
21432         prevIndex = (movedIndex + len - 1) % len;
21433         nextIndex = (movedIndex + len + 1) % len;
21434       } else {
21435         len = way.nodes.length;
21436         prevIndex = movedIndex - 1;
21437         nextIndex = movedIndex + 1;
21438       }
21439       var prev = graph.hasEntity(way.nodes[prevIndex]);
21440       var next = graph.hasEntity(way.nodes[nextIndex]);
21441       if (!prev || !next) return graph;
21442       var key = wayId + "_" + nodeId;
21443       var orig = cache.replacedVertex[key];
21444       if (!orig) {
21445         orig = osmNode();
21446         cache.replacedVertex[key] = orig;
21447         cache.startLoc[orig.id] = cache.startLoc[nodeId];
21448       }
21449       var start2, end;
21450       if (delta) {
21451         start2 = projection2(cache.startLoc[nodeId]);
21452         end = projection2.invert(geoVecAdd(start2, delta));
21453       } else {
21454         end = cache.startLoc[nodeId];
21455       }
21456       orig = orig.move(end);
21457       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
21458       if (angle2 > 175 && angle2 < 185) return graph;
21459       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
21460       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
21461       var d1 = geoPathLength(p1);
21462       var d2 = geoPathLength(p2);
21463       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
21464       if (way.isClosed() && insertAt === 0) insertAt = len;
21465       way = way.addNode(orig.id, insertAt);
21466       return graph.replace(orig).replace(way);
21467     }
21468     function removeDuplicateVertices(wayId, graph) {
21469       var way = graph.entity(wayId);
21470       var epsilon3 = 1e-6;
21471       var prev, curr;
21472       function isInteresting(node, graph2) {
21473         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
21474       }
21475       for (var i3 = 0; i3 < way.nodes.length; i3++) {
21476         curr = graph.entity(way.nodes[i3]);
21477         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
21478           if (!isInteresting(prev, graph)) {
21479             way = way.removeNode(prev.id);
21480             graph = graph.replace(way).remove(prev);
21481           } else if (!isInteresting(curr, graph)) {
21482             way = way.removeNode(curr.id);
21483             graph = graph.replace(way).remove(curr);
21484           }
21485         }
21486         prev = curr;
21487       }
21488       return graph;
21489     }
21490     function unZorroIntersection(intersection2, graph) {
21491       var vertex = graph.entity(intersection2.nodeId);
21492       var way1 = graph.entity(intersection2.movedId);
21493       var way2 = graph.entity(intersection2.unmovedId);
21494       var isEP1 = intersection2.movedIsEP;
21495       var isEP2 = intersection2.unmovedIsEP;
21496       if (isEP1 && isEP2) return graph;
21497       var nodes1 = graph.childNodes(way1).filter(function(n3) {
21498         return n3 !== vertex;
21499       });
21500       var nodes2 = graph.childNodes(way2).filter(function(n3) {
21501         return n3 !== vertex;
21502       });
21503       if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]);
21504       if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]);
21505       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
21506       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
21507       var loc;
21508       if (!isEP1 && !isEP2) {
21509         var epsilon3 = 1e-6, maxIter = 10;
21510         for (var i3 = 0; i3 < maxIter; i3++) {
21511           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
21512           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
21513           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
21514           if (Math.abs(edge1.distance - edge2.distance) < epsilon3) break;
21515         }
21516       } else if (!isEP1) {
21517         loc = edge1.loc;
21518       } else {
21519         loc = edge2.loc;
21520       }
21521       graph = graph.replace(vertex.move(loc));
21522       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
21523         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
21524         graph = graph.replace(way1);
21525       }
21526       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
21527         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
21528         graph = graph.replace(way2);
21529       }
21530       return graph;
21531     }
21532     function cleanupIntersections(graph) {
21533       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
21534         var obj = cache.intersections[i3];
21535         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
21536         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
21537         graph = unZorroIntersection(obj, graph);
21538         graph = removeDuplicateVertices(obj.movedId, graph);
21539         graph = removeDuplicateVertices(obj.unmovedId, graph);
21540       }
21541       return graph;
21542     }
21543     function limitDelta(graph) {
21544       function moveNode(loc) {
21545         return geoVecAdd(projection2(loc), _delta);
21546       }
21547       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
21548         var obj = cache.intersections[i3];
21549         if (obj.movedIsEP && obj.unmovedIsEP) continue;
21550         if (!obj.movedIsEP) continue;
21551         var node = graph.entity(obj.nodeId);
21552         var start2 = projection2(node.loc);
21553         var end = geoVecAdd(start2, _delta);
21554         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
21555         var movedPath = movedNodes.map(function(n3) {
21556           return moveNode(n3.loc);
21557         });
21558         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
21559         var unmovedPath = unmovedNodes.map(function(n3) {
21560           return projection2(n3.loc);
21561         });
21562         var hits = geoPathIntersections(movedPath, unmovedPath);
21563         for (var j3 = 0; i3 < hits.length; i3++) {
21564           if (geoVecEqual(hits[j3], end)) continue;
21565           var edge = geoChooseEdge(unmovedNodes, end, projection2);
21566           _delta = geoVecSubtract(projection2(edge.loc), start2);
21567         }
21568       }
21569     }
21570     var action = function(graph) {
21571       if (_delta[0] === 0 && _delta[1] === 0) return graph;
21572       setupCache(graph);
21573       if (cache.intersections.length) {
21574         limitDelta(graph);
21575       }
21576       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
21577         var node = graph.entity(cache.nodes[i3]);
21578         var start2 = projection2(node.loc);
21579         var end = geoVecAdd(start2, _delta);
21580         graph = graph.replace(node.move(projection2.invert(end)));
21581       }
21582       if (cache.intersections.length) {
21583         graph = cleanupIntersections(graph);
21584       }
21585       return graph;
21586     };
21587     action.delta = function() {
21588       return _delta;
21589     };
21590     return action;
21591   }
21592   var init_move = __esm({
21593     "modules/actions/move.js"() {
21594       "use strict";
21595       init_geo2();
21596       init_node2();
21597       init_util();
21598     }
21599   });
21600
21601   // modules/actions/move_member.js
21602   var move_member_exports = {};
21603   __export(move_member_exports, {
21604     actionMoveMember: () => actionMoveMember
21605   });
21606   function actionMoveMember(relationId, fromIndex, toIndex) {
21607     return function(graph) {
21608       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
21609     };
21610   }
21611   var init_move_member = __esm({
21612     "modules/actions/move_member.js"() {
21613       "use strict";
21614     }
21615   });
21616
21617   // modules/actions/move_node.js
21618   var move_node_exports = {};
21619   __export(move_node_exports, {
21620     actionMoveNode: () => actionMoveNode
21621   });
21622   function actionMoveNode(nodeID, toLoc) {
21623     var action = function(graph, t2) {
21624       if (t2 === null || !isFinite(t2)) t2 = 1;
21625       t2 = Math.min(Math.max(+t2, 0), 1);
21626       var node = graph.entity(nodeID);
21627       return graph.replace(
21628         node.move(geoVecInterp(node.loc, toLoc, t2))
21629       );
21630     };
21631     action.transitionable = true;
21632     return action;
21633   }
21634   var init_move_node = __esm({
21635     "modules/actions/move_node.js"() {
21636       "use strict";
21637       init_geo2();
21638     }
21639   });
21640
21641   // modules/actions/noop.js
21642   var noop_exports = {};
21643   __export(noop_exports, {
21644     actionNoop: () => actionNoop
21645   });
21646   function actionNoop() {
21647     return function(graph) {
21648       return graph;
21649     };
21650   }
21651   var init_noop2 = __esm({
21652     "modules/actions/noop.js"() {
21653       "use strict";
21654     }
21655   });
21656
21657   // modules/actions/orthogonalize.js
21658   var orthogonalize_exports = {};
21659   __export(orthogonalize_exports, {
21660     actionOrthogonalize: () => actionOrthogonalize
21661   });
21662   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
21663     var epsilon3 = ep || 1e-4;
21664     var threshold = degThresh || 13;
21665     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
21666     var upperThreshold = Math.cos(threshold * Math.PI / 180);
21667     var action = function(graph, t2) {
21668       if (t2 === null || !isFinite(t2)) t2 = 1;
21669       t2 = Math.min(Math.max(+t2, 0), 1);
21670       var way = graph.entity(wayID);
21671       way = way.removeNode("");
21672       if (way.tags.nonsquare) {
21673         var tags = Object.assign({}, way.tags);
21674         delete tags.nonsquare;
21675         way = way.update({ tags });
21676       }
21677       graph = graph.replace(way);
21678       var isClosed = way.isClosed();
21679       var nodes = graph.childNodes(way).slice();
21680       if (isClosed) nodes.pop();
21681       if (vertexID !== void 0) {
21682         nodes = nodeSubset(nodes, vertexID, isClosed);
21683         if (nodes.length !== 3) return graph;
21684       }
21685       var nodeCount = {};
21686       var points = [];
21687       var corner = { i: 0, dotp: 1 };
21688       var node, point, loc, score, motions, i3, j3;
21689       for (i3 = 0; i3 < nodes.length; i3++) {
21690         node = nodes[i3];
21691         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
21692         points.push({ id: node.id, coord: projection2(node.loc) });
21693       }
21694       if (points.length === 3) {
21695         for (i3 = 0; i3 < 1e3; i3++) {
21696           const motion = calcMotion(points[1], 1, points);
21697           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motion);
21698           score = corner.dotp;
21699           if (score < epsilon3) {
21700             break;
21701           }
21702         }
21703         node = graph.entity(nodes[corner.i].id);
21704         loc = projection2.invert(points[corner.i].coord);
21705         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
21706       } else {
21707         var straights = [];
21708         var simplified = [];
21709         for (i3 = 0; i3 < points.length; i3++) {
21710           point = points[i3];
21711           var dotp = 0;
21712           if (isClosed || i3 > 0 && i3 < points.length - 1) {
21713             var a4 = points[(i3 - 1 + points.length) % points.length];
21714             var b3 = points[(i3 + 1) % points.length];
21715             dotp = Math.abs(geoOrthoNormalizedDotProduct(a4.coord, b3.coord, point.coord));
21716           }
21717           if (dotp > upperThreshold) {
21718             straights.push(point);
21719           } else {
21720             simplified.push(point);
21721           }
21722         }
21723         var bestPoints = clonePoints(simplified);
21724         var originalPoints = clonePoints(simplified);
21725         score = Infinity;
21726         for (i3 = 0; i3 < 1e3; i3++) {
21727           motions = simplified.map(calcMotion);
21728           for (j3 = 0; j3 < motions.length; j3++) {
21729             simplified[j3].coord = geoVecAdd(simplified[j3].coord, motions[j3]);
21730           }
21731           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
21732           if (newScore < score) {
21733             bestPoints = clonePoints(simplified);
21734             score = newScore;
21735           }
21736           if (score < epsilon3) {
21737             break;
21738           }
21739         }
21740         var bestCoords = bestPoints.map(function(p2) {
21741           return p2.coord;
21742         });
21743         if (isClosed) bestCoords.push(bestCoords[0]);
21744         for (i3 = 0; i3 < bestPoints.length; i3++) {
21745           point = bestPoints[i3];
21746           if (!geoVecEqual(originalPoints[i3].coord, point.coord)) {
21747             node = graph.entity(point.id);
21748             loc = projection2.invert(point.coord);
21749             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
21750           }
21751         }
21752         for (i3 = 0; i3 < straights.length; i3++) {
21753           point = straights[i3];
21754           if (nodeCount[point.id] > 1) continue;
21755           node = graph.entity(point.id);
21756           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
21757             graph = actionDeleteNode(node.id)(graph);
21758           } else {
21759             var choice = geoVecProject(point.coord, bestCoords);
21760             if (choice) {
21761               loc = projection2.invert(choice.target);
21762               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
21763             }
21764           }
21765         }
21766       }
21767       return graph;
21768       function clonePoints(array2) {
21769         return array2.map(function(p2) {
21770           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
21771         });
21772       }
21773       function calcMotion(point2, i4, array2) {
21774         if (!isClosed && (i4 === 0 || i4 === array2.length - 1)) return [0, 0];
21775         if (nodeCount[array2[i4].id] > 1) return [0, 0];
21776         var a5 = array2[(i4 - 1 + array2.length) % array2.length].coord;
21777         var origin = point2.coord;
21778         var b4 = array2[(i4 + 1) % array2.length].coord;
21779         var p2 = geoVecSubtract(a5, origin);
21780         var q3 = geoVecSubtract(b4, origin);
21781         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q3));
21782         p2 = geoVecNormalize(p2);
21783         q3 = geoVecNormalize(q3);
21784         var dotp2 = p2[0] * q3[0] + p2[1] * q3[1];
21785         var val = Math.abs(dotp2);
21786         if (val < lowerThreshold) {
21787           corner.i = i4;
21788           corner.dotp = val;
21789           var vec = geoVecNormalize(geoVecAdd(p2, q3));
21790           return geoVecScale(vec, 0.1 * dotp2 * scale);
21791         }
21792         return [0, 0];
21793       }
21794     };
21795     function nodeSubset(nodes, vertexID2, isClosed) {
21796       var first = isClosed ? 0 : 1;
21797       var last2 = isClosed ? nodes.length : nodes.length - 1;
21798       for (var i3 = first; i3 < last2; i3++) {
21799         if (nodes[i3].id === vertexID2) {
21800           return [
21801             nodes[(i3 - 1 + nodes.length) % nodes.length],
21802             nodes[i3],
21803             nodes[(i3 + 1) % nodes.length]
21804           ];
21805         }
21806       }
21807       return [];
21808     }
21809     action.disabled = function(graph) {
21810       var way = graph.entity(wayID);
21811       way = way.removeNode("");
21812       graph = graph.replace(way);
21813       let isClosed = way.isClosed();
21814       var nodes = graph.childNodes(way).slice();
21815       if (isClosed) nodes.pop();
21816       var allowStraightAngles = false;
21817       if (vertexID !== void 0) {
21818         allowStraightAngles = true;
21819         nodes = nodeSubset(nodes, vertexID, isClosed);
21820         if (nodes.length !== 3) return "end_vertex";
21821         isClosed = false;
21822       }
21823       var coords = nodes.map(function(n3) {
21824         return projection2(n3.loc);
21825       });
21826       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
21827       if (score === null) {
21828         return "not_squarish";
21829       } else if (score === 0) {
21830         return "square_enough";
21831       } else {
21832         return false;
21833       }
21834     };
21835     action.transitionable = true;
21836     return action;
21837   }
21838   var init_orthogonalize = __esm({
21839     "modules/actions/orthogonalize.js"() {
21840       "use strict";
21841       init_delete_node();
21842       init_geo2();
21843     }
21844   });
21845
21846   // modules/actions/reflect.js
21847   var reflect_exports = {};
21848   __export(reflect_exports, {
21849     actionReflect: () => actionReflect
21850   });
21851   function actionReflect(reflectIds, projection2) {
21852     var _useLongAxis = true;
21853     var action = function(graph, t2) {
21854       if (t2 === null || !isFinite(t2)) t2 = 1;
21855       t2 = Math.min(Math.max(+t2, 0), 1);
21856       var nodes = utilGetAllNodes(reflectIds, graph);
21857       var points = nodes.map(function(n3) {
21858         return projection2(n3.loc);
21859       });
21860       var ssr = geoGetSmallestSurroundingRectangle(points);
21861       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
21862       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
21863       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
21864       var q22 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
21865       var p3, q3;
21866       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q22);
21867       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
21868         p3 = p1;
21869         q3 = q1;
21870       } else {
21871         p3 = p2;
21872         q3 = q22;
21873       }
21874       var dx = q3[0] - p3[0];
21875       var dy = q3[1] - p3[1];
21876       var a4 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
21877       var b3 = 2 * dx * dy / (dx * dx + dy * dy);
21878       for (var i3 = 0; i3 < nodes.length; i3++) {
21879         var node = nodes[i3];
21880         var c2 = projection2(node.loc);
21881         var c22 = [
21882           a4 * (c2[0] - p3[0]) + b3 * (c2[1] - p3[1]) + p3[0],
21883           b3 * (c2[0] - p3[0]) - a4 * (c2[1] - p3[1]) + p3[1]
21884         ];
21885         var loc2 = projection2.invert(c22);
21886         node = node.move(geoVecInterp(node.loc, loc2, t2));
21887         graph = graph.replace(node);
21888       }
21889       return graph;
21890     };
21891     action.useLongAxis = function(val) {
21892       if (!arguments.length) return _useLongAxis;
21893       _useLongAxis = val;
21894       return action;
21895     };
21896     action.transitionable = true;
21897     return action;
21898   }
21899   var init_reflect = __esm({
21900     "modules/actions/reflect.js"() {
21901       "use strict";
21902       init_geo2();
21903       init_util();
21904     }
21905   });
21906
21907   // modules/actions/restrict_turn.js
21908   var restrict_turn_exports = {};
21909   __export(restrict_turn_exports, {
21910     actionRestrictTurn: () => actionRestrictTurn
21911   });
21912   function actionRestrictTurn(turn, restrictionType, restrictionID) {
21913     return function(graph) {
21914       var fromWay = graph.entity(turn.from.way);
21915       var toWay = graph.entity(turn.to.way);
21916       var viaNode = turn.via.node && graph.entity(turn.via.node);
21917       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
21918         return graph.entity(id2);
21919       });
21920       var members = [];
21921       members.push({ id: fromWay.id, type: "way", role: "from" });
21922       if (viaNode) {
21923         members.push({ id: viaNode.id, type: "node", role: "via" });
21924       } else if (viaWays) {
21925         viaWays.forEach(function(viaWay) {
21926           members.push({ id: viaWay.id, type: "way", role: "via" });
21927         });
21928       }
21929       members.push({ id: toWay.id, type: "way", role: "to" });
21930       return graph.replace(osmRelation({
21931         id: restrictionID,
21932         tags: {
21933           type: "restriction",
21934           restriction: restrictionType
21935         },
21936         members
21937       }));
21938     };
21939   }
21940   var init_restrict_turn = __esm({
21941     "modules/actions/restrict_turn.js"() {
21942       "use strict";
21943       init_relation();
21944     }
21945   });
21946
21947   // modules/actions/revert.js
21948   var revert_exports = {};
21949   __export(revert_exports, {
21950     actionRevert: () => actionRevert
21951   });
21952   function actionRevert(id2) {
21953     var action = function(graph) {
21954       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
21955       if (entity && !base) {
21956         if (entity.type === "node") {
21957           graph.parentWays(entity).forEach(function(parent2) {
21958             parent2 = parent2.removeNode(id2);
21959             graph = graph.replace(parent2);
21960             if (parent2.isDegenerate()) {
21961               graph = actionDeleteWay(parent2.id)(graph);
21962             }
21963           });
21964         }
21965         graph.parentRelations(entity).forEach(function(parent2) {
21966           parent2 = parent2.removeMembersWithID(id2);
21967           graph = graph.replace(parent2);
21968           if (parent2.isDegenerate()) {
21969             graph = actionDeleteRelation(parent2.id)(graph);
21970           }
21971         });
21972       }
21973       return graph.revert(id2);
21974     };
21975     return action;
21976   }
21977   var init_revert = __esm({
21978     "modules/actions/revert.js"() {
21979       "use strict";
21980       init_delete_relation();
21981       init_delete_way();
21982     }
21983   });
21984
21985   // modules/actions/rotate.js
21986   var rotate_exports = {};
21987   __export(rotate_exports, {
21988     actionRotate: () => actionRotate
21989   });
21990   function actionRotate(rotateIds, pivot, angle2, projection2) {
21991     var action = function(graph) {
21992       return graph.update(function(graph2) {
21993         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
21994           var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
21995           graph2 = graph2.replace(node.move(projection2.invert(point)));
21996         });
21997       });
21998     };
21999     return action;
22000   }
22001   var init_rotate = __esm({
22002     "modules/actions/rotate.js"() {
22003       "use strict";
22004       init_geo2();
22005       init_util();
22006     }
22007   });
22008
22009   // modules/actions/scale.js
22010   var scale_exports = {};
22011   __export(scale_exports, {
22012     actionScale: () => actionScale
22013   });
22014   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
22015     return function(graph) {
22016       return graph.update(function(graph2) {
22017         let point, radial;
22018         utilGetAllNodes(ids, graph2).forEach(function(node) {
22019           point = projection2(node.loc);
22020           radial = [
22021             point[0] - pivotLoc[0],
22022             point[1] - pivotLoc[1]
22023           ];
22024           point = [
22025             pivotLoc[0] + scaleFactor * radial[0],
22026             pivotLoc[1] + scaleFactor * radial[1]
22027           ];
22028           graph2 = graph2.replace(node.move(projection2.invert(point)));
22029         });
22030       });
22031     };
22032   }
22033   var init_scale = __esm({
22034     "modules/actions/scale.js"() {
22035       "use strict";
22036       init_util();
22037     }
22038   });
22039
22040   // modules/actions/straighten_nodes.js
22041   var straighten_nodes_exports = {};
22042   __export(straighten_nodes_exports, {
22043     actionStraightenNodes: () => actionStraightenNodes
22044   });
22045   function actionStraightenNodes(nodeIDs, projection2) {
22046     function positionAlongWay(a4, o2, b3) {
22047       return geoVecDot(a4, b3, o2) / geoVecDot(b3, b3, o2);
22048     }
22049     function getEndpoints(points) {
22050       var ssr = geoGetSmallestSurroundingRectangle(points);
22051       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
22052       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
22053       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
22054       var q22 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
22055       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q22);
22056       if (isLong) {
22057         return [p1, q1];
22058       }
22059       return [p2, q22];
22060     }
22061     var action = function(graph, t2) {
22062       if (t2 === null || !isFinite(t2)) t2 = 1;
22063       t2 = Math.min(Math.max(+t2, 0), 1);
22064       var nodes = nodeIDs.map(function(id2) {
22065         return graph.entity(id2);
22066       });
22067       var points = nodes.map(function(n3) {
22068         return projection2(n3.loc);
22069       });
22070       var endpoints = getEndpoints(points);
22071       var startPoint = endpoints[0];
22072       var endPoint = endpoints[1];
22073       for (var i3 = 0; i3 < points.length; i3++) {
22074         var node = nodes[i3];
22075         var point = points[i3];
22076         var u2 = positionAlongWay(point, startPoint, endPoint);
22077         var point2 = geoVecInterp(startPoint, endPoint, u2);
22078         var loc2 = projection2.invert(point2);
22079         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
22080       }
22081       return graph;
22082     };
22083     action.disabled = function(graph) {
22084       var nodes = nodeIDs.map(function(id2) {
22085         return graph.entity(id2);
22086       });
22087       var points = nodes.map(function(n3) {
22088         return projection2(n3.loc);
22089       });
22090       var endpoints = getEndpoints(points);
22091       var startPoint = endpoints[0];
22092       var endPoint = endpoints[1];
22093       var maxDistance = 0;
22094       for (var i3 = 0; i3 < points.length; i3++) {
22095         var point = points[i3];
22096         var u2 = positionAlongWay(point, startPoint, endPoint);
22097         var p2 = geoVecInterp(startPoint, endPoint, u2);
22098         var dist = geoVecLength(p2, point);
22099         if (!isNaN(dist) && dist > maxDistance) {
22100           maxDistance = dist;
22101         }
22102       }
22103       if (maxDistance < 1e-4) {
22104         return "straight_enough";
22105       }
22106     };
22107     action.transitionable = true;
22108     return action;
22109   }
22110   var init_straighten_nodes = __esm({
22111     "modules/actions/straighten_nodes.js"() {
22112       "use strict";
22113       init_geo2();
22114     }
22115   });
22116
22117   // modules/actions/straighten_way.js
22118   var straighten_way_exports = {};
22119   __export(straighten_way_exports, {
22120     actionStraightenWay: () => actionStraightenWay
22121   });
22122   function actionStraightenWay(selectedIDs, projection2) {
22123     function positionAlongWay(a4, o2, b3) {
22124       return geoVecDot(a4, b3, o2) / geoVecDot(b3, b3, o2);
22125     }
22126     function allNodes(graph) {
22127       var nodes = [];
22128       var startNodes = [];
22129       var endNodes = [];
22130       var remainingWays = [];
22131       var selectedWays = selectedIDs.filter(function(w3) {
22132         return graph.entity(w3).type === "way";
22133       });
22134       var selectedNodes = selectedIDs.filter(function(n3) {
22135         return graph.entity(n3).type === "node";
22136       });
22137       for (var i3 = 0; i3 < selectedWays.length; i3++) {
22138         var way = graph.entity(selectedWays[i3]);
22139         nodes = way.nodes.slice(0);
22140         remainingWays.push(nodes);
22141         startNodes.push(nodes[0]);
22142         endNodes.push(nodes[nodes.length - 1]);
22143       }
22144       startNodes = startNodes.filter(function(n3) {
22145         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
22146       });
22147       endNodes = endNodes.filter(function(n3) {
22148         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
22149       });
22150       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
22151       var nextWay = [];
22152       nodes = [];
22153       var getNextWay = function(currNode2, remainingWays2) {
22154         return remainingWays2.filter(function(way2) {
22155           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
22156         })[0];
22157       };
22158       while (remainingWays.length) {
22159         nextWay = getNextWay(currNode, remainingWays);
22160         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
22161         if (nextWay[0] !== currNode) {
22162           nextWay.reverse();
22163         }
22164         nodes = nodes.concat(nextWay);
22165         currNode = nodes[nodes.length - 1];
22166       }
22167       if (selectedNodes.length === 2) {
22168         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
22169         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
22170         var sortedStartEnd = [startNodeIdx, endNodeIdx];
22171         sortedStartEnd.sort(function(a4, b3) {
22172           return a4 - b3;
22173         });
22174         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
22175       }
22176       return nodes.map(function(n3) {
22177         return graph.entity(n3);
22178       });
22179     }
22180     function shouldKeepNode(node, graph) {
22181       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
22182     }
22183     var action = function(graph, t2) {
22184       if (t2 === null || !isFinite(t2)) t2 = 1;
22185       t2 = Math.min(Math.max(+t2, 0), 1);
22186       var nodes = allNodes(graph);
22187       var points = nodes.map(function(n3) {
22188         return projection2(n3.loc);
22189       });
22190       var startPoint = points[0];
22191       var endPoint = points[points.length - 1];
22192       var toDelete = [];
22193       var i3;
22194       for (i3 = 1; i3 < points.length - 1; i3++) {
22195         var node = nodes[i3];
22196         var point = points[i3];
22197         if (t2 < 1 || shouldKeepNode(node, graph)) {
22198           var u2 = positionAlongWay(point, startPoint, endPoint);
22199           var p2 = geoVecInterp(startPoint, endPoint, u2);
22200           var loc2 = projection2.invert(p2);
22201           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
22202         } else {
22203           if (toDelete.indexOf(node) === -1) {
22204             toDelete.push(node);
22205           }
22206         }
22207       }
22208       for (i3 = 0; i3 < toDelete.length; i3++) {
22209         graph = actionDeleteNode(toDelete[i3].id)(graph);
22210       }
22211       return graph;
22212     };
22213     action.disabled = function(graph) {
22214       var nodes = allNodes(graph);
22215       var points = nodes.map(function(n3) {
22216         return projection2(n3.loc);
22217       });
22218       var startPoint = points[0];
22219       var endPoint = points[points.length - 1];
22220       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
22221       var i3;
22222       if (threshold === 0) {
22223         return "too_bendy";
22224       }
22225       var maxDistance = 0;
22226       for (i3 = 1; i3 < points.length - 1; i3++) {
22227         var point = points[i3];
22228         var u2 = positionAlongWay(point, startPoint, endPoint);
22229         var p2 = geoVecInterp(startPoint, endPoint, u2);
22230         var dist = geoVecLength(p2, point);
22231         if (isNaN(dist) || dist > threshold) {
22232           return "too_bendy";
22233         } else if (dist > maxDistance) {
22234           maxDistance = dist;
22235         }
22236       }
22237       var keepingAllNodes = nodes.every(function(node, i4) {
22238         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
22239       });
22240       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
22241       keepingAllNodes) {
22242         return "straight_enough";
22243       }
22244     };
22245     action.transitionable = true;
22246     return action;
22247   }
22248   var init_straighten_way = __esm({
22249     "modules/actions/straighten_way.js"() {
22250       "use strict";
22251       init_delete_node();
22252       init_geo2();
22253       init_util();
22254     }
22255   });
22256
22257   // modules/actions/unrestrict_turn.js
22258   var unrestrict_turn_exports = {};
22259   __export(unrestrict_turn_exports, {
22260     actionUnrestrictTurn: () => actionUnrestrictTurn
22261   });
22262   function actionUnrestrictTurn(turn) {
22263     return function(graph) {
22264       return actionDeleteRelation(turn.restrictionID)(graph);
22265     };
22266   }
22267   var init_unrestrict_turn = __esm({
22268     "modules/actions/unrestrict_turn.js"() {
22269       "use strict";
22270       init_delete_relation();
22271     }
22272   });
22273
22274   // modules/actions/upgrade_tags.js
22275   var upgrade_tags_exports = {};
22276   __export(upgrade_tags_exports, {
22277     actionUpgradeTags: () => actionUpgradeTags
22278   });
22279   function actionUpgradeTags(entityId, oldTags, replaceTags) {
22280     return function(graph) {
22281       var entity = graph.entity(entityId);
22282       var tags = Object.assign({}, entity.tags);
22283       var transferValue;
22284       var semiIndex;
22285       for (var oldTagKey in oldTags) {
22286         if (!(oldTagKey in tags)) continue;
22287         if (oldTags[oldTagKey] === "*") {
22288           transferValue = tags[oldTagKey];
22289           delete tags[oldTagKey];
22290         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
22291           delete tags[oldTagKey];
22292         } else {
22293           var vals = tags[oldTagKey].split(";").filter(Boolean);
22294           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
22295           if (vals.length === 1 || oldIndex === -1) {
22296             delete tags[oldTagKey];
22297           } else {
22298             if (replaceTags && replaceTags[oldTagKey]) {
22299               semiIndex = oldIndex;
22300             }
22301             vals.splice(oldIndex, 1);
22302             tags[oldTagKey] = vals.join(";");
22303           }
22304         }
22305       }
22306       if (replaceTags) {
22307         for (var replaceKey in replaceTags) {
22308           var replaceValue = replaceTags[replaceKey];
22309           if (replaceValue === "*") {
22310             if (tags[replaceKey] && tags[replaceKey] !== "no") {
22311               continue;
22312             } else {
22313               tags[replaceKey] = "yes";
22314             }
22315           } else if (replaceValue === "$1") {
22316             tags[replaceKey] = transferValue;
22317           } else {
22318             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
22319               var existingVals = tags[replaceKey].split(";").filter(Boolean);
22320               if (existingVals.indexOf(replaceValue) === -1) {
22321                 existingVals.splice(semiIndex, 0, replaceValue);
22322                 tags[replaceKey] = existingVals.join(";");
22323               }
22324             } else {
22325               tags[replaceKey] = replaceValue;
22326             }
22327           }
22328         }
22329       }
22330       return graph.replace(entity.update({ tags }));
22331     };
22332   }
22333   var init_upgrade_tags = __esm({
22334     "modules/actions/upgrade_tags.js"() {
22335       "use strict";
22336     }
22337   });
22338
22339   // modules/core/preferences.js
22340   var preferences_exports = {};
22341   __export(preferences_exports, {
22342     prefs: () => corePreferences
22343   });
22344   function corePreferences(k3, v3) {
22345     try {
22346       if (v3 === void 0) return _storage.getItem(k3);
22347       else if (v3 === null) _storage.removeItem(k3);
22348       else _storage.setItem(k3, v3);
22349       if (_listeners[k3]) {
22350         _listeners[k3].forEach((handler) => handler(v3));
22351       }
22352       return true;
22353     } catch {
22354       if (typeof console !== "undefined") {
22355         console.error("localStorage quota exceeded");
22356       }
22357       return false;
22358     }
22359   }
22360   var _storage, _listeners;
22361   var init_preferences = __esm({
22362     "modules/core/preferences.js"() {
22363       "use strict";
22364       try {
22365         _storage = localStorage;
22366       } catch {
22367       }
22368       _storage = _storage || /* @__PURE__ */ (() => {
22369         let s2 = {};
22370         return {
22371           getItem: (k3) => s2[k3],
22372           setItem: (k3, v3) => s2[k3] = v3,
22373           removeItem: (k3) => delete s2[k3]
22374         };
22375       })();
22376       _listeners = {};
22377       corePreferences.onChange = function(k3, handler) {
22378         _listeners[k3] = _listeners[k3] || [];
22379         _listeners[k3].push(handler);
22380       };
22381     }
22382   });
22383
22384   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
22385   var require_quickselect = __commonJS({
22386     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
22387       (function(global2, factory) {
22388         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
22389       })(exports2, function() {
22390         "use strict";
22391         function quickselect3(arr, k3, left, right, compare2) {
22392           quickselectStep(arr, k3, left || 0, right || arr.length - 1, compare2 || defaultCompare2);
22393         }
22394         function quickselectStep(arr, k3, left, right, compare2) {
22395           while (right > left) {
22396             if (right - left > 600) {
22397               var n3 = right - left + 1;
22398               var m3 = k3 - left + 1;
22399               var z3 = Math.log(n3);
22400               var s2 = 0.5 * Math.exp(2 * z3 / 3);
22401               var sd = 0.5 * Math.sqrt(z3 * s2 * (n3 - s2) / n3) * (m3 - n3 / 2 < 0 ? -1 : 1);
22402               var newLeft = Math.max(left, Math.floor(k3 - m3 * s2 / n3 + sd));
22403               var newRight = Math.min(right, Math.floor(k3 + (n3 - m3) * s2 / n3 + sd));
22404               quickselectStep(arr, k3, newLeft, newRight, compare2);
22405             }
22406             var t2 = arr[k3];
22407             var i3 = left;
22408             var j3 = right;
22409             swap3(arr, left, k3);
22410             if (compare2(arr[right], t2) > 0) swap3(arr, left, right);
22411             while (i3 < j3) {
22412               swap3(arr, i3, j3);
22413               i3++;
22414               j3--;
22415               while (compare2(arr[i3], t2) < 0) i3++;
22416               while (compare2(arr[j3], t2) > 0) j3--;
22417             }
22418             if (compare2(arr[left], t2) === 0) swap3(arr, left, j3);
22419             else {
22420               j3++;
22421               swap3(arr, j3, right);
22422             }
22423             if (j3 <= k3) left = j3 + 1;
22424             if (k3 <= j3) right = j3 - 1;
22425           }
22426         }
22427         function swap3(arr, i3, j3) {
22428           var tmp = arr[i3];
22429           arr[i3] = arr[j3];
22430           arr[j3] = tmp;
22431         }
22432         function defaultCompare2(a4, b3) {
22433           return a4 < b3 ? -1 : a4 > b3 ? 1 : 0;
22434         }
22435         return quickselect3;
22436       });
22437     }
22438   });
22439
22440   // node_modules/which-polygon/node_modules/rbush/index.js
22441   var require_rbush = __commonJS({
22442     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
22443       "use strict";
22444       module2.exports = rbush;
22445       module2.exports.default = rbush;
22446       var quickselect3 = require_quickselect();
22447       function rbush(maxEntries, format2) {
22448         if (!(this instanceof rbush)) return new rbush(maxEntries, format2);
22449         this._maxEntries = Math.max(4, maxEntries || 9);
22450         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
22451         if (format2) {
22452           this._initFormat(format2);
22453         }
22454         this.clear();
22455       }
22456       rbush.prototype = {
22457         all: function() {
22458           return this._all(this.data, []);
22459         },
22460         search: function(bbox2) {
22461           var node = this.data, result = [], toBBox = this.toBBox;
22462           if (!intersects2(bbox2, node)) return result;
22463           var nodesToSearch = [], i3, len, child, childBBox;
22464           while (node) {
22465             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
22466               child = node.children[i3];
22467               childBBox = node.leaf ? toBBox(child) : child;
22468               if (intersects2(bbox2, childBBox)) {
22469                 if (node.leaf) result.push(child);
22470                 else if (contains2(bbox2, childBBox)) this._all(child, result);
22471                 else nodesToSearch.push(child);
22472               }
22473             }
22474             node = nodesToSearch.pop();
22475           }
22476           return result;
22477         },
22478         collides: function(bbox2) {
22479           var node = this.data, toBBox = this.toBBox;
22480           if (!intersects2(bbox2, node)) return false;
22481           var nodesToSearch = [], i3, len, child, childBBox;
22482           while (node) {
22483             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
22484               child = node.children[i3];
22485               childBBox = node.leaf ? toBBox(child) : child;
22486               if (intersects2(bbox2, childBBox)) {
22487                 if (node.leaf || contains2(bbox2, childBBox)) return true;
22488                 nodesToSearch.push(child);
22489               }
22490             }
22491             node = nodesToSearch.pop();
22492           }
22493           return false;
22494         },
22495         load: function(data) {
22496           if (!(data && data.length)) return this;
22497           if (data.length < this._minEntries) {
22498             for (var i3 = 0, len = data.length; i3 < len; i3++) {
22499               this.insert(data[i3]);
22500             }
22501             return this;
22502           }
22503           var node = this._build(data.slice(), 0, data.length - 1, 0);
22504           if (!this.data.children.length) {
22505             this.data = node;
22506           } else if (this.data.height === node.height) {
22507             this._splitRoot(this.data, node);
22508           } else {
22509             if (this.data.height < node.height) {
22510               var tmpNode = this.data;
22511               this.data = node;
22512               node = tmpNode;
22513             }
22514             this._insert(node, this.data.height - node.height - 1, true);
22515           }
22516           return this;
22517         },
22518         insert: function(item) {
22519           if (item) this._insert(item, this.data.height - 1);
22520           return this;
22521         },
22522         clear: function() {
22523           this.data = createNode2([]);
22524           return this;
22525         },
22526         remove: function(item, equalsFn) {
22527           if (!item) return this;
22528           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent2, index, goingUp;
22529           while (node || path.length) {
22530             if (!node) {
22531               node = path.pop();
22532               parent2 = path[path.length - 1];
22533               i3 = indexes.pop();
22534               goingUp = true;
22535             }
22536             if (node.leaf) {
22537               index = findItem2(item, node.children, equalsFn);
22538               if (index !== -1) {
22539                 node.children.splice(index, 1);
22540                 path.push(node);
22541                 this._condense(path);
22542                 return this;
22543               }
22544             }
22545             if (!goingUp && !node.leaf && contains2(node, bbox2)) {
22546               path.push(node);
22547               indexes.push(i3);
22548               i3 = 0;
22549               parent2 = node;
22550               node = node.children[0];
22551             } else if (parent2) {
22552               i3++;
22553               node = parent2.children[i3];
22554               goingUp = false;
22555             } else node = null;
22556           }
22557           return this;
22558         },
22559         toBBox: function(item) {
22560           return item;
22561         },
22562         compareMinX: compareNodeMinX2,
22563         compareMinY: compareNodeMinY2,
22564         toJSON: function() {
22565           return this.data;
22566         },
22567         fromJSON: function(data) {
22568           this.data = data;
22569           return this;
22570         },
22571         _all: function(node, result) {
22572           var nodesToSearch = [];
22573           while (node) {
22574             if (node.leaf) result.push.apply(result, node.children);
22575             else nodesToSearch.push.apply(nodesToSearch, node.children);
22576             node = nodesToSearch.pop();
22577           }
22578           return result;
22579         },
22580         _build: function(items, left, right, height) {
22581           var N3 = right - left + 1, M3 = this._maxEntries, node;
22582           if (N3 <= M3) {
22583             node = createNode2(items.slice(left, right + 1));
22584             calcBBox2(node, this.toBBox);
22585             return node;
22586           }
22587           if (!height) {
22588             height = Math.ceil(Math.log(N3) / Math.log(M3));
22589             M3 = Math.ceil(N3 / Math.pow(M3, height - 1));
22590           }
22591           node = createNode2([]);
22592           node.leaf = false;
22593           node.height = height;
22594           var N22 = Math.ceil(N3 / M3), N1 = N22 * Math.ceil(Math.sqrt(M3)), i3, j3, right2, right3;
22595           multiSelect2(items, left, right, N1, this.compareMinX);
22596           for (i3 = left; i3 <= right; i3 += N1) {
22597             right2 = Math.min(i3 + N1 - 1, right);
22598             multiSelect2(items, i3, right2, N22, this.compareMinY);
22599             for (j3 = i3; j3 <= right2; j3 += N22) {
22600               right3 = Math.min(j3 + N22 - 1, right2);
22601               node.children.push(this._build(items, j3, right3, height - 1));
22602             }
22603           }
22604           calcBBox2(node, this.toBBox);
22605           return node;
22606         },
22607         _chooseSubtree: function(bbox2, node, level, path) {
22608           var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
22609           while (true) {
22610             path.push(node);
22611             if (node.leaf || path.length - 1 === level) break;
22612             minArea = minEnlargement = Infinity;
22613             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
22614               child = node.children[i3];
22615               area = bboxArea2(child);
22616               enlargement = enlargedArea2(bbox2, child) - area;
22617               if (enlargement < minEnlargement) {
22618                 minEnlargement = enlargement;
22619                 minArea = area < minArea ? area : minArea;
22620                 targetNode = child;
22621               } else if (enlargement === minEnlargement) {
22622                 if (area < minArea) {
22623                   minArea = area;
22624                   targetNode = child;
22625                 }
22626               }
22627             }
22628             node = targetNode || node.children[0];
22629           }
22630           return node;
22631         },
22632         _insert: function(item, level, isNode) {
22633           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
22634           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
22635           node.children.push(item);
22636           extend3(node, bbox2);
22637           while (level >= 0) {
22638             if (insertPath[level].children.length > this._maxEntries) {
22639               this._split(insertPath, level);
22640               level--;
22641             } else break;
22642           }
22643           this._adjustParentBBoxes(bbox2, insertPath, level);
22644         },
22645         // split overflowed node into two
22646         _split: function(insertPath, level) {
22647           var node = insertPath[level], M3 = node.children.length, m3 = this._minEntries;
22648           this._chooseSplitAxis(node, m3, M3);
22649           var splitIndex = this._chooseSplitIndex(node, m3, M3);
22650           var newNode = createNode2(node.children.splice(splitIndex, node.children.length - splitIndex));
22651           newNode.height = node.height;
22652           newNode.leaf = node.leaf;
22653           calcBBox2(node, this.toBBox);
22654           calcBBox2(newNode, this.toBBox);
22655           if (level) insertPath[level - 1].children.push(newNode);
22656           else this._splitRoot(node, newNode);
22657         },
22658         _splitRoot: function(node, newNode) {
22659           this.data = createNode2([node, newNode]);
22660           this.data.height = node.height + 1;
22661           this.data.leaf = false;
22662           calcBBox2(this.data, this.toBBox);
22663         },
22664         _chooseSplitIndex: function(node, m3, M3) {
22665           var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
22666           minOverlap = minArea = Infinity;
22667           for (i3 = m3; i3 <= M3 - m3; i3++) {
22668             bbox1 = distBBox2(node, 0, i3, this.toBBox);
22669             bbox2 = distBBox2(node, i3, M3, this.toBBox);
22670             overlap = intersectionArea2(bbox1, bbox2);
22671             area = bboxArea2(bbox1) + bboxArea2(bbox2);
22672             if (overlap < minOverlap) {
22673               minOverlap = overlap;
22674               index = i3;
22675               minArea = area < minArea ? area : minArea;
22676             } else if (overlap === minOverlap) {
22677               if (area < minArea) {
22678                 minArea = area;
22679                 index = i3;
22680               }
22681             }
22682           }
22683           return index;
22684         },
22685         // sorts node children by the best axis for split
22686         _chooseSplitAxis: function(node, m3, M3) {
22687           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX2, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY2, xMargin = this._allDistMargin(node, m3, M3, compareMinX), yMargin = this._allDistMargin(node, m3, M3, compareMinY);
22688           if (xMargin < yMargin) node.children.sort(compareMinX);
22689         },
22690         // total margin of all possible split distributions where each node is at least m full
22691         _allDistMargin: function(node, m3, M3, compare2) {
22692           node.children.sort(compare2);
22693           var toBBox = this.toBBox, leftBBox = distBBox2(node, 0, m3, toBBox), rightBBox = distBBox2(node, M3 - m3, M3, toBBox), margin = bboxMargin2(leftBBox) + bboxMargin2(rightBBox), i3, child;
22694           for (i3 = m3; i3 < M3 - m3; i3++) {
22695             child = node.children[i3];
22696             extend3(leftBBox, node.leaf ? toBBox(child) : child);
22697             margin += bboxMargin2(leftBBox);
22698           }
22699           for (i3 = M3 - m3 - 1; i3 >= m3; i3--) {
22700             child = node.children[i3];
22701             extend3(rightBBox, node.leaf ? toBBox(child) : child);
22702             margin += bboxMargin2(rightBBox);
22703           }
22704           return margin;
22705         },
22706         _adjustParentBBoxes: function(bbox2, path, level) {
22707           for (var i3 = level; i3 >= 0; i3--) {
22708             extend3(path[i3], bbox2);
22709           }
22710         },
22711         _condense: function(path) {
22712           for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
22713             if (path[i3].children.length === 0) {
22714               if (i3 > 0) {
22715                 siblings = path[i3 - 1].children;
22716                 siblings.splice(siblings.indexOf(path[i3]), 1);
22717               } else this.clear();
22718             } else calcBBox2(path[i3], this.toBBox);
22719           }
22720         },
22721         _initFormat: function(format2) {
22722           var compareArr = ["return a", " - b", ";"];
22723           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
22724           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
22725           this.toBBox = new Function(
22726             "a",
22727             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
22728           );
22729         }
22730       };
22731       function findItem2(item, items, equalsFn) {
22732         if (!equalsFn) return items.indexOf(item);
22733         for (var i3 = 0; i3 < items.length; i3++) {
22734           if (equalsFn(item, items[i3])) return i3;
22735         }
22736         return -1;
22737       }
22738       function calcBBox2(node, toBBox) {
22739         distBBox2(node, 0, node.children.length, toBBox, node);
22740       }
22741       function distBBox2(node, k3, p2, toBBox, destNode) {
22742         if (!destNode) destNode = createNode2(null);
22743         destNode.minX = Infinity;
22744         destNode.minY = Infinity;
22745         destNode.maxX = -Infinity;
22746         destNode.maxY = -Infinity;
22747         for (var i3 = k3, child; i3 < p2; i3++) {
22748           child = node.children[i3];
22749           extend3(destNode, node.leaf ? toBBox(child) : child);
22750         }
22751         return destNode;
22752       }
22753       function extend3(a4, b3) {
22754         a4.minX = Math.min(a4.minX, b3.minX);
22755         a4.minY = Math.min(a4.minY, b3.minY);
22756         a4.maxX = Math.max(a4.maxX, b3.maxX);
22757         a4.maxY = Math.max(a4.maxY, b3.maxY);
22758         return a4;
22759       }
22760       function compareNodeMinX2(a4, b3) {
22761         return a4.minX - b3.minX;
22762       }
22763       function compareNodeMinY2(a4, b3) {
22764         return a4.minY - b3.minY;
22765       }
22766       function bboxArea2(a4) {
22767         return (a4.maxX - a4.minX) * (a4.maxY - a4.minY);
22768       }
22769       function bboxMargin2(a4) {
22770         return a4.maxX - a4.minX + (a4.maxY - a4.minY);
22771       }
22772       function enlargedArea2(a4, b3) {
22773         return (Math.max(b3.maxX, a4.maxX) - Math.min(b3.minX, a4.minX)) * (Math.max(b3.maxY, a4.maxY) - Math.min(b3.minY, a4.minY));
22774       }
22775       function intersectionArea2(a4, b3) {
22776         var minX = Math.max(a4.minX, b3.minX), minY = Math.max(a4.minY, b3.minY), maxX = Math.min(a4.maxX, b3.maxX), maxY = Math.min(a4.maxY, b3.maxY);
22777         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
22778       }
22779       function contains2(a4, b3) {
22780         return a4.minX <= b3.minX && a4.minY <= b3.minY && b3.maxX <= a4.maxX && b3.maxY <= a4.maxY;
22781       }
22782       function intersects2(a4, b3) {
22783         return b3.minX <= a4.maxX && b3.minY <= a4.maxY && b3.maxX >= a4.minX && b3.maxY >= a4.minY;
22784       }
22785       function createNode2(children2) {
22786         return {
22787           children: children2,
22788           height: 1,
22789           leaf: true,
22790           minX: Infinity,
22791           minY: Infinity,
22792           maxX: -Infinity,
22793           maxY: -Infinity
22794         };
22795       }
22796       function multiSelect2(arr, left, right, n3, compare2) {
22797         var stack = [left, right], mid;
22798         while (stack.length) {
22799           right = stack.pop();
22800           left = stack.pop();
22801           if (right - left <= n3) continue;
22802           mid = left + Math.ceil((right - left) / n3 / 2) * n3;
22803           quickselect3(arr, mid, left, right, compare2);
22804           stack.push(left, mid, mid, right);
22805         }
22806       }
22807     }
22808   });
22809
22810   // node_modules/lineclip/index.js
22811   var require_lineclip = __commonJS({
22812     "node_modules/lineclip/index.js"(exports2, module2) {
22813       "use strict";
22814       module2.exports = lineclip2;
22815       lineclip2.polyline = lineclip2;
22816       lineclip2.polygon = polygonclip2;
22817       function lineclip2(points, bbox2, result) {
22818         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a4, b3, codeB, lastCode;
22819         if (!result) result = [];
22820         for (i3 = 1; i3 < len; i3++) {
22821           a4 = points[i3 - 1];
22822           b3 = points[i3];
22823           codeB = lastCode = bitCode2(b3, bbox2);
22824           while (true) {
22825             if (!(codeA | codeB)) {
22826               part.push(a4);
22827               if (codeB !== lastCode) {
22828                 part.push(b3);
22829                 if (i3 < len - 1) {
22830                   result.push(part);
22831                   part = [];
22832                 }
22833               } else if (i3 === len - 1) {
22834                 part.push(b3);
22835               }
22836               break;
22837             } else if (codeA & codeB) {
22838               break;
22839             } else if (codeA) {
22840               a4 = intersect2(a4, b3, codeA, bbox2);
22841               codeA = bitCode2(a4, bbox2);
22842             } else {
22843               b3 = intersect2(a4, b3, codeB, bbox2);
22844               codeB = bitCode2(b3, bbox2);
22845             }
22846           }
22847           codeA = lastCode;
22848         }
22849         if (part.length) result.push(part);
22850         return result;
22851       }
22852       function polygonclip2(points, bbox2) {
22853         var result, edge, prev, prevInside, i3, p2, inside;
22854         for (edge = 1; edge <= 8; edge *= 2) {
22855           result = [];
22856           prev = points[points.length - 1];
22857           prevInside = !(bitCode2(prev, bbox2) & edge);
22858           for (i3 = 0; i3 < points.length; i3++) {
22859             p2 = points[i3];
22860             inside = !(bitCode2(p2, bbox2) & edge);
22861             if (inside !== prevInside) result.push(intersect2(prev, p2, edge, bbox2));
22862             if (inside) result.push(p2);
22863             prev = p2;
22864             prevInside = inside;
22865           }
22866           points = result;
22867           if (!points.length) break;
22868         }
22869         return result;
22870       }
22871       function intersect2(a4, b3, edge, bbox2) {
22872         return edge & 8 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[3] - a4[1]) / (b3[1] - a4[1]), bbox2[3]] : (
22873           // top
22874           edge & 4 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[1] - a4[1]) / (b3[1] - a4[1]), bbox2[1]] : (
22875             // bottom
22876             edge & 2 ? [bbox2[2], a4[1] + (b3[1] - a4[1]) * (bbox2[2] - a4[0]) / (b3[0] - a4[0])] : (
22877               // right
22878               edge & 1 ? [bbox2[0], a4[1] + (b3[1] - a4[1]) * (bbox2[0] - a4[0]) / (b3[0] - a4[0])] : (
22879                 // left
22880                 null
22881               )
22882             )
22883           )
22884         );
22885       }
22886       function bitCode2(p2, bbox2) {
22887         var code = 0;
22888         if (p2[0] < bbox2[0]) code |= 1;
22889         else if (p2[0] > bbox2[2]) code |= 2;
22890         if (p2[1] < bbox2[1]) code |= 4;
22891         else if (p2[1] > bbox2[3]) code |= 8;
22892         return code;
22893       }
22894     }
22895   });
22896
22897   // node_modules/which-polygon/index.js
22898   var require_which_polygon = __commonJS({
22899     "node_modules/which-polygon/index.js"(exports2, module2) {
22900       "use strict";
22901       var rbush = require_rbush();
22902       var lineclip2 = require_lineclip();
22903       module2.exports = whichPolygon5;
22904       function whichPolygon5(data) {
22905         var bboxes = [];
22906         for (var i3 = 0; i3 < data.features.length; i3++) {
22907           var feature3 = data.features[i3];
22908           if (!feature3.geometry) continue;
22909           var coords = feature3.geometry.coordinates;
22910           if (feature3.geometry.type === "Polygon") {
22911             bboxes.push(treeItem(coords, feature3.properties));
22912           } else if (feature3.geometry.type === "MultiPolygon") {
22913             for (var j3 = 0; j3 < coords.length; j3++) {
22914               bboxes.push(treeItem(coords[j3], feature3.properties));
22915             }
22916           }
22917         }
22918         var tree = rbush().load(bboxes);
22919         function query(p2, multi) {
22920           var output = [], result = tree.search({
22921             minX: p2[0],
22922             minY: p2[1],
22923             maxX: p2[0],
22924             maxY: p2[1]
22925           });
22926           for (var i4 = 0; i4 < result.length; i4++) {
22927             if (insidePolygon(result[i4].coords, p2)) {
22928               if (multi)
22929                 output.push(result[i4].props);
22930               else
22931                 return result[i4].props;
22932             }
22933           }
22934           return multi && output.length ? output : null;
22935         }
22936         query.tree = tree;
22937         query.bbox = function queryBBox(bbox2) {
22938           var output = [];
22939           var result = tree.search({
22940             minX: bbox2[0],
22941             minY: bbox2[1],
22942             maxX: bbox2[2],
22943             maxY: bbox2[3]
22944           });
22945           for (var i4 = 0; i4 < result.length; i4++) {
22946             if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
22947               output.push(result[i4].props);
22948             }
22949           }
22950           return output;
22951         };
22952         return query;
22953       }
22954       function polygonIntersectsBBox(polygon2, bbox2) {
22955         var bboxCenter = [
22956           (bbox2[0] + bbox2[2]) / 2,
22957           (bbox2[1] + bbox2[3]) / 2
22958         ];
22959         if (insidePolygon(polygon2, bboxCenter)) return true;
22960         for (var i3 = 0; i3 < polygon2.length; i3++) {
22961           if (lineclip2(polygon2[i3], bbox2).length > 0) return true;
22962         }
22963         return false;
22964       }
22965       function insidePolygon(rings, p2) {
22966         var inside = false;
22967         for (var i3 = 0, len = rings.length; i3 < len; i3++) {
22968           var ring = rings[i3];
22969           for (var j3 = 0, len2 = ring.length, k3 = len2 - 1; j3 < len2; k3 = j3++) {
22970             if (rayIntersect(p2, ring[j3], ring[k3])) inside = !inside;
22971           }
22972         }
22973         return inside;
22974       }
22975       function rayIntersect(p2, p1, p22) {
22976         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];
22977       }
22978       function treeItem(coords, props) {
22979         var item = {
22980           minX: Infinity,
22981           minY: Infinity,
22982           maxX: -Infinity,
22983           maxY: -Infinity,
22984           coords,
22985           props
22986         };
22987         for (var i3 = 0; i3 < coords[0].length; i3++) {
22988           var p2 = coords[0][i3];
22989           item.minX = Math.min(item.minX, p2[0]);
22990           item.minY = Math.min(item.minY, p2[1]);
22991           item.maxX = Math.max(item.maxX, p2[0]);
22992           item.maxY = Math.max(item.maxY, p2[1]);
22993         }
22994         return item;
22995       }
22996     }
22997   });
22998
22999   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
23000   function canonicalID(id2) {
23001     const s2 = id2 || "";
23002     if (s2.charAt(0) === ".") {
23003       return s2.toUpperCase();
23004     } else {
23005       return s2.replace(idFilterRegex, "").toUpperCase();
23006     }
23007   }
23008   function loadDerivedDataAndCaches(borders2) {
23009     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
23010     let geometryFeatures = [];
23011     for (const feature22 of borders2.features) {
23012       const props = feature22.properties;
23013       props.id = props.iso1A2 || props.m49 || props.wikidata;
23014       loadM49(feature22);
23015       loadTLD(feature22);
23016       loadIsoStatus(feature22);
23017       loadLevel(feature22);
23018       loadGroups(feature22);
23019       loadFlag(feature22);
23020       cacheFeatureByIDs(feature22);
23021       if (feature22.geometry) {
23022         geometryFeatures.push(feature22);
23023       }
23024     }
23025     for (const feature22 of borders2.features) {
23026       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
23027         return _featuresByCode[groupID].properties.id;
23028       });
23029       loadMembersForGroupsOf(feature22);
23030     }
23031     for (const feature22 of borders2.features) {
23032       loadRoadSpeedUnit(feature22);
23033       loadRoadHeightUnit(feature22);
23034       loadDriveSide(feature22);
23035       loadCallingCodes(feature22);
23036       loadGroupGroups(feature22);
23037     }
23038     for (const feature22 of borders2.features) {
23039       feature22.properties.groups.sort((groupID1, groupID2) => {
23040         return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
23041       });
23042       if (feature22.properties.members) {
23043         feature22.properties.members.sort((id1, id2) => {
23044           const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
23045           if (diff === 0) {
23046             return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
23047           }
23048           return diff;
23049         });
23050       }
23051     }
23052     const geometryOnlyCollection = {
23053       type: "FeatureCollection",
23054       features: geometryFeatures
23055     };
23056     _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
23057     function loadGroups(feature22) {
23058       const props = feature22.properties;
23059       if (!props.groups) {
23060         props.groups = [];
23061       }
23062       if (feature22.geometry && props.country) {
23063         props.groups.push(props.country);
23064       }
23065       if (props.m49 !== "001") {
23066         props.groups.push("001");
23067       }
23068     }
23069     function loadM49(feature22) {
23070       const props = feature22.properties;
23071       if (!props.m49 && props.iso1N3) {
23072         props.m49 = props.iso1N3;
23073       }
23074     }
23075     function loadTLD(feature22) {
23076       const props = feature22.properties;
23077       if (props.level === "unitedNations") return;
23078       if (props.ccTLD === null) return;
23079       if (!props.ccTLD && props.iso1A2) {
23080         props.ccTLD = "." + props.iso1A2.toLowerCase();
23081       }
23082     }
23083     function loadIsoStatus(feature22) {
23084       const props = feature22.properties;
23085       if (!props.isoStatus && props.iso1A2) {
23086         props.isoStatus = "official";
23087       }
23088     }
23089     function loadLevel(feature22) {
23090       const props = feature22.properties;
23091       if (props.level) return;
23092       if (!props.country) {
23093         props.level = "country";
23094       } else if (!props.iso1A2 || props.isoStatus === "official") {
23095         props.level = "territory";
23096       } else {
23097         props.level = "subterritory";
23098       }
23099     }
23100     function loadGroupGroups(feature22) {
23101       const props = feature22.properties;
23102       if (feature22.geometry || !props.members) return;
23103       const featureLevelIndex = levels.indexOf(props.level);
23104       let sharedGroups = [];
23105       props.members.forEach((memberID, index) => {
23106         const member = _featuresByCode[memberID];
23107         const memberGroups = member.properties.groups.filter((groupID) => {
23108           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
23109         });
23110         if (index === 0) {
23111           sharedGroups = memberGroups;
23112         } else {
23113           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23114         }
23115       });
23116       props.groups = props.groups.concat(
23117         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
23118       );
23119       for (const groupID of sharedGroups) {
23120         const groupFeature = _featuresByCode[groupID];
23121         if (groupFeature.properties.members.indexOf(props.id) === -1) {
23122           groupFeature.properties.members.push(props.id);
23123         }
23124       }
23125     }
23126     function loadRoadSpeedUnit(feature22) {
23127       const props = feature22.properties;
23128       if (feature22.geometry) {
23129         if (!props.roadSpeedUnit) props.roadSpeedUnit = "km/h";
23130       } else if (props.members) {
23131         const vals = Array.from(
23132           new Set(
23133             props.members.map((id2) => {
23134               const member = _featuresByCode[id2];
23135               if (member.geometry) return member.properties.roadSpeedUnit || "km/h";
23136             }).filter(Boolean)
23137           )
23138         );
23139         if (vals.length === 1) props.roadSpeedUnit = vals[0];
23140       }
23141     }
23142     function loadRoadHeightUnit(feature22) {
23143       const props = feature22.properties;
23144       if (feature22.geometry) {
23145         if (!props.roadHeightUnit) props.roadHeightUnit = "m";
23146       } else if (props.members) {
23147         const vals = Array.from(
23148           new Set(
23149             props.members.map((id2) => {
23150               const member = _featuresByCode[id2];
23151               if (member.geometry) return member.properties.roadHeightUnit || "m";
23152             }).filter(Boolean)
23153           )
23154         );
23155         if (vals.length === 1) props.roadHeightUnit = vals[0];
23156       }
23157     }
23158     function loadDriveSide(feature22) {
23159       const props = feature22.properties;
23160       if (feature22.geometry) {
23161         if (!props.driveSide) props.driveSide = "right";
23162       } else if (props.members) {
23163         const vals = Array.from(
23164           new Set(
23165             props.members.map((id2) => {
23166               const member = _featuresByCode[id2];
23167               if (member.geometry) return member.properties.driveSide || "right";
23168             }).filter(Boolean)
23169           )
23170         );
23171         if (vals.length === 1) props.driveSide = vals[0];
23172       }
23173     }
23174     function loadCallingCodes(feature22) {
23175       const props = feature22.properties;
23176       if (!feature22.geometry && props.members) {
23177         props.callingCodes = Array.from(
23178           new Set(
23179             props.members.reduce((array2, id2) => {
23180               const member = _featuresByCode[id2];
23181               if (member.geometry && member.properties.callingCodes) {
23182                 return array2.concat(member.properties.callingCodes);
23183               }
23184               return array2;
23185             }, [])
23186           )
23187         );
23188       }
23189     }
23190     function loadFlag(feature22) {
23191       if (!feature22.properties.iso1A2) return;
23192       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23193         return String.fromCodePoint(char.charCodeAt(0) + 127397);
23194       });
23195       feature22.properties.emojiFlag = flag;
23196     }
23197     function loadMembersForGroupsOf(feature22) {
23198       for (const groupID of feature22.properties.groups) {
23199         const groupFeature = _featuresByCode[groupID];
23200         if (!groupFeature.properties.members) {
23201           groupFeature.properties.members = [];
23202         }
23203         groupFeature.properties.members.push(feature22.properties.id);
23204       }
23205     }
23206     function cacheFeatureByIDs(feature22) {
23207       let ids = [];
23208       for (const prop of identifierProps) {
23209         const id2 = feature22.properties[prop];
23210         if (id2) {
23211           ids.push(id2);
23212         }
23213       }
23214       for (const alias of feature22.properties.aliases || []) {
23215         ids.push(alias);
23216       }
23217       for (const id2 of ids) {
23218         const cid = canonicalID(id2);
23219         _featuresByCode[cid] = feature22;
23220       }
23221     }
23222   }
23223   function locArray(loc) {
23224     if (Array.isArray(loc)) {
23225       return loc;
23226     } else if (loc.coordinates) {
23227       return loc.coordinates;
23228     }
23229     return loc.geometry.coordinates;
23230   }
23231   function smallestFeature(loc) {
23232     const query = locArray(loc);
23233     const featureProperties = _whichPolygon(query);
23234     if (!featureProperties) return null;
23235     return _featuresByCode[featureProperties.id];
23236   }
23237   function countryFeature(loc) {
23238     const feature22 = smallestFeature(loc);
23239     if (!feature22) return null;
23240     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23241     return _featuresByCode[countryCode] || null;
23242   }
23243   function featureForLoc(loc, opts) {
23244     const targetLevel = opts.level || "country";
23245     const maxLevel = opts.maxLevel || "world";
23246     const withProp = opts.withProp;
23247     const targetLevelIndex = levels.indexOf(targetLevel);
23248     if (targetLevelIndex === -1) return null;
23249     const maxLevelIndex = levels.indexOf(maxLevel);
23250     if (maxLevelIndex === -1) return null;
23251     if (maxLevelIndex < targetLevelIndex) return null;
23252     if (targetLevel === "country") {
23253       const fastFeature = countryFeature(loc);
23254       if (fastFeature) {
23255         if (!withProp || fastFeature.properties[withProp]) {
23256           return fastFeature;
23257         }
23258       }
23259     }
23260     const features = featuresContaining(loc);
23261     const match = features.find((feature22) => {
23262       let levelIndex = levels.indexOf(feature22.properties.level);
23263       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
23264       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23265         if (!withProp || feature22.properties[withProp]) {
23266           return feature22;
23267         }
23268       }
23269       return false;
23270     });
23271     return match || null;
23272   }
23273   function featureForID(id2) {
23274     let stringID;
23275     if (typeof id2 === "number") {
23276       stringID = id2.toString();
23277       if (stringID.length === 1) {
23278         stringID = "00" + stringID;
23279       } else if (stringID.length === 2) {
23280         stringID = "0" + stringID;
23281       }
23282     } else {
23283       stringID = canonicalID(id2);
23284     }
23285     return _featuresByCode[stringID] || null;
23286   }
23287   function smallestFeaturesForBbox(bbox2) {
23288     return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
23289   }
23290   function smallestOrMatchingFeature(query) {
23291     if (typeof query === "object") {
23292       return smallestFeature(query);
23293     }
23294     return featureForID(query);
23295   }
23296   function feature(query, opts = defaultOpts) {
23297     if (typeof query === "object") {
23298       return featureForLoc(query, opts);
23299     }
23300     return featureForID(query);
23301   }
23302   function iso1A2Code(query, opts = defaultOpts) {
23303     opts.withProp = "iso1A2";
23304     const match = feature(query, opts);
23305     if (!match) return null;
23306     return match.properties.iso1A2 || null;
23307   }
23308   function propertiesForQuery(query, property) {
23309     const features = featuresContaining(query, false);
23310     return features.map((feature22) => feature22.properties[property]).filter(Boolean);
23311   }
23312   function iso1A2Codes(query) {
23313     return propertiesForQuery(query, "iso1A2");
23314   }
23315   function featuresContaining(query, strict) {
23316     let matchingFeatures;
23317     if (Array.isArray(query) && query.length === 4) {
23318       matchingFeatures = smallestFeaturesForBbox(query);
23319     } else {
23320       const smallestOrMatching = smallestOrMatchingFeature(query);
23321       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23322     }
23323     if (!matchingFeatures.length) return [];
23324     let returnFeatures;
23325     if (!strict || typeof query === "object") {
23326       returnFeatures = matchingFeatures.slice();
23327     } else {
23328       returnFeatures = [];
23329     }
23330     for (const feature22 of matchingFeatures) {
23331       const properties = feature22.properties;
23332       for (const groupID of properties.groups) {
23333         const groupFeature = _featuresByCode[groupID];
23334         if (returnFeatures.indexOf(groupFeature) === -1) {
23335           returnFeatures.push(groupFeature);
23336         }
23337       }
23338     }
23339     return returnFeatures;
23340   }
23341   function featuresIn(id2, strict) {
23342     const feature22 = featureForID(id2);
23343     if (!feature22) return [];
23344     let features = [];
23345     if (!strict) {
23346       features.push(feature22);
23347     }
23348     const properties = feature22.properties;
23349     for (const memberID of properties.members || []) {
23350       features.push(_featuresByCode[memberID]);
23351     }
23352     return features;
23353   }
23354   function aggregateFeature(id2) {
23355     var _a4;
23356     const features = featuresIn(id2, false);
23357     if (features.length === 0) return null;
23358     let aggregateCoordinates = [];
23359     for (const feature22 of features) {
23360       if (((_a4 = feature22.geometry) == null ? void 0 : _a4.type) === "MultiPolygon" && feature22.geometry.coordinates) {
23361         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23362       }
23363     }
23364     return {
23365       type: "Feature",
23366       properties: features[0].properties,
23367       geometry: {
23368         type: "MultiPolygon",
23369         coordinates: aggregateCoordinates
23370       }
23371     };
23372   }
23373   function roadSpeedUnit(query) {
23374     const feature22 = smallestOrMatchingFeature(query);
23375     return feature22 && feature22.properties.roadSpeedUnit || null;
23376   }
23377   function roadHeightUnit(query) {
23378     const feature22 = smallestOrMatchingFeature(query);
23379     return feature22 && feature22.properties.roadHeightUnit || null;
23380   }
23381   var import_which_polygon, borders_default, borders, _whichPolygon, _featuresByCode, idFilterRegex, levels, defaultOpts;
23382   var init_country_coder = __esm({
23383     "node_modules/@rapideditor/country-coder/dist/country-coder.mjs"() {
23384       import_which_polygon = __toESM(require_which_polygon(), 1);
23385       borders_default = { type: "FeatureCollection", features: [
23386         { 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]]]] } },
23387         { 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]]]] } },
23388         { 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]]]] } },
23389         { 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]]]] } },
23390         { 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]]]] } },
23391         { 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]]]] } },
23392         { 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]]]] } },
23393         { 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]]]] } },
23394         { 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]]]] } },
23395         { 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]]]] } },
23396         { 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]]]] } },
23397         { 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]]]] } },
23398         { 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]]]] } },
23399         { 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]]]] } },
23400         { 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]]]] } },
23401         { 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]]]] } },
23402         { 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]]]] } },
23403         { 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]]]] } },
23404         { 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]]]] } },
23405         { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
23406         { 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]]]] } },
23407         { 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]]]] } },
23408         { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
23409         { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
23410         { 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]]]] } },
23411         { 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]]]] } },
23412         { 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]]]] } },
23413         { 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]]]] } },
23414         { 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]]]] } },
23415         { 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]]]] } },
23416         { 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]]]] } },
23417         { 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]]]] } },
23418         { 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]]]] } },
23419         { 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]]]] } },
23420         { 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]]]] } },
23421         { 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]]]] } },
23422         { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
23423         { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
23424         { 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]]]] } },
23425         { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
23426         { 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]]]] } },
23427         { 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]]]] } },
23428         { 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]]]] } },
23429         { 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]]]] } },
23430         { 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]]]] } },
23431         { 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]]]] } },
23432         { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
23433         { 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]]]] } },
23434         { 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]]]] } },
23435         { 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]]]] } },
23436         { 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]]]] } },
23437         { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
23438         { 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]]]] } },
23439         { 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]]]] } },
23440         { 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]]]] } },
23441         { 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]]]] } },
23442         { 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]]]] } },
23443         { 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]]]] } },
23444         { 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]]]] } },
23445         { 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]]]] } },
23446         { 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]]]] } },
23447         { 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]]]] } },
23448         { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
23449         { 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]]]] } },
23450         { 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]]]] } },
23451         { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
23452         { 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]]]] } },
23453         { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
23454         { 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]]]] } },
23455         { 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]]]] } },
23456         { 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]]]] } },
23457         { 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]]]] } },
23458         { 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]]]] } },
23459         { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
23460         { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
23461         { 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]]]] } },
23462         { 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]]]] } },
23463         { 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]]]] } },
23464         { 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]]]] } },
23465         { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
23466         { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
23467         { 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]]]] } },
23468         { 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]]]] } },
23469         { 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]]]] } },
23470         { 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]]]] } },
23471         { 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]]]] } },
23472         { 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]]]] } },
23473         { 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]]]] } },
23474         { 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]]]] } },
23475         { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
23476         { 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]]]] } },
23477         { 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]]]] } },
23478         { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
23479         { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
23480         { 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]]]] } },
23481         { 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]]]] } },
23482         { 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]]]] } },
23483         { 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]]]] } },
23484         { 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]]]] } },
23485         { 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]]]] } },
23486         { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
23487         { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
23488         { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
23489         { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
23490         { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
23491         { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
23492         { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
23493         { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
23494         { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
23495         { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
23496         { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
23497         { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
23498         { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
23499         { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
23500         { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
23501         { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
23502         { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
23503         { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
23504         { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
23505         { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
23506         { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
23507         { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
23508         { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
23509         { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
23510         { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
23511         { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
23512         { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
23513         { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
23514         { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
23515         { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
23516         { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
23517         { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
23518         { 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]]]] } },
23519         { 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]]]] } },
23520         { 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]]]] } },
23521         { 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]]]] } },
23522         { 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]]]] } },
23523         { 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]]]] } },
23524         { 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]]]] } },
23525         { 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]]]] } },
23526         { 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]]]] } },
23527         { 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]]]] } },
23528         { 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]]]] } },
23529         { 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]]]] } },
23530         { 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]]]] } },
23531         { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
23532         { 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]]]] } },
23533         { 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]]]] } },
23534         { 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]]]] } },
23535         { 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]]]] } },
23536         { 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]]]] } },
23537         { 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]]]] } },
23538         { 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]]]] } },
23539         { 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]]]] } },
23540         { 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]]]] } },
23541         { 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]]]] } },
23542         { 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]]]] } },
23543         { 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]]]] } },
23544         { 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]]]] } },
23545         { 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]]]] } },
23546         { 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]]]] } },
23547         { 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]]]] } },
23548         { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
23549         { 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]]]] } },
23550         { 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]]]] } },
23551         { 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]]]] } },
23552         { 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]]]] } },
23553         { 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]]]] } },
23554         { 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]]]] } },
23555         { 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]]]] } },
23556         { 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]]]] } },
23557         { 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]]]] } },
23558         { 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]]]] } },
23559         { 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]]]] } },
23560         { 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]]]] } },
23561         { 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]]]] } },
23562         { 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]]]] } },
23563         { 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]]]] } },
23564         { 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]]]] } },
23565         { 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]]]] } },
23566         { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
23567         { 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]]]] } },
23568         { 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]]]] } },
23569         { 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]]]] } },
23570         { 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]]]] } },
23571         { 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]]]] } },
23572         { 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]]]] } },
23573         { 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]]]] } },
23574         { 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]]]] } },
23575         { 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]]]] } },
23576         { 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]]]] } },
23577         { 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]]]] } },
23578         { 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]]]] } },
23579         { 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]]]] } },
23580         { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
23581         { 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]]]] } },
23582         { 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]]]] } },
23583         { 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]]]] } },
23584         { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
23585         { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
23586         { 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]]]] } },
23587         { 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]]]] } },
23588         { 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]]]] } },
23589         { 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]]]] } },
23590         { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
23591         { 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]]]] } },
23592         { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
23593         { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
23594         { 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]]]] } },
23595         { 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]]]] } },
23596         { 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]]]] } },
23597         { 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]]]] } },
23598         { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
23599         { 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]]]] } },
23600         { 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]]]] } },
23601         { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
23602         { 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]]]] } },
23603         { 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]]]] } },
23604         { 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]]]] } },
23605         { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
23606         { 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]]]] } },
23607         { 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]]]] } },
23608         { 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]]]] } },
23609         { 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]]]] } },
23610         { 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]]]] } },
23611         { 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]]]] } },
23612         { 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]]]] } },
23613         { 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]]]] } },
23614         { 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]]]] } },
23615         { 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]]]] } },
23616         { 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]]]] } },
23617         { 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]]]] } },
23618         { 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]]]] } },
23619         { 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]]]] } },
23620         { 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]]]] } },
23621         { 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]]]] } },
23622         { 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]]]] } },
23623         { 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]]]] } },
23624         { 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]]]] } },
23625         { 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]]]] } },
23626         { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
23627         { 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]]]] } },
23628         { 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]]]] } },
23629         { 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]]]] } },
23630         { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
23631         { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
23632         { 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]]]] } },
23633         { 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]]]] } },
23634         { 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]]]] } },
23635         { 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]]]] } },
23636         { 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]]]] } },
23637         { 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]]]] } },
23638         { 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]]]] } },
23639         { 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]]]] } },
23640         { 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]]]] } },
23641         { 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]]]] } },
23642         { 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]]]] } },
23643         { 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]]]] } },
23644         { 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]]]] } },
23645         { 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]]]] } },
23646         { 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]]]] } },
23647         { 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]]]] } },
23648         { 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]]]] } },
23649         { 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]]]] } },
23650         { 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]]]] } },
23651         { 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]]]] } },
23652         { 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]]]] } },
23653         { 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]]]] } },
23654         { 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]]]] } },
23655         { 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]]]] } },
23656         { 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]]]] } },
23657         { 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]]]] } },
23658         { 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]]]] } },
23659         { 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]]]] } },
23660         { 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]]]] } },
23661         { 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]]]] } },
23662         { 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]]]] } },
23663         { 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]]]] } },
23664         { 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]]]] } },
23665         { 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]]]] } },
23666         { 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]]]] } },
23667         { 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]]]] } },
23668         { 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]]]] } },
23669         { 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]]]] } },
23670         { 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]]]] } },
23671         { 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]]]] } },
23672         { 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]]]] } },
23673         { 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]]]] } },
23674         { 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]]]] } },
23675         { 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]]]] } },
23676         { 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]]]] } },
23677         { 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]]]] } },
23678         { 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]]]] } },
23679         { 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]]]] } },
23680         { 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]]]] } },
23681         { 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]]]] } },
23682         { 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]]]] } },
23683         { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
23684         { 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]]]] } },
23685         { 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]]]] } },
23686         { 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]]]] } },
23687         { 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]]]] } },
23688         { 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]]]] } },
23689         { 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]]]] } },
23690         { 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]]]] } },
23691         { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
23692         { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
23693         { 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]]]] } },
23694         { 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]]]] } },
23695         { 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]]]] } },
23696         { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
23697         { 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]]]] } },
23698         { 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]]]] } },
23699         { 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]]]] } },
23700         { 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]]]] } },
23701         { 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]]]] } },
23702         { 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]]]] } },
23703         { 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]]]] } },
23704         { 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]]]] } },
23705         { 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]]]] } },
23706         { 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]]]] } },
23707         { 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]]]] } },
23708         { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
23709         { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
23710         { 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]]]] } },
23711         { 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]]]] } },
23712         { 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]]]] } },
23713         { 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]]]] } },
23714         { 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]]]] } },
23715         { 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]]]] } },
23716         { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
23717         { 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]]]] } },
23718         { 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]]]] } },
23719         { 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]]]] } },
23720         { 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]]]] } },
23721         { 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]]]] } },
23722         { 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]]]] } },
23723         { 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]]]] } },
23724         { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
23725         { 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]]]] } },
23726         { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
23727         { 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]]]] } },
23728         { 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]]]] } },
23729         { 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]]]] } },
23730         { 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]]]] } },
23731         { 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]]]] } },
23732         { 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]]]] } },
23733         { 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]]]] } },
23734         { 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]]]] } },
23735         { 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]]]] } },
23736         { 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]]]] } },
23737         { 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]]]] } },
23738         { 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]]]] } },
23739         { 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]]]] } },
23740         { 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]]]] } },
23741         { 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]]]] } },
23742         { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
23743         { 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]]]] } },
23744         { 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]]]] } },
23745         { 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]]]] } },
23746         { 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]]]] } },
23747         { 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]]]] } },
23748         { 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]]]] } },
23749         { 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]]]] } },
23750         { 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]]]] } },
23751         { 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]]]] } },
23752         { 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]]]] } },
23753         { 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]]]] } },
23754         { 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]]]] } },
23755         { 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]]]] } },
23756         { 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]]]] } },
23757         { 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]]]] } },
23758         { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
23759         { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
23760         { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
23761         { 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]]]] } },
23762         { 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]]]] } },
23763         { 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]]]] } },
23764         { 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]]]] } },
23765         { 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]]]] } },
23766         { 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]]]] } },
23767         { 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]]]] } },
23768         { 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]]]] } },
23769         { 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]]]] } },
23770         { 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]]]] } },
23771         { 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]]]] } },
23772         { 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]]]] } },
23773         { 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]]]] } },
23774         { 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]]]] } },
23775         { 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]]]] } },
23776         { 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]]]] } },
23777         { 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]]]] } }
23778       ] };
23779       borders = borders_default;
23780       _whichPolygon = {};
23781       _featuresByCode = {};
23782       idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
23783       levels = [
23784         "subterritory",
23785         "territory",
23786         "subcountryGroup",
23787         "country",
23788         "sharedLandform",
23789         "intermediateRegion",
23790         "subregion",
23791         "region",
23792         "subunion",
23793         "union",
23794         "unitedNations",
23795         "world"
23796       ];
23797       loadDerivedDataAndCaches(borders);
23798       defaultOpts = {
23799         level: void 0,
23800         maxLevel: void 0,
23801         withProp: void 0
23802       };
23803     }
23804   });
23805
23806   // node_modules/bignumber.js/bignumber.mjs
23807   function clone(configObject) {
23808     var div, convertBase, parseNumeric2, P3 = 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 = {
23809       prefix: "",
23810       groupSize: 3,
23811       secondaryGroupSize: 0,
23812       groupSeparator: ",",
23813       decimalSeparator: ".",
23814       fractionGroupSize: 0,
23815       fractionGroupSeparator: "\xA0",
23816       // non-breaking space
23817       suffix: ""
23818     }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
23819     function BigNumber2(v3, b3) {
23820       var alphabet, c2, caseChanged, e3, i3, isNum, len, str, x2 = this;
23821       if (!(x2 instanceof BigNumber2)) return new BigNumber2(v3, b3);
23822       if (b3 == null) {
23823         if (v3 && v3._isBigNumber === true) {
23824           x2.s = v3.s;
23825           if (!v3.c || v3.e > MAX_EXP) {
23826             x2.c = x2.e = null;
23827           } else if (v3.e < MIN_EXP) {
23828             x2.c = [x2.e = 0];
23829           } else {
23830             x2.e = v3.e;
23831             x2.c = v3.c.slice();
23832           }
23833           return;
23834         }
23835         if ((isNum = typeof v3 == "number") && v3 * 0 == 0) {
23836           x2.s = 1 / v3 < 0 ? (v3 = -v3, -1) : 1;
23837           if (v3 === ~~v3) {
23838             for (e3 = 0, i3 = v3; i3 >= 10; i3 /= 10, e3++) ;
23839             if (e3 > MAX_EXP) {
23840               x2.c = x2.e = null;
23841             } else {
23842               x2.e = e3;
23843               x2.c = [v3];
23844             }
23845             return;
23846           }
23847           str = String(v3);
23848         } else {
23849           if (!isNumeric.test(str = String(v3))) return parseNumeric2(x2, str, isNum);
23850           x2.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
23851         }
23852         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
23853         if ((i3 = str.search(/e/i)) > 0) {
23854           if (e3 < 0) e3 = i3;
23855           e3 += +str.slice(i3 + 1);
23856           str = str.substring(0, i3);
23857         } else if (e3 < 0) {
23858           e3 = str.length;
23859         }
23860       } else {
23861         intCheck(b3, 2, ALPHABET.length, "Base");
23862         if (b3 == 10 && alphabetHasNormalDecimalDigits) {
23863           x2 = new BigNumber2(v3);
23864           return round(x2, DECIMAL_PLACES + x2.e + 1, ROUNDING_MODE);
23865         }
23866         str = String(v3);
23867         if (isNum = typeof v3 == "number") {
23868           if (v3 * 0 != 0) return parseNumeric2(x2, str, isNum, b3);
23869           x2.s = 1 / v3 < 0 ? (str = str.slice(1), -1) : 1;
23870           if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
23871             throw Error(tooManyDigits + v3);
23872           }
23873         } else {
23874           x2.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
23875         }
23876         alphabet = ALPHABET.slice(0, b3);
23877         e3 = i3 = 0;
23878         for (len = str.length; i3 < len; i3++) {
23879           if (alphabet.indexOf(c2 = str.charAt(i3)) < 0) {
23880             if (c2 == ".") {
23881               if (i3 > e3) {
23882                 e3 = len;
23883                 continue;
23884               }
23885             } else if (!caseChanged) {
23886               if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
23887                 caseChanged = true;
23888                 i3 = -1;
23889                 e3 = 0;
23890                 continue;
23891               }
23892             }
23893             return parseNumeric2(x2, String(v3), isNum, b3);
23894           }
23895         }
23896         isNum = false;
23897         str = convertBase(str, b3, 10, x2.s);
23898         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
23899         else e3 = str.length;
23900       }
23901       for (i3 = 0; str.charCodeAt(i3) === 48; i3++) ;
23902       for (len = str.length; str.charCodeAt(--len) === 48; ) ;
23903       if (str = str.slice(i3, ++len)) {
23904         len -= i3;
23905         if (isNum && BigNumber2.DEBUG && len > 15 && (v3 > MAX_SAFE_INTEGER3 || v3 !== mathfloor(v3))) {
23906           throw Error(tooManyDigits + x2.s * v3);
23907         }
23908         if ((e3 = e3 - i3 - 1) > MAX_EXP) {
23909           x2.c = x2.e = null;
23910         } else if (e3 < MIN_EXP) {
23911           x2.c = [x2.e = 0];
23912         } else {
23913           x2.e = e3;
23914           x2.c = [];
23915           i3 = (e3 + 1) % LOG_BASE;
23916           if (e3 < 0) i3 += LOG_BASE;
23917           if (i3 < len) {
23918             if (i3) x2.c.push(+str.slice(0, i3));
23919             for (len -= LOG_BASE; i3 < len; ) {
23920               x2.c.push(+str.slice(i3, i3 += LOG_BASE));
23921             }
23922             i3 = LOG_BASE - (str = str.slice(i3)).length;
23923           } else {
23924             i3 -= len;
23925           }
23926           for (; i3--; str += "0") ;
23927           x2.c.push(+str);
23928         }
23929       } else {
23930         x2.c = [x2.e = 0];
23931       }
23932     }
23933     BigNumber2.clone = clone;
23934     BigNumber2.ROUND_UP = 0;
23935     BigNumber2.ROUND_DOWN = 1;
23936     BigNumber2.ROUND_CEIL = 2;
23937     BigNumber2.ROUND_FLOOR = 3;
23938     BigNumber2.ROUND_HALF_UP = 4;
23939     BigNumber2.ROUND_HALF_DOWN = 5;
23940     BigNumber2.ROUND_HALF_EVEN = 6;
23941     BigNumber2.ROUND_HALF_CEIL = 7;
23942     BigNumber2.ROUND_HALF_FLOOR = 8;
23943     BigNumber2.EUCLID = 9;
23944     BigNumber2.config = BigNumber2.set = function(obj) {
23945       var p2, v3;
23946       if (obj != null) {
23947         if (typeof obj == "object") {
23948           if (obj.hasOwnProperty(p2 = "DECIMAL_PLACES")) {
23949             v3 = obj[p2];
23950             intCheck(v3, 0, MAX, p2);
23951             DECIMAL_PLACES = v3;
23952           }
23953           if (obj.hasOwnProperty(p2 = "ROUNDING_MODE")) {
23954             v3 = obj[p2];
23955             intCheck(v3, 0, 8, p2);
23956             ROUNDING_MODE = v3;
23957           }
23958           if (obj.hasOwnProperty(p2 = "EXPONENTIAL_AT")) {
23959             v3 = obj[p2];
23960             if (v3 && v3.pop) {
23961               intCheck(v3[0], -MAX, 0, p2);
23962               intCheck(v3[1], 0, MAX, p2);
23963               TO_EXP_NEG = v3[0];
23964               TO_EXP_POS = v3[1];
23965             } else {
23966               intCheck(v3, -MAX, MAX, p2);
23967               TO_EXP_NEG = -(TO_EXP_POS = v3 < 0 ? -v3 : v3);
23968             }
23969           }
23970           if (obj.hasOwnProperty(p2 = "RANGE")) {
23971             v3 = obj[p2];
23972             if (v3 && v3.pop) {
23973               intCheck(v3[0], -MAX, -1, p2);
23974               intCheck(v3[1], 1, MAX, p2);
23975               MIN_EXP = v3[0];
23976               MAX_EXP = v3[1];
23977             } else {
23978               intCheck(v3, -MAX, MAX, p2);
23979               if (v3) {
23980                 MIN_EXP = -(MAX_EXP = v3 < 0 ? -v3 : v3);
23981               } else {
23982                 throw Error(bignumberError + p2 + " cannot be zero: " + v3);
23983               }
23984             }
23985           }
23986           if (obj.hasOwnProperty(p2 = "CRYPTO")) {
23987             v3 = obj[p2];
23988             if (v3 === !!v3) {
23989               if (v3) {
23990                 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
23991                   CRYPTO = v3;
23992                 } else {
23993                   CRYPTO = !v3;
23994                   throw Error(bignumberError + "crypto unavailable");
23995                 }
23996               } else {
23997                 CRYPTO = v3;
23998               }
23999             } else {
24000               throw Error(bignumberError + p2 + " not true or false: " + v3);
24001             }
24002           }
24003           if (obj.hasOwnProperty(p2 = "MODULO_MODE")) {
24004             v3 = obj[p2];
24005             intCheck(v3, 0, 9, p2);
24006             MODULO_MODE = v3;
24007           }
24008           if (obj.hasOwnProperty(p2 = "POW_PRECISION")) {
24009             v3 = obj[p2];
24010             intCheck(v3, 0, MAX, p2);
24011             POW_PRECISION = v3;
24012           }
24013           if (obj.hasOwnProperty(p2 = "FORMAT")) {
24014             v3 = obj[p2];
24015             if (typeof v3 == "object") FORMAT = v3;
24016             else throw Error(bignumberError + p2 + " not an object: " + v3);
24017           }
24018           if (obj.hasOwnProperty(p2 = "ALPHABET")) {
24019             v3 = obj[p2];
24020             if (typeof v3 == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v3)) {
24021               alphabetHasNormalDecimalDigits = v3.slice(0, 10) == "0123456789";
24022               ALPHABET = v3;
24023             } else {
24024               throw Error(bignumberError + p2 + " invalid: " + v3);
24025             }
24026           }
24027         } else {
24028           throw Error(bignumberError + "Object expected: " + obj);
24029         }
24030       }
24031       return {
24032         DECIMAL_PLACES,
24033         ROUNDING_MODE,
24034         EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
24035         RANGE: [MIN_EXP, MAX_EXP],
24036         CRYPTO,
24037         MODULO_MODE,
24038         POW_PRECISION,
24039         FORMAT,
24040         ALPHABET
24041       };
24042     };
24043     BigNumber2.isBigNumber = function(v3) {
24044       if (!v3 || v3._isBigNumber !== true) return false;
24045       if (!BigNumber2.DEBUG) return true;
24046       var i3, n3, c2 = v3.c, e3 = v3.e, s2 = v3.s;
24047       out: if ({}.toString.call(c2) == "[object Array]") {
24048         if ((s2 === 1 || s2 === -1) && e3 >= -MAX && e3 <= MAX && e3 === mathfloor(e3)) {
24049           if (c2[0] === 0) {
24050             if (e3 === 0 && c2.length === 1) return true;
24051             break out;
24052           }
24053           i3 = (e3 + 1) % LOG_BASE;
24054           if (i3 < 1) i3 += LOG_BASE;
24055           if (String(c2[0]).length == i3) {
24056             for (i3 = 0; i3 < c2.length; i3++) {
24057               n3 = c2[i3];
24058               if (n3 < 0 || n3 >= BASE || n3 !== mathfloor(n3)) break out;
24059             }
24060             if (n3 !== 0) return true;
24061           }
24062         }
24063       } else if (c2 === null && e3 === null && (s2 === null || s2 === 1 || s2 === -1)) {
24064         return true;
24065       }
24066       throw Error(bignumberError + "Invalid BigNumber: " + v3);
24067     };
24068     BigNumber2.maximum = BigNumber2.max = function() {
24069       return maxOrMin(arguments, -1);
24070     };
24071     BigNumber2.minimum = BigNumber2.min = function() {
24072       return maxOrMin(arguments, 1);
24073     };
24074     BigNumber2.random = function() {
24075       var pow2_53 = 9007199254740992;
24076       var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
24077         return mathfloor(Math.random() * pow2_53);
24078       } : function() {
24079         return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
24080       };
24081       return function(dp) {
24082         var a4, b3, e3, k3, v3, i3 = 0, c2 = [], rand = new BigNumber2(ONE);
24083         if (dp == null) dp = DECIMAL_PLACES;
24084         else intCheck(dp, 0, MAX);
24085         k3 = mathceil(dp / LOG_BASE);
24086         if (CRYPTO) {
24087           if (crypto.getRandomValues) {
24088             a4 = crypto.getRandomValues(new Uint32Array(k3 *= 2));
24089             for (; i3 < k3; ) {
24090               v3 = a4[i3] * 131072 + (a4[i3 + 1] >>> 11);
24091               if (v3 >= 9e15) {
24092                 b3 = crypto.getRandomValues(new Uint32Array(2));
24093                 a4[i3] = b3[0];
24094                 a4[i3 + 1] = b3[1];
24095               } else {
24096                 c2.push(v3 % 1e14);
24097                 i3 += 2;
24098               }
24099             }
24100             i3 = k3 / 2;
24101           } else if (crypto.randomBytes) {
24102             a4 = crypto.randomBytes(k3 *= 7);
24103             for (; i3 < k3; ) {
24104               v3 = (a4[i3] & 31) * 281474976710656 + a4[i3 + 1] * 1099511627776 + a4[i3 + 2] * 4294967296 + a4[i3 + 3] * 16777216 + (a4[i3 + 4] << 16) + (a4[i3 + 5] << 8) + a4[i3 + 6];
24105               if (v3 >= 9e15) {
24106                 crypto.randomBytes(7).copy(a4, i3);
24107               } else {
24108                 c2.push(v3 % 1e14);
24109                 i3 += 7;
24110               }
24111             }
24112             i3 = k3 / 7;
24113           } else {
24114             CRYPTO = false;
24115             throw Error(bignumberError + "crypto unavailable");
24116           }
24117         }
24118         if (!CRYPTO) {
24119           for (; i3 < k3; ) {
24120             v3 = random53bitInt();
24121             if (v3 < 9e15) c2[i3++] = v3 % 1e14;
24122           }
24123         }
24124         k3 = c2[--i3];
24125         dp %= LOG_BASE;
24126         if (k3 && dp) {
24127           v3 = POWS_TEN[LOG_BASE - dp];
24128           c2[i3] = mathfloor(k3 / v3) * v3;
24129         }
24130         for (; c2[i3] === 0; c2.pop(), i3--) ;
24131         if (i3 < 0) {
24132           c2 = [e3 = 0];
24133         } else {
24134           for (e3 = -1; c2[0] === 0; c2.splice(0, 1), e3 -= LOG_BASE) ;
24135           for (i3 = 1, v3 = c2[0]; v3 >= 10; v3 /= 10, i3++) ;
24136           if (i3 < LOG_BASE) e3 -= LOG_BASE - i3;
24137         }
24138         rand.e = e3;
24139         rand.c = c2;
24140         return rand;
24141       };
24142     }();
24143     BigNumber2.sum = function() {
24144       var i3 = 1, args = arguments, sum = new BigNumber2(args[0]);
24145       for (; i3 < args.length; ) sum = sum.plus(args[i3++]);
24146       return sum;
24147     };
24148     convertBase = /* @__PURE__ */ function() {
24149       var decimal = "0123456789";
24150       function toBaseOut(str, baseIn, baseOut, alphabet) {
24151         var j3, arr = [0], arrL, i3 = 0, len = str.length;
24152         for (; i3 < len; ) {
24153           for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
24154           arr[0] += alphabet.indexOf(str.charAt(i3++));
24155           for (j3 = 0; j3 < arr.length; j3++) {
24156             if (arr[j3] > baseOut - 1) {
24157               if (arr[j3 + 1] == null) arr[j3 + 1] = 0;
24158               arr[j3 + 1] += arr[j3] / baseOut | 0;
24159               arr[j3] %= baseOut;
24160             }
24161           }
24162         }
24163         return arr.reverse();
24164       }
24165       return function(str, baseIn, baseOut, sign2, callerIsToString) {
24166         var alphabet, d2, e3, k3, r2, x2, xc, y2, i3 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
24167         if (i3 >= 0) {
24168           k3 = POW_PRECISION;
24169           POW_PRECISION = 0;
24170           str = str.replace(".", "");
24171           y2 = new BigNumber2(baseIn);
24172           x2 = y2.pow(str.length - i3);
24173           POW_PRECISION = k3;
24174           y2.c = toBaseOut(
24175             toFixedPoint(coeffToString(x2.c), x2.e, "0"),
24176             10,
24177             baseOut,
24178             decimal
24179           );
24180           y2.e = y2.c.length;
24181         }
24182         xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
24183         e3 = k3 = xc.length;
24184         for (; xc[--k3] == 0; xc.pop()) ;
24185         if (!xc[0]) return alphabet.charAt(0);
24186         if (i3 < 0) {
24187           --e3;
24188         } else {
24189           x2.c = xc;
24190           x2.e = e3;
24191           x2.s = sign2;
24192           x2 = div(x2, y2, dp, rm, baseOut);
24193           xc = x2.c;
24194           r2 = x2.r;
24195           e3 = x2.e;
24196         }
24197         d2 = e3 + dp + 1;
24198         i3 = xc[d2];
24199         k3 = baseOut / 2;
24200         r2 = r2 || d2 < 0 || xc[d2 + 1] != null;
24201         r2 = rm < 4 ? (i3 != null || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : i3 > k3 || i3 == k3 && (rm == 4 || r2 || rm == 6 && xc[d2 - 1] & 1 || rm == (x2.s < 0 ? 8 : 7));
24202         if (d2 < 1 || !xc[0]) {
24203           str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
24204         } else {
24205           xc.length = d2;
24206           if (r2) {
24207             for (--baseOut; ++xc[--d2] > baseOut; ) {
24208               xc[d2] = 0;
24209               if (!d2) {
24210                 ++e3;
24211                 xc = [1].concat(xc);
24212               }
24213             }
24214           }
24215           for (k3 = xc.length; !xc[--k3]; ) ;
24216           for (i3 = 0, str = ""; i3 <= k3; str += alphabet.charAt(xc[i3++])) ;
24217           str = toFixedPoint(str, e3, alphabet.charAt(0));
24218         }
24219         return str;
24220       };
24221     }();
24222     div = /* @__PURE__ */ function() {
24223       function multiply(x2, k3, base) {
24224         var m3, temp, xlo, xhi, carry = 0, i3 = x2.length, klo = k3 % SQRT_BASE, khi = k3 / SQRT_BASE | 0;
24225         for (x2 = x2.slice(); i3--; ) {
24226           xlo = x2[i3] % SQRT_BASE;
24227           xhi = x2[i3] / SQRT_BASE | 0;
24228           m3 = khi * xlo + xhi * klo;
24229           temp = klo * xlo + m3 % SQRT_BASE * SQRT_BASE + carry;
24230           carry = (temp / base | 0) + (m3 / SQRT_BASE | 0) + khi * xhi;
24231           x2[i3] = temp % base;
24232         }
24233         if (carry) x2 = [carry].concat(x2);
24234         return x2;
24235       }
24236       function compare2(a4, b3, aL, bL) {
24237         var i3, cmp;
24238         if (aL != bL) {
24239           cmp = aL > bL ? 1 : -1;
24240         } else {
24241           for (i3 = cmp = 0; i3 < aL; i3++) {
24242             if (a4[i3] != b3[i3]) {
24243               cmp = a4[i3] > b3[i3] ? 1 : -1;
24244               break;
24245             }
24246           }
24247         }
24248         return cmp;
24249       }
24250       function subtract(a4, b3, aL, base) {
24251         var i3 = 0;
24252         for (; aL--; ) {
24253           a4[aL] -= i3;
24254           i3 = a4[aL] < b3[aL] ? 1 : 0;
24255           a4[aL] = i3 * base + a4[aL] - b3[aL];
24256         }
24257         for (; !a4[0] && a4.length > 1; a4.splice(0, 1)) ;
24258       }
24259       return function(x2, y2, dp, rm, base) {
24260         var cmp, e3, i3, more, n3, prod, prodL, q3, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s2 = x2.s == y2.s ? 1 : -1, xc = x2.c, yc = y2.c;
24261         if (!xc || !xc[0] || !yc || !yc[0]) {
24262           return new BigNumber2(
24263             // Return NaN if either NaN, or both Infinity or 0.
24264             !x2.s || !y2.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
24265               // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
24266               xc && xc[0] == 0 || !yc ? s2 * 0 : s2 / 0
24267             )
24268           );
24269         }
24270         q3 = new BigNumber2(s2);
24271         qc = q3.c = [];
24272         e3 = x2.e - y2.e;
24273         s2 = dp + e3 + 1;
24274         if (!base) {
24275           base = BASE;
24276           e3 = bitFloor(x2.e / LOG_BASE) - bitFloor(y2.e / LOG_BASE);
24277           s2 = s2 / LOG_BASE | 0;
24278         }
24279         for (i3 = 0; yc[i3] == (xc[i3] || 0); i3++) ;
24280         if (yc[i3] > (xc[i3] || 0)) e3--;
24281         if (s2 < 0) {
24282           qc.push(1);
24283           more = true;
24284         } else {
24285           xL = xc.length;
24286           yL = yc.length;
24287           i3 = 0;
24288           s2 += 2;
24289           n3 = mathfloor(base / (yc[0] + 1));
24290           if (n3 > 1) {
24291             yc = multiply(yc, n3, base);
24292             xc = multiply(xc, n3, base);
24293             yL = yc.length;
24294             xL = xc.length;
24295           }
24296           xi = yL;
24297           rem = xc.slice(0, yL);
24298           remL = rem.length;
24299           for (; remL < yL; rem[remL++] = 0) ;
24300           yz = yc.slice();
24301           yz = [0].concat(yz);
24302           yc0 = yc[0];
24303           if (yc[1] >= base / 2) yc0++;
24304           do {
24305             n3 = 0;
24306             cmp = compare2(yc, rem, yL, remL);
24307             if (cmp < 0) {
24308               rem0 = rem[0];
24309               if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
24310               n3 = mathfloor(rem0 / yc0);
24311               if (n3 > 1) {
24312                 if (n3 >= base) n3 = base - 1;
24313                 prod = multiply(yc, n3, base);
24314                 prodL = prod.length;
24315                 remL = rem.length;
24316                 while (compare2(prod, rem, prodL, remL) == 1) {
24317                   n3--;
24318                   subtract(prod, yL < prodL ? yz : yc, prodL, base);
24319                   prodL = prod.length;
24320                   cmp = 1;
24321                 }
24322               } else {
24323                 if (n3 == 0) {
24324                   cmp = n3 = 1;
24325                 }
24326                 prod = yc.slice();
24327                 prodL = prod.length;
24328               }
24329               if (prodL < remL) prod = [0].concat(prod);
24330               subtract(rem, prod, remL, base);
24331               remL = rem.length;
24332               if (cmp == -1) {
24333                 while (compare2(yc, rem, yL, remL) < 1) {
24334                   n3++;
24335                   subtract(rem, yL < remL ? yz : yc, remL, base);
24336                   remL = rem.length;
24337                 }
24338               }
24339             } else if (cmp === 0) {
24340               n3++;
24341               rem = [0];
24342             }
24343             qc[i3++] = n3;
24344             if (rem[0]) {
24345               rem[remL++] = xc[xi] || 0;
24346             } else {
24347               rem = [xc[xi]];
24348               remL = 1;
24349             }
24350           } while ((xi++ < xL || rem[0] != null) && s2--);
24351           more = rem[0] != null;
24352           if (!qc[0]) qc.splice(0, 1);
24353         }
24354         if (base == BASE) {
24355           for (i3 = 1, s2 = qc[0]; s2 >= 10; s2 /= 10, i3++) ;
24356           round(q3, dp + (q3.e = i3 + e3 * LOG_BASE - 1) + 1, rm, more);
24357         } else {
24358           q3.e = e3;
24359           q3.r = +more;
24360         }
24361         return q3;
24362       };
24363     }();
24364     function format2(n3, i3, rm, id2) {
24365       var c0, e3, ne2, len, str;
24366       if (rm == null) rm = ROUNDING_MODE;
24367       else intCheck(rm, 0, 8);
24368       if (!n3.c) return n3.toString();
24369       c0 = n3.c[0];
24370       ne2 = n3.e;
24371       if (i3 == null) {
24372         str = coeffToString(n3.c);
24373         str = id2 == 1 || id2 == 2 && (ne2 <= TO_EXP_NEG || ne2 >= TO_EXP_POS) ? toExponential(str, ne2) : toFixedPoint(str, ne2, "0");
24374       } else {
24375         n3 = round(new BigNumber2(n3), i3, rm);
24376         e3 = n3.e;
24377         str = coeffToString(n3.c);
24378         len = str.length;
24379         if (id2 == 1 || id2 == 2 && (i3 <= e3 || e3 <= TO_EXP_NEG)) {
24380           for (; len < i3; str += "0", len++) ;
24381           str = toExponential(str, e3);
24382         } else {
24383           i3 -= ne2;
24384           str = toFixedPoint(str, e3, "0");
24385           if (e3 + 1 > len) {
24386             if (--i3 > 0) for (str += "."; i3--; str += "0") ;
24387           } else {
24388             i3 += e3 - len;
24389             if (i3 > 0) {
24390               if (e3 + 1 == len) str += ".";
24391               for (; i3--; str += "0") ;
24392             }
24393           }
24394         }
24395       }
24396       return n3.s < 0 && c0 ? "-" + str : str;
24397     }
24398     function maxOrMin(args, n3) {
24399       var k3, y2, i3 = 1, x2 = new BigNumber2(args[0]);
24400       for (; i3 < args.length; i3++) {
24401         y2 = new BigNumber2(args[i3]);
24402         if (!y2.s || (k3 = compare(x2, y2)) === n3 || k3 === 0 && x2.s === n3) {
24403           x2 = y2;
24404         }
24405       }
24406       return x2;
24407     }
24408     function normalise(n3, c2, e3) {
24409       var i3 = 1, j3 = c2.length;
24410       for (; !c2[--j3]; c2.pop()) ;
24411       for (j3 = c2[0]; j3 >= 10; j3 /= 10, i3++) ;
24412       if ((e3 = i3 + e3 * LOG_BASE - 1) > MAX_EXP) {
24413         n3.c = n3.e = null;
24414       } else if (e3 < MIN_EXP) {
24415         n3.c = [n3.e = 0];
24416       } else {
24417         n3.e = e3;
24418         n3.c = c2;
24419       }
24420       return n3;
24421     }
24422     parseNumeric2 = /* @__PURE__ */ function() {
24423       var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
24424       return function(x2, str, isNum, b3) {
24425         var base, s2 = isNum ? str : str.replace(whitespaceOrPlus, "");
24426         if (isInfinityOrNaN.test(s2)) {
24427           x2.s = isNaN(s2) ? null : s2 < 0 ? -1 : 1;
24428         } else {
24429           if (!isNum) {
24430             s2 = s2.replace(basePrefix, function(m3, p1, p2) {
24431               base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
24432               return !b3 || b3 == base ? p1 : m3;
24433             });
24434             if (b3) {
24435               base = b3;
24436               s2 = s2.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
24437             }
24438             if (str != s2) return new BigNumber2(s2, base);
24439           }
24440           if (BigNumber2.DEBUG) {
24441             throw Error(bignumberError + "Not a" + (b3 ? " base " + b3 : "") + " number: " + str);
24442           }
24443           x2.s = null;
24444         }
24445         x2.c = x2.e = null;
24446       };
24447     }();
24448     function round(x2, sd, rm, r2) {
24449       var d2, i3, j3, k3, n3, ni, rd, xc = x2.c, pows10 = POWS_TEN;
24450       if (xc) {
24451         out: {
24452           for (d2 = 1, k3 = xc[0]; k3 >= 10; k3 /= 10, d2++) ;
24453           i3 = sd - d2;
24454           if (i3 < 0) {
24455             i3 += LOG_BASE;
24456             j3 = sd;
24457             n3 = xc[ni = 0];
24458             rd = mathfloor(n3 / pows10[d2 - j3 - 1] % 10);
24459           } else {
24460             ni = mathceil((i3 + 1) / LOG_BASE);
24461             if (ni >= xc.length) {
24462               if (r2) {
24463                 for (; xc.length <= ni; xc.push(0)) ;
24464                 n3 = rd = 0;
24465                 d2 = 1;
24466                 i3 %= LOG_BASE;
24467                 j3 = i3 - LOG_BASE + 1;
24468               } else {
24469                 break out;
24470               }
24471             } else {
24472               n3 = k3 = xc[ni];
24473               for (d2 = 1; k3 >= 10; k3 /= 10, d2++) ;
24474               i3 %= LOG_BASE;
24475               j3 = i3 - LOG_BASE + d2;
24476               rd = j3 < 0 ? 0 : mathfloor(n3 / pows10[d2 - j3 - 1] % 10);
24477             }
24478           }
24479           r2 = r2 || sd < 0 || // Are there any non-zero digits after the rounding digit?
24480           // The expression  n % pows10[d - j - 1]  returns all digits of n to the right
24481           // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
24482           xc[ni + 1] != null || (j3 < 0 ? n3 : n3 % pows10[d2 - j3 - 1]);
24483           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.
24484           (i3 > 0 ? j3 > 0 ? n3 / pows10[d2 - j3] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
24485           if (sd < 1 || !xc[0]) {
24486             xc.length = 0;
24487             if (r2) {
24488               sd -= x2.e + 1;
24489               xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
24490               x2.e = -sd || 0;
24491             } else {
24492               xc[0] = x2.e = 0;
24493             }
24494             return x2;
24495           }
24496           if (i3 == 0) {
24497             xc.length = ni;
24498             k3 = 1;
24499             ni--;
24500           } else {
24501             xc.length = ni + 1;
24502             k3 = pows10[LOG_BASE - i3];
24503             xc[ni] = j3 > 0 ? mathfloor(n3 / pows10[d2 - j3] % pows10[j3]) * k3 : 0;
24504           }
24505           if (r2) {
24506             for (; ; ) {
24507               if (ni == 0) {
24508                 for (i3 = 1, j3 = xc[0]; j3 >= 10; j3 /= 10, i3++) ;
24509                 j3 = xc[0] += k3;
24510                 for (k3 = 1; j3 >= 10; j3 /= 10, k3++) ;
24511                 if (i3 != k3) {
24512                   x2.e++;
24513                   if (xc[0] == BASE) xc[0] = 1;
24514                 }
24515                 break;
24516               } else {
24517                 xc[ni] += k3;
24518                 if (xc[ni] != BASE) break;
24519                 xc[ni--] = 0;
24520                 k3 = 1;
24521               }
24522             }
24523           }
24524           for (i3 = xc.length; xc[--i3] === 0; xc.pop()) ;
24525         }
24526         if (x2.e > MAX_EXP) {
24527           x2.c = x2.e = null;
24528         } else if (x2.e < MIN_EXP) {
24529           x2.c = [x2.e = 0];
24530         }
24531       }
24532       return x2;
24533     }
24534     function valueOf(n3) {
24535       var str, e3 = n3.e;
24536       if (e3 === null) return n3.toString();
24537       str = coeffToString(n3.c);
24538       str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(str, e3) : toFixedPoint(str, e3, "0");
24539       return n3.s < 0 ? "-" + str : str;
24540     }
24541     P3.absoluteValue = P3.abs = function() {
24542       var x2 = new BigNumber2(this);
24543       if (x2.s < 0) x2.s = 1;
24544       return x2;
24545     };
24546     P3.comparedTo = function(y2, b3) {
24547       return compare(this, new BigNumber2(y2, b3));
24548     };
24549     P3.decimalPlaces = P3.dp = function(dp, rm) {
24550       var c2, n3, v3, x2 = this;
24551       if (dp != null) {
24552         intCheck(dp, 0, MAX);
24553         if (rm == null) rm = ROUNDING_MODE;
24554         else intCheck(rm, 0, 8);
24555         return round(new BigNumber2(x2), dp + x2.e + 1, rm);
24556       }
24557       if (!(c2 = x2.c)) return null;
24558       n3 = ((v3 = c2.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
24559       if (v3 = c2[v3]) for (; v3 % 10 == 0; v3 /= 10, n3--) ;
24560       if (n3 < 0) n3 = 0;
24561       return n3;
24562     };
24563     P3.dividedBy = P3.div = function(y2, b3) {
24564       return div(this, new BigNumber2(y2, b3), DECIMAL_PLACES, ROUNDING_MODE);
24565     };
24566     P3.dividedToIntegerBy = P3.idiv = function(y2, b3) {
24567       return div(this, new BigNumber2(y2, b3), 0, 1);
24568     };
24569     P3.exponentiatedBy = P3.pow = function(n3, m3) {
24570       var half, isModExp, i3, k3, more, nIsBig, nIsNeg, nIsOdd, y2, x2 = this;
24571       n3 = new BigNumber2(n3);
24572       if (n3.c && !n3.isInteger()) {
24573         throw Error(bignumberError + "Exponent not an integer: " + valueOf(n3));
24574       }
24575       if (m3 != null) m3 = new BigNumber2(m3);
24576       nIsBig = n3.e > 14;
24577       if (!x2.c || !x2.c[0] || x2.c[0] == 1 && !x2.e && x2.c.length == 1 || !n3.c || !n3.c[0]) {
24578         y2 = new BigNumber2(Math.pow(+valueOf(x2), nIsBig ? n3.s * (2 - isOdd(n3)) : +valueOf(n3)));
24579         return m3 ? y2.mod(m3) : y2;
24580       }
24581       nIsNeg = n3.s < 0;
24582       if (m3) {
24583         if (m3.c ? !m3.c[0] : !m3.s) return new BigNumber2(NaN);
24584         isModExp = !nIsNeg && x2.isInteger() && m3.isInteger();
24585         if (isModExp) x2 = x2.mod(m3);
24586       } 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))) {
24587         k3 = x2.s < 0 && isOdd(n3) ? -0 : 0;
24588         if (x2.e > -1) k3 = 1 / k3;
24589         return new BigNumber2(nIsNeg ? 1 / k3 : k3);
24590       } else if (POW_PRECISION) {
24591         k3 = mathceil(POW_PRECISION / LOG_BASE + 2);
24592       }
24593       if (nIsBig) {
24594         half = new BigNumber2(0.5);
24595         if (nIsNeg) n3.s = 1;
24596         nIsOdd = isOdd(n3);
24597       } else {
24598         i3 = Math.abs(+valueOf(n3));
24599         nIsOdd = i3 % 2;
24600       }
24601       y2 = new BigNumber2(ONE);
24602       for (; ; ) {
24603         if (nIsOdd) {
24604           y2 = y2.times(x2);
24605           if (!y2.c) break;
24606           if (k3) {
24607             if (y2.c.length > k3) y2.c.length = k3;
24608           } else if (isModExp) {
24609             y2 = y2.mod(m3);
24610           }
24611         }
24612         if (i3) {
24613           i3 = mathfloor(i3 / 2);
24614           if (i3 === 0) break;
24615           nIsOdd = i3 % 2;
24616         } else {
24617           n3 = n3.times(half);
24618           round(n3, n3.e + 1, 1);
24619           if (n3.e > 14) {
24620             nIsOdd = isOdd(n3);
24621           } else {
24622             i3 = +valueOf(n3);
24623             if (i3 === 0) break;
24624             nIsOdd = i3 % 2;
24625           }
24626         }
24627         x2 = x2.times(x2);
24628         if (k3) {
24629           if (x2.c && x2.c.length > k3) x2.c.length = k3;
24630         } else if (isModExp) {
24631           x2 = x2.mod(m3);
24632         }
24633       }
24634       if (isModExp) return y2;
24635       if (nIsNeg) y2 = ONE.div(y2);
24636       return m3 ? y2.mod(m3) : k3 ? round(y2, POW_PRECISION, ROUNDING_MODE, more) : y2;
24637     };
24638     P3.integerValue = function(rm) {
24639       var n3 = new BigNumber2(this);
24640       if (rm == null) rm = ROUNDING_MODE;
24641       else intCheck(rm, 0, 8);
24642       return round(n3, n3.e + 1, rm);
24643     };
24644     P3.isEqualTo = P3.eq = function(y2, b3) {
24645       return compare(this, new BigNumber2(y2, b3)) === 0;
24646     };
24647     P3.isFinite = function() {
24648       return !!this.c;
24649     };
24650     P3.isGreaterThan = P3.gt = function(y2, b3) {
24651       return compare(this, new BigNumber2(y2, b3)) > 0;
24652     };
24653     P3.isGreaterThanOrEqualTo = P3.gte = function(y2, b3) {
24654       return (b3 = compare(this, new BigNumber2(y2, b3))) === 1 || b3 === 0;
24655     };
24656     P3.isInteger = function() {
24657       return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
24658     };
24659     P3.isLessThan = P3.lt = function(y2, b3) {
24660       return compare(this, new BigNumber2(y2, b3)) < 0;
24661     };
24662     P3.isLessThanOrEqualTo = P3.lte = function(y2, b3) {
24663       return (b3 = compare(this, new BigNumber2(y2, b3))) === -1 || b3 === 0;
24664     };
24665     P3.isNaN = function() {
24666       return !this.s;
24667     };
24668     P3.isNegative = function() {
24669       return this.s < 0;
24670     };
24671     P3.isPositive = function() {
24672       return this.s > 0;
24673     };
24674     P3.isZero = function() {
24675       return !!this.c && this.c[0] == 0;
24676     };
24677     P3.minus = function(y2, b3) {
24678       var i3, j3, t2, xLTy, x2 = this, a4 = x2.s;
24679       y2 = new BigNumber2(y2, b3);
24680       b3 = y2.s;
24681       if (!a4 || !b3) return new BigNumber2(NaN);
24682       if (a4 != b3) {
24683         y2.s = -b3;
24684         return x2.plus(y2);
24685       }
24686       var xe3 = x2.e / LOG_BASE, ye3 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
24687       if (!xe3 || !ye3) {
24688         if (!xc || !yc) return xc ? (y2.s = -b3, y2) : new BigNumber2(yc ? x2 : NaN);
24689         if (!xc[0] || !yc[0]) {
24690           return yc[0] ? (y2.s = -b3, y2) : new BigNumber2(xc[0] ? x2 : (
24691             // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
24692             ROUNDING_MODE == 3 ? -0 : 0
24693           ));
24694         }
24695       }
24696       xe3 = bitFloor(xe3);
24697       ye3 = bitFloor(ye3);
24698       xc = xc.slice();
24699       if (a4 = xe3 - ye3) {
24700         if (xLTy = a4 < 0) {
24701           a4 = -a4;
24702           t2 = xc;
24703         } else {
24704           ye3 = xe3;
24705           t2 = yc;
24706         }
24707         t2.reverse();
24708         for (b3 = a4; b3--; t2.push(0)) ;
24709         t2.reverse();
24710       } else {
24711         j3 = (xLTy = (a4 = xc.length) < (b3 = yc.length)) ? a4 : b3;
24712         for (a4 = b3 = 0; b3 < j3; b3++) {
24713           if (xc[b3] != yc[b3]) {
24714             xLTy = xc[b3] < yc[b3];
24715             break;
24716           }
24717         }
24718       }
24719       if (xLTy) {
24720         t2 = xc;
24721         xc = yc;
24722         yc = t2;
24723         y2.s = -y2.s;
24724       }
24725       b3 = (j3 = yc.length) - (i3 = xc.length);
24726       if (b3 > 0) for (; b3--; xc[i3++] = 0) ;
24727       b3 = BASE - 1;
24728       for (; j3 > a4; ) {
24729         if (xc[--j3] < yc[j3]) {
24730           for (i3 = j3; i3 && !xc[--i3]; xc[i3] = b3) ;
24731           --xc[i3];
24732           xc[j3] += BASE;
24733         }
24734         xc[j3] -= yc[j3];
24735       }
24736       for (; xc[0] == 0; xc.splice(0, 1), --ye3) ;
24737       if (!xc[0]) {
24738         y2.s = ROUNDING_MODE == 3 ? -1 : 1;
24739         y2.c = [y2.e = 0];
24740         return y2;
24741       }
24742       return normalise(y2, xc, ye3);
24743     };
24744     P3.modulo = P3.mod = function(y2, b3) {
24745       var q3, s2, x2 = this;
24746       y2 = new BigNumber2(y2, b3);
24747       if (!x2.c || !y2.s || y2.c && !y2.c[0]) {
24748         return new BigNumber2(NaN);
24749       } else if (!y2.c || x2.c && !x2.c[0]) {
24750         return new BigNumber2(x2);
24751       }
24752       if (MODULO_MODE == 9) {
24753         s2 = y2.s;
24754         y2.s = 1;
24755         q3 = div(x2, y2, 0, 3);
24756         y2.s = s2;
24757         q3.s *= s2;
24758       } else {
24759         q3 = div(x2, y2, 0, MODULO_MODE);
24760       }
24761       y2 = x2.minus(q3.times(y2));
24762       if (!y2.c[0] && MODULO_MODE == 1) y2.s = x2.s;
24763       return y2;
24764     };
24765     P3.multipliedBy = P3.times = function(y2, b3) {
24766       var c2, e3, i3, j3, k3, m3, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x2 = this, xc = x2.c, yc = (y2 = new BigNumber2(y2, b3)).c;
24767       if (!xc || !yc || !xc[0] || !yc[0]) {
24768         if (!x2.s || !y2.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
24769           y2.c = y2.e = y2.s = null;
24770         } else {
24771           y2.s *= x2.s;
24772           if (!xc || !yc) {
24773             y2.c = y2.e = null;
24774           } else {
24775             y2.c = [0];
24776             y2.e = 0;
24777           }
24778         }
24779         return y2;
24780       }
24781       e3 = bitFloor(x2.e / LOG_BASE) + bitFloor(y2.e / LOG_BASE);
24782       y2.s *= x2.s;
24783       xcL = xc.length;
24784       ycL = yc.length;
24785       if (xcL < ycL) {
24786         zc = xc;
24787         xc = yc;
24788         yc = zc;
24789         i3 = xcL;
24790         xcL = ycL;
24791         ycL = i3;
24792       }
24793       for (i3 = xcL + ycL, zc = []; i3--; zc.push(0)) ;
24794       base = BASE;
24795       sqrtBase = SQRT_BASE;
24796       for (i3 = ycL; --i3 >= 0; ) {
24797         c2 = 0;
24798         ylo = yc[i3] % sqrtBase;
24799         yhi = yc[i3] / sqrtBase | 0;
24800         for (k3 = xcL, j3 = i3 + k3; j3 > i3; ) {
24801           xlo = xc[--k3] % sqrtBase;
24802           xhi = xc[k3] / sqrtBase | 0;
24803           m3 = yhi * xlo + xhi * ylo;
24804           xlo = ylo * xlo + m3 % sqrtBase * sqrtBase + zc[j3] + c2;
24805           c2 = (xlo / base | 0) + (m3 / sqrtBase | 0) + yhi * xhi;
24806           zc[j3--] = xlo % base;
24807         }
24808         zc[j3] = c2;
24809       }
24810       if (c2) {
24811         ++e3;
24812       } else {
24813         zc.splice(0, 1);
24814       }
24815       return normalise(y2, zc, e3);
24816     };
24817     P3.negated = function() {
24818       var x2 = new BigNumber2(this);
24819       x2.s = -x2.s || null;
24820       return x2;
24821     };
24822     P3.plus = function(y2, b3) {
24823       var t2, x2 = this, a4 = x2.s;
24824       y2 = new BigNumber2(y2, b3);
24825       b3 = y2.s;
24826       if (!a4 || !b3) return new BigNumber2(NaN);
24827       if (a4 != b3) {
24828         y2.s = -b3;
24829         return x2.minus(y2);
24830       }
24831       var xe3 = x2.e / LOG_BASE, ye3 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
24832       if (!xe3 || !ye3) {
24833         if (!xc || !yc) return new BigNumber2(a4 / 0);
24834         if (!xc[0] || !yc[0]) return yc[0] ? y2 : new BigNumber2(xc[0] ? x2 : a4 * 0);
24835       }
24836       xe3 = bitFloor(xe3);
24837       ye3 = bitFloor(ye3);
24838       xc = xc.slice();
24839       if (a4 = xe3 - ye3) {
24840         if (a4 > 0) {
24841           ye3 = xe3;
24842           t2 = yc;
24843         } else {
24844           a4 = -a4;
24845           t2 = xc;
24846         }
24847         t2.reverse();
24848         for (; a4--; t2.push(0)) ;
24849         t2.reverse();
24850       }
24851       a4 = xc.length;
24852       b3 = yc.length;
24853       if (a4 - b3 < 0) {
24854         t2 = yc;
24855         yc = xc;
24856         xc = t2;
24857         b3 = a4;
24858       }
24859       for (a4 = 0; b3; ) {
24860         a4 = (xc[--b3] = xc[b3] + yc[b3] + a4) / BASE | 0;
24861         xc[b3] = BASE === xc[b3] ? 0 : xc[b3] % BASE;
24862       }
24863       if (a4) {
24864         xc = [a4].concat(xc);
24865         ++ye3;
24866       }
24867       return normalise(y2, xc, ye3);
24868     };
24869     P3.precision = P3.sd = function(sd, rm) {
24870       var c2, n3, v3, x2 = this;
24871       if (sd != null && sd !== !!sd) {
24872         intCheck(sd, 1, MAX);
24873         if (rm == null) rm = ROUNDING_MODE;
24874         else intCheck(rm, 0, 8);
24875         return round(new BigNumber2(x2), sd, rm);
24876       }
24877       if (!(c2 = x2.c)) return null;
24878       v3 = c2.length - 1;
24879       n3 = v3 * LOG_BASE + 1;
24880       if (v3 = c2[v3]) {
24881         for (; v3 % 10 == 0; v3 /= 10, n3--) ;
24882         for (v3 = c2[0]; v3 >= 10; v3 /= 10, n3++) ;
24883       }
24884       if (sd && x2.e + 1 > n3) n3 = x2.e + 1;
24885       return n3;
24886     };
24887     P3.shiftedBy = function(k3) {
24888       intCheck(k3, -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3);
24889       return this.times("1e" + k3);
24890     };
24891     P3.squareRoot = P3.sqrt = function() {
24892       var m3, n3, r2, rep, t2, x2 = this, c2 = x2.c, s2 = x2.s, e3 = x2.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5");
24893       if (s2 !== 1 || !c2 || !c2[0]) {
24894         return new BigNumber2(!s2 || s2 < 0 && (!c2 || c2[0]) ? NaN : c2 ? x2 : 1 / 0);
24895       }
24896       s2 = Math.sqrt(+valueOf(x2));
24897       if (s2 == 0 || s2 == 1 / 0) {
24898         n3 = coeffToString(c2);
24899         if ((n3.length + e3) % 2 == 0) n3 += "0";
24900         s2 = Math.sqrt(+n3);
24901         e3 = bitFloor((e3 + 1) / 2) - (e3 < 0 || e3 % 2);
24902         if (s2 == 1 / 0) {
24903           n3 = "5e" + e3;
24904         } else {
24905           n3 = s2.toExponential();
24906           n3 = n3.slice(0, n3.indexOf("e") + 1) + e3;
24907         }
24908         r2 = new BigNumber2(n3);
24909       } else {
24910         r2 = new BigNumber2(s2 + "");
24911       }
24912       if (r2.c[0]) {
24913         e3 = r2.e;
24914         s2 = e3 + dp;
24915         if (s2 < 3) s2 = 0;
24916         for (; ; ) {
24917           t2 = r2;
24918           r2 = half.times(t2.plus(div(x2, t2, dp, 1)));
24919           if (coeffToString(t2.c).slice(0, s2) === (n3 = coeffToString(r2.c)).slice(0, s2)) {
24920             if (r2.e < e3) --s2;
24921             n3 = n3.slice(s2 - 3, s2 + 1);
24922             if (n3 == "9999" || !rep && n3 == "4999") {
24923               if (!rep) {
24924                 round(t2, t2.e + DECIMAL_PLACES + 2, 0);
24925                 if (t2.times(t2).eq(x2)) {
24926                   r2 = t2;
24927                   break;
24928                 }
24929               }
24930               dp += 4;
24931               s2 += 4;
24932               rep = 1;
24933             } else {
24934               if (!+n3 || !+n3.slice(1) && n3.charAt(0) == "5") {
24935                 round(r2, r2.e + DECIMAL_PLACES + 2, 1);
24936                 m3 = !r2.times(r2).eq(x2);
24937               }
24938               break;
24939             }
24940           }
24941         }
24942       }
24943       return round(r2, r2.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m3);
24944     };
24945     P3.toExponential = function(dp, rm) {
24946       if (dp != null) {
24947         intCheck(dp, 0, MAX);
24948         dp++;
24949       }
24950       return format2(this, dp, rm, 1);
24951     };
24952     P3.toFixed = function(dp, rm) {
24953       if (dp != null) {
24954         intCheck(dp, 0, MAX);
24955         dp = dp + this.e + 1;
24956       }
24957       return format2(this, dp, rm);
24958     };
24959     P3.toFormat = function(dp, rm, format3) {
24960       var str, x2 = this;
24961       if (format3 == null) {
24962         if (dp != null && rm && typeof rm == "object") {
24963           format3 = rm;
24964           rm = null;
24965         } else if (dp && typeof dp == "object") {
24966           format3 = dp;
24967           dp = rm = null;
24968         } else {
24969           format3 = FORMAT;
24970         }
24971       } else if (typeof format3 != "object") {
24972         throw Error(bignumberError + "Argument not an object: " + format3);
24973       }
24974       str = x2.toFixed(dp, rm);
24975       if (x2.c) {
24976         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;
24977         if (g22) {
24978           i3 = g1;
24979           g1 = g22;
24980           g22 = i3;
24981           len -= i3;
24982         }
24983         if (g1 > 0 && len > 0) {
24984           i3 = len % g1 || g1;
24985           intPart = intDigits.substr(0, i3);
24986           for (; i3 < len; i3 += g1) intPart += groupSeparator + intDigits.substr(i3, g1);
24987           if (g22 > 0) intPart += groupSeparator + intDigits.slice(i3);
24988           if (isNeg) intPart = "-" + intPart;
24989         }
24990         str = fractionPart ? intPart + (format3.decimalSeparator || "") + ((g22 = +format3.fractionGroupSize) ? fractionPart.replace(
24991           new RegExp("\\d{" + g22 + "}\\B", "g"),
24992           "$&" + (format3.fractionGroupSeparator || "")
24993         ) : fractionPart) : intPart;
24994       }
24995       return (format3.prefix || "") + str + (format3.suffix || "");
24996     };
24997     P3.toFraction = function(md) {
24998       var d2, d0, d1, d22, e3, exp2, n3, n0, n1, q3, r2, s2, x2 = this, xc = x2.c;
24999       if (md != null) {
25000         n3 = new BigNumber2(md);
25001         if (!n3.isInteger() && (n3.c || n3.s !== 1) || n3.lt(ONE)) {
25002           throw Error(bignumberError + "Argument " + (n3.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n3));
25003         }
25004       }
25005       if (!xc) return new BigNumber2(x2);
25006       d2 = new BigNumber2(ONE);
25007       n1 = d0 = new BigNumber2(ONE);
25008       d1 = n0 = new BigNumber2(ONE);
25009       s2 = coeffToString(xc);
25010       e3 = d2.e = s2.length - x2.e - 1;
25011       d2.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE) < 0 ? LOG_BASE + exp2 : exp2];
25012       md = !md || n3.comparedTo(d2) > 0 ? e3 > 0 ? d2 : n1 : n3;
25013       exp2 = MAX_EXP;
25014       MAX_EXP = 1 / 0;
25015       n3 = new BigNumber2(s2);
25016       n0.c[0] = 0;
25017       for (; ; ) {
25018         q3 = div(n3, d2, 0, 1);
25019         d22 = d0.plus(q3.times(d1));
25020         if (d22.comparedTo(md) == 1) break;
25021         d0 = d1;
25022         d1 = d22;
25023         n1 = n0.plus(q3.times(d22 = n1));
25024         n0 = d22;
25025         d2 = n3.minus(q3.times(d22 = d2));
25026         n3 = d22;
25027       }
25028       d22 = div(md.minus(d0), d1, 0, 1);
25029       n0 = n0.plus(d22.times(n1));
25030       d0 = d0.plus(d22.times(d1));
25031       n0.s = n1.s = x2.s;
25032       e3 = e3 * 2;
25033       r2 = div(n1, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
25034         div(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
25035       ) < 1 ? [n1, d1] : [n0, d0];
25036       MAX_EXP = exp2;
25037       return r2;
25038     };
25039     P3.toNumber = function() {
25040       return +valueOf(this);
25041     };
25042     P3.toPrecision = function(sd, rm) {
25043       if (sd != null) intCheck(sd, 1, MAX);
25044       return format2(this, sd, rm, 2);
25045     };
25046     P3.toString = function(b3) {
25047       var str, n3 = this, s2 = n3.s, e3 = n3.e;
25048       if (e3 === null) {
25049         if (s2) {
25050           str = "Infinity";
25051           if (s2 < 0) str = "-" + str;
25052         } else {
25053           str = "NaN";
25054         }
25055       } else {
25056         if (b3 == null) {
25057           str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(coeffToString(n3.c), e3) : toFixedPoint(coeffToString(n3.c), e3, "0");
25058         } else if (b3 === 10 && alphabetHasNormalDecimalDigits) {
25059           n3 = round(new BigNumber2(n3), DECIMAL_PLACES + e3 + 1, ROUNDING_MODE);
25060           str = toFixedPoint(coeffToString(n3.c), n3.e, "0");
25061         } else {
25062           intCheck(b3, 2, ALPHABET.length, "Base");
25063           str = convertBase(toFixedPoint(coeffToString(n3.c), e3, "0"), 10, b3, s2, true);
25064         }
25065         if (s2 < 0 && n3.c[0]) str = "-" + str;
25066       }
25067       return str;
25068     };
25069     P3.valueOf = P3.toJSON = function() {
25070       return valueOf(this);
25071     };
25072     P3._isBigNumber = true;
25073     P3[Symbol.toStringTag] = "BigNumber";
25074     P3[Symbol.for("nodejs.util.inspect.custom")] = P3.valueOf;
25075     if (configObject != null) BigNumber2.set(configObject);
25076     return BigNumber2;
25077   }
25078   function bitFloor(n3) {
25079     var i3 = n3 | 0;
25080     return n3 > 0 || n3 === i3 ? i3 : i3 - 1;
25081   }
25082   function coeffToString(a4) {
25083     var s2, z3, i3 = 1, j3 = a4.length, r2 = a4[0] + "";
25084     for (; i3 < j3; ) {
25085       s2 = a4[i3++] + "";
25086       z3 = LOG_BASE - s2.length;
25087       for (; z3--; s2 = "0" + s2) ;
25088       r2 += s2;
25089     }
25090     for (j3 = r2.length; r2.charCodeAt(--j3) === 48; ) ;
25091     return r2.slice(0, j3 + 1 || 1);
25092   }
25093   function compare(x2, y2) {
25094     var a4, b3, xc = x2.c, yc = y2.c, i3 = x2.s, j3 = y2.s, k3 = x2.e, l2 = y2.e;
25095     if (!i3 || !j3) return null;
25096     a4 = xc && !xc[0];
25097     b3 = yc && !yc[0];
25098     if (a4 || b3) return a4 ? b3 ? 0 : -j3 : i3;
25099     if (i3 != j3) return i3;
25100     a4 = i3 < 0;
25101     b3 = k3 == l2;
25102     if (!xc || !yc) return b3 ? 0 : !xc ^ a4 ? 1 : -1;
25103     if (!b3) return k3 > l2 ^ a4 ? 1 : -1;
25104     j3 = (k3 = xc.length) < (l2 = yc.length) ? k3 : l2;
25105     for (i3 = 0; i3 < j3; i3++) if (xc[i3] != yc[i3]) return xc[i3] > yc[i3] ^ a4 ? 1 : -1;
25106     return k3 == l2 ? 0 : k3 > l2 ^ a4 ? 1 : -1;
25107   }
25108   function intCheck(n3, min3, max3, name) {
25109     if (n3 < min3 || n3 > max3 || n3 !== mathfloor(n3)) {
25110       throw Error(bignumberError + (name || "Argument") + (typeof n3 == "number" ? n3 < min3 || n3 > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n3));
25111     }
25112   }
25113   function isOdd(n3) {
25114     var k3 = n3.c.length - 1;
25115     return bitFloor(n3.e / LOG_BASE) == k3 && n3.c[k3] % 2 != 0;
25116   }
25117   function toExponential(str, e3) {
25118     return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e3 < 0 ? "e" : "e+") + e3;
25119   }
25120   function toFixedPoint(str, e3, z3) {
25121     var len, zs;
25122     if (e3 < 0) {
25123       for (zs = z3 + "."; ++e3; zs += z3) ;
25124       str = zs + str;
25125     } else {
25126       len = str.length;
25127       if (++e3 > len) {
25128         for (zs = z3, e3 -= len; --e3; zs += z3) ;
25129         str += zs;
25130       } else if (e3 < len) {
25131         str = str.slice(0, e3) + "." + str.slice(e3);
25132       }
25133     }
25134     return str;
25135   }
25136   var isNumeric, mathceil, mathfloor, bignumberError, tooManyDigits, BASE, LOG_BASE, MAX_SAFE_INTEGER3, POWS_TEN, SQRT_BASE, MAX, BigNumber, bignumber_default;
25137   var init_bignumber = __esm({
25138     "node_modules/bignumber.js/bignumber.mjs"() {
25139       isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
25140       mathceil = Math.ceil;
25141       mathfloor = Math.floor;
25142       bignumberError = "[BigNumber Error] ";
25143       tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
25144       BASE = 1e14;
25145       LOG_BASE = 14;
25146       MAX_SAFE_INTEGER3 = 9007199254740991;
25147       POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
25148       SQRT_BASE = 1e7;
25149       MAX = 1e9;
25150       BigNumber = clone();
25151       bignumber_default = BigNumber;
25152     }
25153   });
25154
25155   // node_modules/splaytree-ts/dist/esm/index.js
25156   var SplayTreeNode, SplayTreeSetNode, SplayTree, _a, _b, SplayTreeSet, SplayTreeIterableIterator, SplayTreeKeyIterableIterator, SplayTreeSetEntryIterableIterator;
25157   var init_esm = __esm({
25158     "node_modules/splaytree-ts/dist/esm/index.js"() {
25159       SplayTreeNode = class {
25160         constructor(key) {
25161           __publicField(this, "key");
25162           __publicField(this, "left", null);
25163           __publicField(this, "right", null);
25164           this.key = key;
25165         }
25166       };
25167       SplayTreeSetNode = class extends SplayTreeNode {
25168         constructor(key) {
25169           super(key);
25170         }
25171       };
25172       SplayTree = class {
25173         constructor() {
25174           __publicField(this, "size", 0);
25175           __publicField(this, "modificationCount", 0);
25176           __publicField(this, "splayCount", 0);
25177         }
25178         splay(key) {
25179           const root3 = this.root;
25180           if (root3 == null) {
25181             this.compare(key, key);
25182             return -1;
25183           }
25184           let right = null;
25185           let newTreeRight = null;
25186           let left = null;
25187           let newTreeLeft = null;
25188           let current = root3;
25189           const compare2 = this.compare;
25190           let comp;
25191           while (true) {
25192             comp = compare2(current.key, key);
25193             if (comp > 0) {
25194               let currentLeft = current.left;
25195               if (currentLeft == null) break;
25196               comp = compare2(currentLeft.key, key);
25197               if (comp > 0) {
25198                 current.left = currentLeft.right;
25199                 currentLeft.right = current;
25200                 current = currentLeft;
25201                 currentLeft = current.left;
25202                 if (currentLeft == null) break;
25203               }
25204               if (right == null) {
25205                 newTreeRight = current;
25206               } else {
25207                 right.left = current;
25208               }
25209               right = current;
25210               current = currentLeft;
25211             } else if (comp < 0) {
25212               let currentRight = current.right;
25213               if (currentRight == null) break;
25214               comp = compare2(currentRight.key, key);
25215               if (comp < 0) {
25216                 current.right = currentRight.left;
25217                 currentRight.left = current;
25218                 current = currentRight;
25219                 currentRight = current.right;
25220                 if (currentRight == null) break;
25221               }
25222               if (left == null) {
25223                 newTreeLeft = current;
25224               } else {
25225                 left.right = current;
25226               }
25227               left = current;
25228               current = currentRight;
25229             } else {
25230               break;
25231             }
25232           }
25233           if (left != null) {
25234             left.right = current.left;
25235             current.left = newTreeLeft;
25236           }
25237           if (right != null) {
25238             right.left = current.right;
25239             current.right = newTreeRight;
25240           }
25241           if (this.root !== current) {
25242             this.root = current;
25243             this.splayCount++;
25244           }
25245           return comp;
25246         }
25247         splayMin(node) {
25248           let current = node;
25249           let nextLeft = current.left;
25250           while (nextLeft != null) {
25251             const left = nextLeft;
25252             current.left = left.right;
25253             left.right = current;
25254             current = left;
25255             nextLeft = current.left;
25256           }
25257           return current;
25258         }
25259         splayMax(node) {
25260           let current = node;
25261           let nextRight = current.right;
25262           while (nextRight != null) {
25263             const right = nextRight;
25264             current.right = right.left;
25265             right.left = current;
25266             current = right;
25267             nextRight = current.right;
25268           }
25269           return current;
25270         }
25271         _delete(key) {
25272           if (this.root == null) return null;
25273           const comp = this.splay(key);
25274           if (comp != 0) return null;
25275           let root3 = this.root;
25276           const result = root3;
25277           const left = root3.left;
25278           this.size--;
25279           if (left == null) {
25280             this.root = root3.right;
25281           } else {
25282             const right = root3.right;
25283             root3 = this.splayMax(left);
25284             root3.right = right;
25285             this.root = root3;
25286           }
25287           this.modificationCount++;
25288           return result;
25289         }
25290         addNewRoot(node, comp) {
25291           this.size++;
25292           this.modificationCount++;
25293           const root3 = this.root;
25294           if (root3 == null) {
25295             this.root = node;
25296             return;
25297           }
25298           if (comp < 0) {
25299             node.left = root3;
25300             node.right = root3.right;
25301             root3.right = null;
25302           } else {
25303             node.right = root3;
25304             node.left = root3.left;
25305             root3.left = null;
25306           }
25307           this.root = node;
25308         }
25309         _first() {
25310           const root3 = this.root;
25311           if (root3 == null) return null;
25312           this.root = this.splayMin(root3);
25313           return this.root;
25314         }
25315         _last() {
25316           const root3 = this.root;
25317           if (root3 == null) return null;
25318           this.root = this.splayMax(root3);
25319           return this.root;
25320         }
25321         clear() {
25322           this.root = null;
25323           this.size = 0;
25324           this.modificationCount++;
25325         }
25326         has(key) {
25327           return this.validKey(key) && this.splay(key) == 0;
25328         }
25329         defaultCompare() {
25330           return (a4, b3) => a4 < b3 ? -1 : a4 > b3 ? 1 : 0;
25331         }
25332         wrap() {
25333           return {
25334             getRoot: () => {
25335               return this.root;
25336             },
25337             setRoot: (root3) => {
25338               this.root = root3;
25339             },
25340             getSize: () => {
25341               return this.size;
25342             },
25343             getModificationCount: () => {
25344               return this.modificationCount;
25345             },
25346             getSplayCount: () => {
25347               return this.splayCount;
25348             },
25349             setSplayCount: (count) => {
25350               this.splayCount = count;
25351             },
25352             splay: (key) => {
25353               return this.splay(key);
25354             },
25355             has: (key) => {
25356               return this.has(key);
25357             }
25358           };
25359         }
25360       };
25361       SplayTreeSet = class _SplayTreeSet extends SplayTree {
25362         constructor(compare2, isValidKey) {
25363           super();
25364           __publicField(this, "root", null);
25365           __publicField(this, "compare");
25366           __publicField(this, "validKey");
25367           __publicField(this, _a, "[object Set]");
25368           this.compare = compare2 != null ? compare2 : this.defaultCompare();
25369           this.validKey = isValidKey != null ? isValidKey : (v3) => v3 != null && v3 != void 0;
25370         }
25371         delete(element) {
25372           if (!this.validKey(element)) return false;
25373           return this._delete(element) != null;
25374         }
25375         deleteAll(elements) {
25376           for (const element of elements) {
25377             this.delete(element);
25378           }
25379         }
25380         forEach(f2) {
25381           const nodes = this[Symbol.iterator]();
25382           let result;
25383           while (result = nodes.next(), !result.done) {
25384             f2(result.value, result.value, this);
25385           }
25386         }
25387         add(element) {
25388           const compare2 = this.splay(element);
25389           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
25390           return this;
25391         }
25392         addAndReturn(element) {
25393           const compare2 = this.splay(element);
25394           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
25395           return this.root.key;
25396         }
25397         addAll(elements) {
25398           for (const element of elements) {
25399             this.add(element);
25400           }
25401         }
25402         isEmpty() {
25403           return this.root == null;
25404         }
25405         isNotEmpty() {
25406           return this.root != null;
25407         }
25408         single() {
25409           if (this.size == 0) throw "Bad state: No element";
25410           if (this.size > 1) throw "Bad state: Too many element";
25411           return this.root.key;
25412         }
25413         first() {
25414           if (this.size == 0) throw "Bad state: No element";
25415           return this._first().key;
25416         }
25417         last() {
25418           if (this.size == 0) throw "Bad state: No element";
25419           return this._last().key;
25420         }
25421         lastBefore(element) {
25422           if (element == null) throw "Invalid arguments(s)";
25423           if (this.root == null) return null;
25424           const comp = this.splay(element);
25425           if (comp < 0) return this.root.key;
25426           let node = this.root.left;
25427           if (node == null) return null;
25428           let nodeRight = node.right;
25429           while (nodeRight != null) {
25430             node = nodeRight;
25431             nodeRight = node.right;
25432           }
25433           return node.key;
25434         }
25435         firstAfter(element) {
25436           if (element == null) throw "Invalid arguments(s)";
25437           if (this.root == null) return null;
25438           const comp = this.splay(element);
25439           if (comp > 0) return this.root.key;
25440           let node = this.root.right;
25441           if (node == null) return null;
25442           let nodeLeft = node.left;
25443           while (nodeLeft != null) {
25444             node = nodeLeft;
25445             nodeLeft = node.left;
25446           }
25447           return node.key;
25448         }
25449         retainAll(elements) {
25450           const retainSet = new _SplayTreeSet(this.compare, this.validKey);
25451           const modificationCount = this.modificationCount;
25452           for (const object of elements) {
25453             if (modificationCount != this.modificationCount) {
25454               throw "Concurrent modification during iteration.";
25455             }
25456             if (this.validKey(object) && this.splay(object) == 0) {
25457               retainSet.add(this.root.key);
25458             }
25459           }
25460           if (retainSet.size != this.size) {
25461             this.root = retainSet.root;
25462             this.size = retainSet.size;
25463             this.modificationCount++;
25464           }
25465         }
25466         lookup(object) {
25467           if (!this.validKey(object)) return null;
25468           const comp = this.splay(object);
25469           if (comp != 0) return null;
25470           return this.root.key;
25471         }
25472         intersection(other) {
25473           const result = new _SplayTreeSet(this.compare, this.validKey);
25474           for (const element of this) {
25475             if (other.has(element)) result.add(element);
25476           }
25477           return result;
25478         }
25479         difference(other) {
25480           const result = new _SplayTreeSet(this.compare, this.validKey);
25481           for (const element of this) {
25482             if (!other.has(element)) result.add(element);
25483           }
25484           return result;
25485         }
25486         union(other) {
25487           const u2 = this.clone();
25488           u2.addAll(other);
25489           return u2;
25490         }
25491         clone() {
25492           const set4 = new _SplayTreeSet(this.compare, this.validKey);
25493           set4.size = this.size;
25494           set4.root = this.copyNode(this.root);
25495           return set4;
25496         }
25497         copyNode(node) {
25498           if (node == null) return null;
25499           function copyChildren(node2, dest) {
25500             let left;
25501             let right;
25502             do {
25503               left = node2.left;
25504               right = node2.right;
25505               if (left != null) {
25506                 const newLeft = new SplayTreeSetNode(left.key);
25507                 dest.left = newLeft;
25508                 copyChildren(left, newLeft);
25509               }
25510               if (right != null) {
25511                 const newRight = new SplayTreeSetNode(right.key);
25512                 dest.right = newRight;
25513                 node2 = right;
25514                 dest = newRight;
25515               }
25516             } while (right != null);
25517           }
25518           const result = new SplayTreeSetNode(node.key);
25519           copyChildren(node, result);
25520           return result;
25521         }
25522         toSet() {
25523           return this.clone();
25524         }
25525         entries() {
25526           return new SplayTreeSetEntryIterableIterator(this.wrap());
25527         }
25528         keys() {
25529           return this[Symbol.iterator]();
25530         }
25531         values() {
25532           return this[Symbol.iterator]();
25533         }
25534         [(_b = Symbol.iterator, _a = Symbol.toStringTag, _b)]() {
25535           return new SplayTreeKeyIterableIterator(this.wrap());
25536         }
25537       };
25538       SplayTreeIterableIterator = class {
25539         constructor(tree) {
25540           __publicField(this, "tree");
25541           __publicField(this, "path", new Array());
25542           __publicField(this, "modificationCount", null);
25543           __publicField(this, "splayCount");
25544           this.tree = tree;
25545           this.splayCount = tree.getSplayCount();
25546         }
25547         [Symbol.iterator]() {
25548           return this;
25549         }
25550         next() {
25551           if (this.moveNext()) return { done: false, value: this.current() };
25552           return { done: true, value: null };
25553         }
25554         current() {
25555           if (!this.path.length) return null;
25556           const node = this.path[this.path.length - 1];
25557           return this.getValue(node);
25558         }
25559         rebuildPath(key) {
25560           this.path.splice(0, this.path.length);
25561           this.tree.splay(key);
25562           this.path.push(this.tree.getRoot());
25563           this.splayCount = this.tree.getSplayCount();
25564         }
25565         findLeftMostDescendent(node) {
25566           while (node != null) {
25567             this.path.push(node);
25568             node = node.left;
25569           }
25570         }
25571         moveNext() {
25572           if (this.modificationCount != this.tree.getModificationCount()) {
25573             if (this.modificationCount == null) {
25574               this.modificationCount = this.tree.getModificationCount();
25575               let node2 = this.tree.getRoot();
25576               while (node2 != null) {
25577                 this.path.push(node2);
25578                 node2 = node2.left;
25579               }
25580               return this.path.length > 0;
25581             }
25582             throw "Concurrent modification during iteration.";
25583           }
25584           if (!this.path.length) return false;
25585           if (this.splayCount != this.tree.getSplayCount()) {
25586             this.rebuildPath(this.path[this.path.length - 1].key);
25587           }
25588           let node = this.path[this.path.length - 1];
25589           let next = node.right;
25590           if (next != null) {
25591             while (next != null) {
25592               this.path.push(next);
25593               next = next.left;
25594             }
25595             return true;
25596           }
25597           this.path.pop();
25598           while (this.path.length && this.path[this.path.length - 1].right === node) {
25599             node = this.path.pop();
25600           }
25601           return this.path.length > 0;
25602         }
25603       };
25604       SplayTreeKeyIterableIterator = class extends SplayTreeIterableIterator {
25605         getValue(node) {
25606           return node.key;
25607         }
25608       };
25609       SplayTreeSetEntryIterableIterator = class extends SplayTreeIterableIterator {
25610         getValue(node) {
25611           return [node.key, node.key];
25612         }
25613       };
25614     }
25615   });
25616
25617   // node_modules/polyclip-ts/dist/esm/index.js
25618   function orient_default(eps) {
25619     const almostCollinear = eps ? (area2, ax, ay, cx, cy) => area2.exponentiatedBy(2).isLessThanOrEqualTo(
25620       cx.minus(ax).exponentiatedBy(2).plus(cy.minus(ay).exponentiatedBy(2)).times(eps)
25621     ) : constant_default6(false);
25622     return (a4, b3, c2) => {
25623       const ax = a4.x, ay = a4.y, cx = c2.x, cy = c2.y;
25624       const area2 = ay.minus(cy).times(b3.x.minus(cx)).minus(ax.minus(cx).times(b3.y.minus(cy)));
25625       if (almostCollinear(area2, ax, ay, cx, cy)) return 0;
25626       return area2.comparedTo(0);
25627     };
25628   }
25629   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;
25630   var init_esm2 = __esm({
25631     "node_modules/polyclip-ts/dist/esm/index.js"() {
25632       init_bignumber();
25633       init_bignumber();
25634       init_esm();
25635       init_esm();
25636       init_esm();
25637       constant_default6 = (x2) => {
25638         return () => {
25639           return x2;
25640         };
25641       };
25642       compare_default = (eps) => {
25643         const almostEqual = eps ? (a4, b3) => b3.minus(a4).abs().isLessThanOrEqualTo(eps) : constant_default6(false);
25644         return (a4, b3) => {
25645           if (almostEqual(a4, b3)) return 0;
25646           return a4.comparedTo(b3);
25647         };
25648       };
25649       identity_default4 = (x2) => {
25650         return x2;
25651       };
25652       snap_default = (eps) => {
25653         if (eps) {
25654           const xTree = new SplayTreeSet(compare_default(eps));
25655           const yTree = new SplayTreeSet(compare_default(eps));
25656           const snapCoord = (coord2, tree) => {
25657             return tree.addAndReturn(coord2);
25658           };
25659           const snap = (v3) => {
25660             return {
25661               x: snapCoord(v3.x, xTree),
25662               y: snapCoord(v3.y, yTree)
25663             };
25664           };
25665           snap({ x: new bignumber_default(0), y: new bignumber_default(0) });
25666           return snap;
25667         }
25668         return identity_default4;
25669       };
25670       set3 = (eps) => {
25671         return {
25672           set: (eps2) => {
25673             precision = set3(eps2);
25674           },
25675           reset: () => set3(eps),
25676           compare: compare_default(eps),
25677           snap: snap_default(eps),
25678           orient: orient_default(eps)
25679         };
25680       };
25681       precision = set3();
25682       isInBbox = (bbox2, point) => {
25683         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);
25684       };
25685       getBboxOverlap = (b1, b22) => {
25686         if (b22.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b22.ll.x) || b22.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b22.ll.y))
25687           return null;
25688         const lowerX = b1.ll.x.isLessThan(b22.ll.x) ? b22.ll.x : b1.ll.x;
25689         const upperX = b1.ur.x.isLessThan(b22.ur.x) ? b1.ur.x : b22.ur.x;
25690         const lowerY = b1.ll.y.isLessThan(b22.ll.y) ? b22.ll.y : b1.ll.y;
25691         const upperY = b1.ur.y.isLessThan(b22.ur.y) ? b1.ur.y : b22.ur.y;
25692         return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };
25693       };
25694       crossProduct = (a4, b3) => a4.x.times(b3.y).minus(a4.y.times(b3.x));
25695       dotProduct = (a4, b3) => a4.x.times(b3.x).plus(a4.y.times(b3.y));
25696       length = (v3) => dotProduct(v3, v3).sqrt();
25697       sineOfAngle = (pShared, pBase, pAngle) => {
25698         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
25699         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
25700         return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
25701       };
25702       cosineOfAngle = (pShared, pBase, pAngle) => {
25703         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
25704         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
25705         return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
25706       };
25707       horizontalIntersection = (pt2, v3, y2) => {
25708         if (v3.y.isZero()) return null;
25709         return { x: pt2.x.plus(v3.x.div(v3.y).times(y2.minus(pt2.y))), y: y2 };
25710       };
25711       verticalIntersection = (pt2, v3, x2) => {
25712         if (v3.x.isZero()) return null;
25713         return { x: x2, y: pt2.y.plus(v3.y.div(v3.x).times(x2.minus(pt2.x))) };
25714       };
25715       intersection = (pt1, v1, pt2, v22) => {
25716         if (v1.x.isZero()) return verticalIntersection(pt2, v22, pt1.x);
25717         if (v22.x.isZero()) return verticalIntersection(pt1, v1, pt2.x);
25718         if (v1.y.isZero()) return horizontalIntersection(pt2, v22, pt1.y);
25719         if (v22.y.isZero()) return horizontalIntersection(pt1, v1, pt2.y);
25720         const kross = crossProduct(v1, v22);
25721         if (kross.isZero()) return null;
25722         const ve3 = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };
25723         const d1 = crossProduct(ve3, v1).div(kross);
25724         const d2 = crossProduct(ve3, v22).div(kross);
25725         const x12 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v22.x));
25726         const y12 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v22.y));
25727         const x3 = x12.plus(x2).div(2);
25728         const y3 = y12.plus(y2).div(2);
25729         return { x: x3, y: y3 };
25730       };
25731       SweepEvent = class _SweepEvent {
25732         // Warning: 'point' input will be modified and re-used (for performance)
25733         constructor(point, isLeft) {
25734           __publicField(this, "point");
25735           __publicField(this, "isLeft");
25736           __publicField(this, "segment");
25737           __publicField(this, "otherSE");
25738           __publicField(this, "consumedBy");
25739           if (point.events === void 0) point.events = [this];
25740           else point.events.push(this);
25741           this.point = point;
25742           this.isLeft = isLeft;
25743         }
25744         // for ordering sweep events in the sweep event queue
25745         static compare(a4, b3) {
25746           const ptCmp = _SweepEvent.comparePoints(a4.point, b3.point);
25747           if (ptCmp !== 0) return ptCmp;
25748           if (a4.point !== b3.point) a4.link(b3);
25749           if (a4.isLeft !== b3.isLeft) return a4.isLeft ? 1 : -1;
25750           return Segment.compare(a4.segment, b3.segment);
25751         }
25752         // for ordering points in sweep line order
25753         static comparePoints(aPt, bPt) {
25754           if (aPt.x.isLessThan(bPt.x)) return -1;
25755           if (aPt.x.isGreaterThan(bPt.x)) return 1;
25756           if (aPt.y.isLessThan(bPt.y)) return -1;
25757           if (aPt.y.isGreaterThan(bPt.y)) return 1;
25758           return 0;
25759         }
25760         link(other) {
25761           if (other.point === this.point) {
25762             throw new Error("Tried to link already linked events");
25763           }
25764           const otherEvents = other.point.events;
25765           for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
25766             const evt = otherEvents[i3];
25767             this.point.events.push(evt);
25768             evt.point = this.point;
25769           }
25770           this.checkForConsuming();
25771         }
25772         /* Do a pass over our linked events and check to see if any pair
25773          * of segments match, and should be consumed. */
25774         checkForConsuming() {
25775           const numEvents = this.point.events.length;
25776           for (let i3 = 0; i3 < numEvents; i3++) {
25777             const evt1 = this.point.events[i3];
25778             if (evt1.segment.consumedBy !== void 0) continue;
25779             for (let j3 = i3 + 1; j3 < numEvents; j3++) {
25780               const evt2 = this.point.events[j3];
25781               if (evt2.consumedBy !== void 0) continue;
25782               if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
25783               evt1.segment.consume(evt2.segment);
25784             }
25785           }
25786         }
25787         getAvailableLinkedEvents() {
25788           const events = [];
25789           for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
25790             const evt = this.point.events[i3];
25791             if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
25792               events.push(evt);
25793             }
25794           }
25795           return events;
25796         }
25797         /**
25798          * Returns a comparator function for sorting linked events that will
25799          * favor the event that will give us the smallest left-side angle.
25800          * All ring construction starts as low as possible heading to the right,
25801          * so by always turning left as sharp as possible we'll get polygons
25802          * without uncessary loops & holes.
25803          *
25804          * The comparator function has a compute cache such that it avoids
25805          * re-computing already-computed values.
25806          */
25807         getLeftmostComparator(baseEvent) {
25808           const cache = /* @__PURE__ */ new Map();
25809           const fillCache = (linkedEvent) => {
25810             const nextEvent = linkedEvent.otherSE;
25811             cache.set(linkedEvent, {
25812               sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
25813               cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
25814             });
25815           };
25816           return (a4, b3) => {
25817             if (!cache.has(a4)) fillCache(a4);
25818             if (!cache.has(b3)) fillCache(b3);
25819             const { sine: asine, cosine: acosine } = cache.get(a4);
25820             const { sine: bsine, cosine: bcosine } = cache.get(b3);
25821             if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {
25822               if (acosine.isLessThan(bcosine)) return 1;
25823               if (acosine.isGreaterThan(bcosine)) return -1;
25824               return 0;
25825             }
25826             if (asine.isLessThan(0) && bsine.isLessThan(0)) {
25827               if (acosine.isLessThan(bcosine)) return -1;
25828               if (acosine.isGreaterThan(bcosine)) return 1;
25829               return 0;
25830             }
25831             if (bsine.isLessThan(asine)) return -1;
25832             if (bsine.isGreaterThan(asine)) return 1;
25833             return 0;
25834           };
25835         }
25836       };
25837       RingOut = class _RingOut {
25838         constructor(events) {
25839           __publicField(this, "events");
25840           __publicField(this, "poly");
25841           __publicField(this, "_isExteriorRing");
25842           __publicField(this, "_enclosingRing");
25843           this.events = events;
25844           for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
25845             events[i3].segment.ringOut = this;
25846           }
25847           this.poly = null;
25848         }
25849         /* Given the segments from the sweep line pass, compute & return a series
25850          * of closed rings from all the segments marked to be part of the result */
25851         static factory(allSegments) {
25852           const ringsOut = [];
25853           for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
25854             const segment = allSegments[i3];
25855             if (!segment.isInResult() || segment.ringOut) continue;
25856             let prevEvent = null;
25857             let event = segment.leftSE;
25858             let nextEvent = segment.rightSE;
25859             const events = [event];
25860             const startingPoint = event.point;
25861             const intersectionLEs = [];
25862             while (true) {
25863               prevEvent = event;
25864               event = nextEvent;
25865               events.push(event);
25866               if (event.point === startingPoint) break;
25867               while (true) {
25868                 const availableLEs = event.getAvailableLinkedEvents();
25869                 if (availableLEs.length === 0) {
25870                   const firstPt = events[0].point;
25871                   const lastPt = events[events.length - 1].point;
25872                   throw new Error(
25873                     `Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`
25874                   );
25875                 }
25876                 if (availableLEs.length === 1) {
25877                   nextEvent = availableLEs[0].otherSE;
25878                   break;
25879                 }
25880                 let indexLE = null;
25881                 for (let j3 = 0, jMax = intersectionLEs.length; j3 < jMax; j3++) {
25882                   if (intersectionLEs[j3].point === event.point) {
25883                     indexLE = j3;
25884                     break;
25885                   }
25886                 }
25887                 if (indexLE !== null) {
25888                   const intersectionLE = intersectionLEs.splice(indexLE)[0];
25889                   const ringEvents = events.splice(intersectionLE.index);
25890                   ringEvents.unshift(ringEvents[0].otherSE);
25891                   ringsOut.push(new _RingOut(ringEvents.reverse()));
25892                   continue;
25893                 }
25894                 intersectionLEs.push({
25895                   index: events.length,
25896                   point: event.point
25897                 });
25898                 const comparator = event.getLeftmostComparator(prevEvent);
25899                 nextEvent = availableLEs.sort(comparator)[0].otherSE;
25900                 break;
25901               }
25902             }
25903             ringsOut.push(new _RingOut(events));
25904           }
25905           return ringsOut;
25906         }
25907         getGeom() {
25908           let prevPt = this.events[0].point;
25909           const points = [prevPt];
25910           for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
25911             const pt22 = this.events[i3].point;
25912             const nextPt2 = this.events[i3 + 1].point;
25913             if (precision.orient(pt22, prevPt, nextPt2) === 0) continue;
25914             points.push(pt22);
25915             prevPt = pt22;
25916           }
25917           if (points.length === 1) return null;
25918           const pt2 = points[0];
25919           const nextPt = points[1];
25920           if (precision.orient(pt2, prevPt, nextPt) === 0) points.shift();
25921           points.push(points[0]);
25922           const step = this.isExteriorRing() ? 1 : -1;
25923           const iStart = this.isExteriorRing() ? 0 : points.length - 1;
25924           const iEnd = this.isExteriorRing() ? points.length : -1;
25925           const orderedPoints = [];
25926           for (let i3 = iStart; i3 != iEnd; i3 += step)
25927             orderedPoints.push([points[i3].x.toNumber(), points[i3].y.toNumber()]);
25928           return orderedPoints;
25929         }
25930         isExteriorRing() {
25931           if (this._isExteriorRing === void 0) {
25932             const enclosing = this.enclosingRing();
25933             this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
25934           }
25935           return this._isExteriorRing;
25936         }
25937         enclosingRing() {
25938           if (this._enclosingRing === void 0) {
25939             this._enclosingRing = this._calcEnclosingRing();
25940           }
25941           return this._enclosingRing;
25942         }
25943         /* Returns the ring that encloses this one, if any */
25944         _calcEnclosingRing() {
25945           var _a4, _b2;
25946           let leftMostEvt = this.events[0];
25947           for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
25948             const evt = this.events[i3];
25949             if (SweepEvent.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
25950           }
25951           let prevSeg = leftMostEvt.segment.prevInResult();
25952           let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
25953           while (true) {
25954             if (!prevSeg) return null;
25955             if (!prevPrevSeg) return prevSeg.ringOut;
25956             if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
25957               if (((_a4 = prevPrevSeg.ringOut) == null ? void 0 : _a4.enclosingRing()) !== prevSeg.ringOut) {
25958                 return prevSeg.ringOut;
25959               } else return (_b2 = prevSeg.ringOut) == null ? void 0 : _b2.enclosingRing();
25960             }
25961             prevSeg = prevPrevSeg.prevInResult();
25962             prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
25963           }
25964         }
25965       };
25966       PolyOut = class {
25967         constructor(exteriorRing) {
25968           __publicField(this, "exteriorRing");
25969           __publicField(this, "interiorRings");
25970           this.exteriorRing = exteriorRing;
25971           exteriorRing.poly = this;
25972           this.interiorRings = [];
25973         }
25974         addInterior(ring) {
25975           this.interiorRings.push(ring);
25976           ring.poly = this;
25977         }
25978         getGeom() {
25979           const geom0 = this.exteriorRing.getGeom();
25980           if (geom0 === null) return null;
25981           const geom = [geom0];
25982           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
25983             const ringGeom = this.interiorRings[i3].getGeom();
25984             if (ringGeom === null) continue;
25985             geom.push(ringGeom);
25986           }
25987           return geom;
25988         }
25989       };
25990       MultiPolyOut = class {
25991         constructor(rings) {
25992           __publicField(this, "rings");
25993           __publicField(this, "polys");
25994           this.rings = rings;
25995           this.polys = this._composePolys(rings);
25996         }
25997         getGeom() {
25998           const geom = [];
25999           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
26000             const polyGeom = this.polys[i3].getGeom();
26001             if (polyGeom === null) continue;
26002             geom.push(polyGeom);
26003           }
26004           return geom;
26005         }
26006         _composePolys(rings) {
26007           var _a4;
26008           const polys = [];
26009           for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
26010             const ring = rings[i3];
26011             if (ring.poly) continue;
26012             if (ring.isExteriorRing()) polys.push(new PolyOut(ring));
26013             else {
26014               const enclosingRing = ring.enclosingRing();
26015               if (!(enclosingRing == null ? void 0 : enclosingRing.poly)) polys.push(new PolyOut(enclosingRing));
26016               (_a4 = enclosingRing == null ? void 0 : enclosingRing.poly) == null ? void 0 : _a4.addInterior(ring);
26017             }
26018           }
26019           return polys;
26020         }
26021       };
26022       SweepLine = class {
26023         constructor(queue, comparator = Segment.compare) {
26024           __publicField(this, "queue");
26025           __publicField(this, "tree");
26026           __publicField(this, "segments");
26027           this.queue = queue;
26028           this.tree = new SplayTreeSet(comparator);
26029           this.segments = [];
26030         }
26031         process(event) {
26032           const segment = event.segment;
26033           const newEvents = [];
26034           if (event.consumedBy) {
26035             if (event.isLeft) this.queue.delete(event.otherSE);
26036             else this.tree.delete(segment);
26037             return newEvents;
26038           }
26039           if (event.isLeft) this.tree.add(segment);
26040           let prevSeg = segment;
26041           let nextSeg = segment;
26042           do {
26043             prevSeg = this.tree.lastBefore(prevSeg);
26044           } while (prevSeg != null && prevSeg.consumedBy != void 0);
26045           do {
26046             nextSeg = this.tree.firstAfter(nextSeg);
26047           } while (nextSeg != null && nextSeg.consumedBy != void 0);
26048           if (event.isLeft) {
26049             let prevMySplitter = null;
26050             if (prevSeg) {
26051               const prevInter = prevSeg.getIntersection(segment);
26052               if (prevInter !== null) {
26053                 if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
26054                 if (!prevSeg.isAnEndpoint(prevInter)) {
26055                   const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
26056                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26057                     newEvents.push(newEventsFromSplit[i3]);
26058                   }
26059                 }
26060               }
26061             }
26062             let nextMySplitter = null;
26063             if (nextSeg) {
26064               const nextInter = nextSeg.getIntersection(segment);
26065               if (nextInter !== null) {
26066                 if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
26067                 if (!nextSeg.isAnEndpoint(nextInter)) {
26068                   const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
26069                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26070                     newEvents.push(newEventsFromSplit[i3]);
26071                   }
26072                 }
26073               }
26074             }
26075             if (prevMySplitter !== null || nextMySplitter !== null) {
26076               let mySplitter = null;
26077               if (prevMySplitter === null) mySplitter = nextMySplitter;
26078               else if (nextMySplitter === null) mySplitter = prevMySplitter;
26079               else {
26080                 const cmpSplitters = SweepEvent.comparePoints(
26081                   prevMySplitter,
26082                   nextMySplitter
26083                 );
26084                 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
26085               }
26086               this.queue.delete(segment.rightSE);
26087               newEvents.push(segment.rightSE);
26088               const newEventsFromSplit = segment.split(mySplitter);
26089               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26090                 newEvents.push(newEventsFromSplit[i3]);
26091               }
26092             }
26093             if (newEvents.length > 0) {
26094               this.tree.delete(segment);
26095               newEvents.push(event);
26096             } else {
26097               this.segments.push(segment);
26098               segment.prev = prevSeg;
26099             }
26100           } else {
26101             if (prevSeg && nextSeg) {
26102               const inter = prevSeg.getIntersection(nextSeg);
26103               if (inter !== null) {
26104                 if (!prevSeg.isAnEndpoint(inter)) {
26105                   const newEventsFromSplit = this._splitSafely(prevSeg, inter);
26106                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26107                     newEvents.push(newEventsFromSplit[i3]);
26108                   }
26109                 }
26110                 if (!nextSeg.isAnEndpoint(inter)) {
26111                   const newEventsFromSplit = this._splitSafely(nextSeg, inter);
26112                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26113                     newEvents.push(newEventsFromSplit[i3]);
26114                   }
26115                 }
26116               }
26117             }
26118             this.tree.delete(segment);
26119           }
26120           return newEvents;
26121         }
26122         /* Safely split a segment that is currently in the datastructures
26123          * IE - a segment other than the one that is currently being processed. */
26124         _splitSafely(seg, pt2) {
26125           this.tree.delete(seg);
26126           const rightSE = seg.rightSE;
26127           this.queue.delete(rightSE);
26128           const newEvents = seg.split(pt2);
26129           newEvents.push(rightSE);
26130           if (seg.consumedBy === void 0) this.tree.add(seg);
26131           return newEvents;
26132         }
26133       };
26134       Operation = class {
26135         constructor() {
26136           __publicField(this, "type");
26137           __publicField(this, "numMultiPolys");
26138         }
26139         run(type2, geom, moreGeoms) {
26140           operation.type = type2;
26141           const multipolys = [new MultiPolyIn(geom, true)];
26142           for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
26143             multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
26144           }
26145           operation.numMultiPolys = multipolys.length;
26146           if (operation.type === "difference") {
26147             const subject = multipolys[0];
26148             let i3 = 1;
26149             while (i3 < multipolys.length) {
26150               if (getBboxOverlap(multipolys[i3].bbox, subject.bbox) !== null) i3++;
26151               else multipolys.splice(i3, 1);
26152             }
26153           }
26154           if (operation.type === "intersection") {
26155             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
26156               const mpA = multipolys[i3];
26157               for (let j3 = i3 + 1, jMax = multipolys.length; j3 < jMax; j3++) {
26158                 if (getBboxOverlap(mpA.bbox, multipolys[j3].bbox) === null) return [];
26159               }
26160             }
26161           }
26162           const queue = new SplayTreeSet(SweepEvent.compare);
26163           for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
26164             const sweepEvents = multipolys[i3].getSweepEvents();
26165             for (let j3 = 0, jMax = sweepEvents.length; j3 < jMax; j3++) {
26166               queue.add(sweepEvents[j3]);
26167             }
26168           }
26169           const sweepLine = new SweepLine(queue);
26170           let evt = null;
26171           if (queue.size != 0) {
26172             evt = queue.first();
26173             queue.delete(evt);
26174           }
26175           while (evt) {
26176             const newEvents = sweepLine.process(evt);
26177             for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
26178               const evt2 = newEvents[i3];
26179               if (evt2.consumedBy === void 0) queue.add(evt2);
26180             }
26181             if (queue.size != 0) {
26182               evt = queue.first();
26183               queue.delete(evt);
26184             } else {
26185               evt = null;
26186             }
26187           }
26188           precision.reset();
26189           const ringsOut = RingOut.factory(sweepLine.segments);
26190           const result = new MultiPolyOut(ringsOut);
26191           return result.getGeom();
26192         }
26193       };
26194       operation = new Operation();
26195       operation_default = operation;
26196       segmentId = 0;
26197       Segment = class _Segment {
26198         /* Warning: a reference to ringWindings input will be stored,
26199          *  and possibly will be later modified */
26200         constructor(leftSE, rightSE, rings, windings) {
26201           __publicField(this, "id");
26202           __publicField(this, "leftSE");
26203           __publicField(this, "rightSE");
26204           __publicField(this, "rings");
26205           __publicField(this, "windings");
26206           __publicField(this, "ringOut");
26207           __publicField(this, "consumedBy");
26208           __publicField(this, "prev");
26209           __publicField(this, "_prevInResult");
26210           __publicField(this, "_beforeState");
26211           __publicField(this, "_afterState");
26212           __publicField(this, "_isInResult");
26213           this.id = ++segmentId;
26214           this.leftSE = leftSE;
26215           leftSE.segment = this;
26216           leftSE.otherSE = rightSE;
26217           this.rightSE = rightSE;
26218           rightSE.segment = this;
26219           rightSE.otherSE = leftSE;
26220           this.rings = rings;
26221           this.windings = windings;
26222         }
26223         /* This compare() function is for ordering segments in the sweep
26224          * line tree, and does so according to the following criteria:
26225          *
26226          * Consider the vertical line that lies an infinestimal step to the
26227          * right of the right-more of the two left endpoints of the input
26228          * segments. Imagine slowly moving a point up from negative infinity
26229          * in the increasing y direction. Which of the two segments will that
26230          * point intersect first? That segment comes 'before' the other one.
26231          *
26232          * If neither segment would be intersected by such a line, (if one
26233          * or more of the segments are vertical) then the line to be considered
26234          * is directly on the right-more of the two left inputs.
26235          */
26236         static compare(a4, b3) {
26237           const alx = a4.leftSE.point.x;
26238           const blx = b3.leftSE.point.x;
26239           const arx = a4.rightSE.point.x;
26240           const brx = b3.rightSE.point.x;
26241           if (brx.isLessThan(alx)) return 1;
26242           if (arx.isLessThan(blx)) return -1;
26243           const aly = a4.leftSE.point.y;
26244           const bly = b3.leftSE.point.y;
26245           const ary = a4.rightSE.point.y;
26246           const bry = b3.rightSE.point.y;
26247           if (alx.isLessThan(blx)) {
26248             if (bly.isLessThan(aly) && bly.isLessThan(ary)) return 1;
26249             if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary)) return -1;
26250             const aCmpBLeft = a4.comparePoint(b3.leftSE.point);
26251             if (aCmpBLeft < 0) return 1;
26252             if (aCmpBLeft > 0) return -1;
26253             const bCmpARight = b3.comparePoint(a4.rightSE.point);
26254             if (bCmpARight !== 0) return bCmpARight;
26255             return -1;
26256           }
26257           if (alx.isGreaterThan(blx)) {
26258             if (aly.isLessThan(bly) && aly.isLessThan(bry)) return -1;
26259             if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry)) return 1;
26260             const bCmpALeft = b3.comparePoint(a4.leftSE.point);
26261             if (bCmpALeft !== 0) return bCmpALeft;
26262             const aCmpBRight = a4.comparePoint(b3.rightSE.point);
26263             if (aCmpBRight < 0) return 1;
26264             if (aCmpBRight > 0) return -1;
26265             return 1;
26266           }
26267           if (aly.isLessThan(bly)) return -1;
26268           if (aly.isGreaterThan(bly)) return 1;
26269           if (arx.isLessThan(brx)) {
26270             const bCmpARight = b3.comparePoint(a4.rightSE.point);
26271             if (bCmpARight !== 0) return bCmpARight;
26272           }
26273           if (arx.isGreaterThan(brx)) {
26274             const aCmpBRight = a4.comparePoint(b3.rightSE.point);
26275             if (aCmpBRight < 0) return 1;
26276             if (aCmpBRight > 0) return -1;
26277           }
26278           if (!arx.eq(brx)) {
26279             const ay = ary.minus(aly);
26280             const ax = arx.minus(alx);
26281             const by = bry.minus(bly);
26282             const bx = brx.minus(blx);
26283             if (ay.isGreaterThan(ax) && by.isLessThan(bx)) return 1;
26284             if (ay.isLessThan(ax) && by.isGreaterThan(bx)) return -1;
26285           }
26286           if (arx.isGreaterThan(brx)) return 1;
26287           if (arx.isLessThan(brx)) return -1;
26288           if (ary.isLessThan(bry)) return -1;
26289           if (ary.isGreaterThan(bry)) return 1;
26290           if (a4.id < b3.id) return -1;
26291           if (a4.id > b3.id) return 1;
26292           return 0;
26293         }
26294         static fromRing(pt1, pt2, ring) {
26295           let leftPt, rightPt, winding;
26296           const cmpPts = SweepEvent.comparePoints(pt1, pt2);
26297           if (cmpPts < 0) {
26298             leftPt = pt1;
26299             rightPt = pt2;
26300             winding = 1;
26301           } else if (cmpPts > 0) {
26302             leftPt = pt2;
26303             rightPt = pt1;
26304             winding = -1;
26305           } else
26306             throw new Error(
26307               `Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`
26308             );
26309           const leftSE = new SweepEvent(leftPt, true);
26310           const rightSE = new SweepEvent(rightPt, false);
26311           return new _Segment(leftSE, rightSE, [ring], [winding]);
26312         }
26313         /* When a segment is split, the rightSE is replaced with a new sweep event */
26314         replaceRightSE(newRightSE) {
26315           this.rightSE = newRightSE;
26316           this.rightSE.segment = this;
26317           this.rightSE.otherSE = this.leftSE;
26318           this.leftSE.otherSE = this.rightSE;
26319         }
26320         bbox() {
26321           const y12 = this.leftSE.point.y;
26322           const y2 = this.rightSE.point.y;
26323           return {
26324             ll: { x: this.leftSE.point.x, y: y12.isLessThan(y2) ? y12 : y2 },
26325             ur: { x: this.rightSE.point.x, y: y12.isGreaterThan(y2) ? y12 : y2 }
26326           };
26327         }
26328         /* A vector from the left point to the right */
26329         vector() {
26330           return {
26331             x: this.rightSE.point.x.minus(this.leftSE.point.x),
26332             y: this.rightSE.point.y.minus(this.leftSE.point.y)
26333           };
26334         }
26335         isAnEndpoint(pt2) {
26336           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);
26337         }
26338         /* Compare this segment with a point.
26339          *
26340          * A point P is considered to be colinear to a segment if there
26341          * exists a distance D such that if we travel along the segment
26342          * from one * endpoint towards the other a distance D, we find
26343          * ourselves at point P.
26344          *
26345          * Return value indicates:
26346          *
26347          *   1: point lies above the segment (to the left of vertical)
26348          *   0: point is colinear to segment
26349          *  -1: point lies below the segment (to the right of vertical)
26350          */
26351         comparePoint(point) {
26352           return precision.orient(this.leftSE.point, point, this.rightSE.point);
26353         }
26354         /**
26355          * Given another segment, returns the first non-trivial intersection
26356          * between the two segments (in terms of sweep line ordering), if it exists.
26357          *
26358          * A 'non-trivial' intersection is one that will cause one or both of the
26359          * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
26360          *
26361          *   * endpoint of segA with endpoint of segB --> trivial
26362          *   * endpoint of segA with point along segB --> non-trivial
26363          *   * endpoint of segB with point along segA --> non-trivial
26364          *   * point along segA with point along segB --> non-trivial
26365          *
26366          * If no non-trivial intersection exists, return null
26367          * Else, return null.
26368          */
26369         getIntersection(other) {
26370           const tBbox = this.bbox();
26371           const oBbox = other.bbox();
26372           const bboxOverlap = getBboxOverlap(tBbox, oBbox);
26373           if (bboxOverlap === null) return null;
26374           const tlp = this.leftSE.point;
26375           const trp = this.rightSE.point;
26376           const olp = other.leftSE.point;
26377           const orp = other.rightSE.point;
26378           const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
26379           const touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
26380           const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
26381           const touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
26382           if (touchesThisLSE && touchesOtherLSE) {
26383             if (touchesThisRSE && !touchesOtherRSE) return trp;
26384             if (!touchesThisRSE && touchesOtherRSE) return orp;
26385             return null;
26386           }
26387           if (touchesThisLSE) {
26388             if (touchesOtherRSE) {
26389               if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y)) return null;
26390             }
26391             return tlp;
26392           }
26393           if (touchesOtherLSE) {
26394             if (touchesThisRSE) {
26395               if (trp.x.eq(olp.x) && trp.y.eq(olp.y)) return null;
26396             }
26397             return olp;
26398           }
26399           if (touchesThisRSE && touchesOtherRSE) return null;
26400           if (touchesThisRSE) return trp;
26401           if (touchesOtherRSE) return orp;
26402           const pt2 = intersection(tlp, this.vector(), olp, other.vector());
26403           if (pt2 === null) return null;
26404           if (!isInBbox(bboxOverlap, pt2)) return null;
26405           return precision.snap(pt2);
26406         }
26407         /**
26408          * Split the given segment into multiple segments on the given points.
26409          *  * Each existing segment will retain its leftSE and a new rightSE will be
26410          *    generated for it.
26411          *  * A new segment will be generated which will adopt the original segment's
26412          *    rightSE, and a new leftSE will be generated for it.
26413          *  * If there are more than two points given to split on, new segments
26414          *    in the middle will be generated with new leftSE and rightSE's.
26415          *  * An array of the newly generated SweepEvents will be returned.
26416          *
26417          * Warning: input array of points is modified
26418          */
26419         split(point) {
26420           const newEvents = [];
26421           const alreadyLinked = point.events !== void 0;
26422           const newLeftSE = new SweepEvent(point, true);
26423           const newRightSE = new SweepEvent(point, false);
26424           const oldRightSE = this.rightSE;
26425           this.replaceRightSE(newRightSE);
26426           newEvents.push(newRightSE);
26427           newEvents.push(newLeftSE);
26428           const newSeg = new _Segment(
26429             newLeftSE,
26430             oldRightSE,
26431             this.rings.slice(),
26432             this.windings.slice()
26433           );
26434           if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
26435             newSeg.swapEvents();
26436           }
26437           if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
26438             this.swapEvents();
26439           }
26440           if (alreadyLinked) {
26441             newLeftSE.checkForConsuming();
26442             newRightSE.checkForConsuming();
26443           }
26444           return newEvents;
26445         }
26446         /* Swap which event is left and right */
26447         swapEvents() {
26448           const tmpEvt = this.rightSE;
26449           this.rightSE = this.leftSE;
26450           this.leftSE = tmpEvt;
26451           this.leftSE.isLeft = true;
26452           this.rightSE.isLeft = false;
26453           for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
26454             this.windings[i3] *= -1;
26455           }
26456         }
26457         /* Consume another segment. We take their rings under our wing
26458          * and mark them as consumed. Use for perfectly overlapping segments */
26459         consume(other) {
26460           let consumer = this;
26461           let consumee = other;
26462           while (consumer.consumedBy) consumer = consumer.consumedBy;
26463           while (consumee.consumedBy) consumee = consumee.consumedBy;
26464           const cmp = _Segment.compare(consumer, consumee);
26465           if (cmp === 0) return;
26466           if (cmp > 0) {
26467             const tmp = consumer;
26468             consumer = consumee;
26469             consumee = tmp;
26470           }
26471           if (consumer.prev === consumee) {
26472             const tmp = consumer;
26473             consumer = consumee;
26474             consumee = tmp;
26475           }
26476           for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
26477             const ring = consumee.rings[i3];
26478             const winding = consumee.windings[i3];
26479             const index = consumer.rings.indexOf(ring);
26480             if (index === -1) {
26481               consumer.rings.push(ring);
26482               consumer.windings.push(winding);
26483             } else consumer.windings[index] += winding;
26484           }
26485           consumee.rings = null;
26486           consumee.windings = null;
26487           consumee.consumedBy = consumer;
26488           consumee.leftSE.consumedBy = consumer.leftSE;
26489           consumee.rightSE.consumedBy = consumer.rightSE;
26490         }
26491         /* The first segment previous segment chain that is in the result */
26492         prevInResult() {
26493           if (this._prevInResult !== void 0) return this._prevInResult;
26494           if (!this.prev) this._prevInResult = null;
26495           else if (this.prev.isInResult()) this._prevInResult = this.prev;
26496           else this._prevInResult = this.prev.prevInResult();
26497           return this._prevInResult;
26498         }
26499         beforeState() {
26500           if (this._beforeState !== void 0) return this._beforeState;
26501           if (!this.prev)
26502             this._beforeState = {
26503               rings: [],
26504               windings: [],
26505               multiPolys: []
26506             };
26507           else {
26508             const seg = this.prev.consumedBy || this.prev;
26509             this._beforeState = seg.afterState();
26510           }
26511           return this._beforeState;
26512         }
26513         afterState() {
26514           if (this._afterState !== void 0) return this._afterState;
26515           const beforeState = this.beforeState();
26516           this._afterState = {
26517             rings: beforeState.rings.slice(0),
26518             windings: beforeState.windings.slice(0),
26519             multiPolys: []
26520           };
26521           const ringsAfter = this._afterState.rings;
26522           const windingsAfter = this._afterState.windings;
26523           const mpsAfter = this._afterState.multiPolys;
26524           for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
26525             const ring = this.rings[i3];
26526             const winding = this.windings[i3];
26527             const index = ringsAfter.indexOf(ring);
26528             if (index === -1) {
26529               ringsAfter.push(ring);
26530               windingsAfter.push(winding);
26531             } else windingsAfter[index] += winding;
26532           }
26533           const polysAfter = [];
26534           const polysExclude = [];
26535           for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
26536             if (windingsAfter[i3] === 0) continue;
26537             const ring = ringsAfter[i3];
26538             const poly = ring.poly;
26539             if (polysExclude.indexOf(poly) !== -1) continue;
26540             if (ring.isExterior) polysAfter.push(poly);
26541             else {
26542               if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
26543               const index = polysAfter.indexOf(ring.poly);
26544               if (index !== -1) polysAfter.splice(index, 1);
26545             }
26546           }
26547           for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
26548             const mp = polysAfter[i3].multiPoly;
26549             if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
26550           }
26551           return this._afterState;
26552         }
26553         /* Is this segment part of the final result? */
26554         isInResult() {
26555           if (this.consumedBy) return false;
26556           if (this._isInResult !== void 0) return this._isInResult;
26557           const mpsBefore = this.beforeState().multiPolys;
26558           const mpsAfter = this.afterState().multiPolys;
26559           switch (operation_default.type) {
26560             case "union": {
26561               const noBefores = mpsBefore.length === 0;
26562               const noAfters = mpsAfter.length === 0;
26563               this._isInResult = noBefores !== noAfters;
26564               break;
26565             }
26566             case "intersection": {
26567               let least;
26568               let most;
26569               if (mpsBefore.length < mpsAfter.length) {
26570                 least = mpsBefore.length;
26571                 most = mpsAfter.length;
26572               } else {
26573                 least = mpsAfter.length;
26574                 most = mpsBefore.length;
26575               }
26576               this._isInResult = most === operation_default.numMultiPolys && least < most;
26577               break;
26578             }
26579             case "xor": {
26580               const diff = Math.abs(mpsBefore.length - mpsAfter.length);
26581               this._isInResult = diff % 2 === 1;
26582               break;
26583             }
26584             case "difference": {
26585               const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
26586               this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
26587               break;
26588             }
26589           }
26590           return this._isInResult;
26591         }
26592       };
26593       RingIn = class {
26594         constructor(geomRing, poly, isExterior) {
26595           __publicField(this, "poly");
26596           __publicField(this, "isExterior");
26597           __publicField(this, "segments");
26598           __publicField(this, "bbox");
26599           if (!Array.isArray(geomRing) || geomRing.length === 0) {
26600             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26601           }
26602           this.poly = poly;
26603           this.isExterior = isExterior;
26604           this.segments = [];
26605           if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
26606             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26607           }
26608           const firstPoint = precision.snap({ x: new bignumber_default(geomRing[0][0]), y: new bignumber_default(geomRing[0][1]) });
26609           this.bbox = {
26610             ll: { x: firstPoint.x, y: firstPoint.y },
26611             ur: { x: firstPoint.x, y: firstPoint.y }
26612           };
26613           let prevPoint = firstPoint;
26614           for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
26615             if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
26616               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26617             }
26618             const point = precision.snap({ x: new bignumber_default(geomRing[i3][0]), y: new bignumber_default(geomRing[i3][1]) });
26619             if (point.x.eq(prevPoint.x) && point.y.eq(prevPoint.y)) continue;
26620             this.segments.push(Segment.fromRing(prevPoint, point, this));
26621             if (point.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = point.x;
26622             if (point.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = point.y;
26623             if (point.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = point.x;
26624             if (point.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = point.y;
26625             prevPoint = point;
26626           }
26627           if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {
26628             this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
26629           }
26630         }
26631         getSweepEvents() {
26632           const sweepEvents = [];
26633           for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
26634             const segment = this.segments[i3];
26635             sweepEvents.push(segment.leftSE);
26636             sweepEvents.push(segment.rightSE);
26637           }
26638           return sweepEvents;
26639         }
26640       };
26641       PolyIn = class {
26642         constructor(geomPoly, multiPoly) {
26643           __publicField(this, "multiPoly");
26644           __publicField(this, "exteriorRing");
26645           __publicField(this, "interiorRings");
26646           __publicField(this, "bbox");
26647           if (!Array.isArray(geomPoly)) {
26648             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26649           }
26650           this.exteriorRing = new RingIn(geomPoly[0], this, true);
26651           this.bbox = {
26652             ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
26653             ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
26654           };
26655           this.interiorRings = [];
26656           for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
26657             const ring = new RingIn(geomPoly[i3], this, false);
26658             if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = ring.bbox.ll.x;
26659             if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = ring.bbox.ll.y;
26660             if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = ring.bbox.ur.x;
26661             if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = ring.bbox.ur.y;
26662             this.interiorRings.push(ring);
26663           }
26664           this.multiPoly = multiPoly;
26665         }
26666         getSweepEvents() {
26667           const sweepEvents = this.exteriorRing.getSweepEvents();
26668           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
26669             const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
26670             for (let j3 = 0, jMax = ringSweepEvents.length; j3 < jMax; j3++) {
26671               sweepEvents.push(ringSweepEvents[j3]);
26672             }
26673           }
26674           return sweepEvents;
26675         }
26676       };
26677       MultiPolyIn = class {
26678         constructor(geom, isSubject) {
26679           __publicField(this, "isSubject");
26680           __publicField(this, "polys");
26681           __publicField(this, "bbox");
26682           if (!Array.isArray(geom)) {
26683             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26684           }
26685           try {
26686             if (typeof geom[0][0][0] === "number") geom = [geom];
26687           } catch (ex) {
26688           }
26689           this.polys = [];
26690           this.bbox = {
26691             ll: { x: new bignumber_default(Number.POSITIVE_INFINITY), y: new bignumber_default(Number.POSITIVE_INFINITY) },
26692             ur: { x: new bignumber_default(Number.NEGATIVE_INFINITY), y: new bignumber_default(Number.NEGATIVE_INFINITY) }
26693           };
26694           for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
26695             const poly = new PolyIn(geom[i3], this);
26696             if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = poly.bbox.ll.x;
26697             if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = poly.bbox.ll.y;
26698             if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = poly.bbox.ur.x;
26699             if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = poly.bbox.ur.y;
26700             this.polys.push(poly);
26701           }
26702           this.isSubject = isSubject;
26703         }
26704         getSweepEvents() {
26705           const sweepEvents = [];
26706           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
26707             const polySweepEvents = this.polys[i3].getSweepEvents();
26708             for (let j3 = 0, jMax = polySweepEvents.length; j3 < jMax; j3++) {
26709               sweepEvents.push(polySweepEvents[j3]);
26710             }
26711           }
26712           return sweepEvents;
26713         }
26714       };
26715       union = (geom, ...moreGeoms) => operation_default.run("union", geom, moreGeoms);
26716       difference = (geom, ...moreGeoms) => operation_default.run("difference", geom, moreGeoms);
26717       setPrecision = precision.set;
26718     }
26719   });
26720
26721   // node_modules/wgs84/index.js
26722   var require_wgs84 = __commonJS({
26723     "node_modules/wgs84/index.js"(exports2, module2) {
26724       module2.exports.RADIUS = 6378137;
26725       module2.exports.FLATTENING = 1 / 298.257223563;
26726       module2.exports.POLAR_RADIUS = 63567523142e-4;
26727     }
26728   });
26729
26730   // node_modules/@mapbox/geojson-area/index.js
26731   var require_geojson_area = __commonJS({
26732     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
26733       var wgs84 = require_wgs84();
26734       module2.exports.geometry = geometry;
26735       module2.exports.ring = ringArea;
26736       function geometry(_3) {
26737         var area = 0, i3;
26738         switch (_3.type) {
26739           case "Polygon":
26740             return polygonArea(_3.coordinates);
26741           case "MultiPolygon":
26742             for (i3 = 0; i3 < _3.coordinates.length; i3++) {
26743               area += polygonArea(_3.coordinates[i3]);
26744             }
26745             return area;
26746           case "Point":
26747           case "MultiPoint":
26748           case "LineString":
26749           case "MultiLineString":
26750             return 0;
26751           case "GeometryCollection":
26752             for (i3 = 0; i3 < _3.geometries.length; i3++) {
26753               area += geometry(_3.geometries[i3]);
26754             }
26755             return area;
26756         }
26757       }
26758       function polygonArea(coords) {
26759         var area = 0;
26760         if (coords && coords.length > 0) {
26761           area += Math.abs(ringArea(coords[0]));
26762           for (var i3 = 1; i3 < coords.length; i3++) {
26763             area -= Math.abs(ringArea(coords[i3]));
26764           }
26765         }
26766         return area;
26767       }
26768       function ringArea(coords) {
26769         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
26770         if (coordsLength > 2) {
26771           for (i3 = 0; i3 < coordsLength; i3++) {
26772             if (i3 === coordsLength - 2) {
26773               lowerIndex = coordsLength - 2;
26774               middleIndex = coordsLength - 1;
26775               upperIndex = 0;
26776             } else if (i3 === coordsLength - 1) {
26777               lowerIndex = coordsLength - 1;
26778               middleIndex = 0;
26779               upperIndex = 1;
26780             } else {
26781               lowerIndex = i3;
26782               middleIndex = i3 + 1;
26783               upperIndex = i3 + 2;
26784             }
26785             p1 = coords[lowerIndex];
26786             p2 = coords[middleIndex];
26787             p3 = coords[upperIndex];
26788             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
26789           }
26790           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
26791         }
26792         return area;
26793       }
26794       function rad(_3) {
26795         return _3 * Math.PI / 180;
26796       }
26797     }
26798   });
26799
26800   // node_modules/circle-to-polygon/input-validation/validateCenter.js
26801   var require_validateCenter = __commonJS({
26802     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
26803       exports2.validateCenter = function validateCenter(center) {
26804         var validCenterLengths = [2, 3];
26805         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
26806           throw new Error("ERROR! Center has to be an array of length two or three");
26807         }
26808         var [lng, lat] = center;
26809         if (typeof lng !== "number" || typeof lat !== "number") {
26810           throw new Error(
26811             `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
26812           );
26813         }
26814         if (lng > 180 || lng < -180) {
26815           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
26816         }
26817         if (lat > 90 || lat < -90) {
26818           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
26819         }
26820       };
26821     }
26822   });
26823
26824   // node_modules/circle-to-polygon/input-validation/validateRadius.js
26825   var require_validateRadius = __commonJS({
26826     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
26827       exports2.validateRadius = function validateRadius(radius) {
26828         if (typeof radius !== "number") {
26829           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
26830         }
26831         if (radius <= 0) {
26832           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
26833         }
26834       };
26835     }
26836   });
26837
26838   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
26839   var require_validateNumberOfEdges = __commonJS({
26840     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
26841       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
26842         if (typeof numberOfEdges !== "number") {
26843           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
26844           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
26845         }
26846         if (numberOfEdges < 3) {
26847           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
26848         }
26849       };
26850     }
26851   });
26852
26853   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
26854   var require_validateEarthRadius = __commonJS({
26855     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
26856       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
26857         if (typeof earthRadius2 !== "number") {
26858           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
26859           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
26860         }
26861         if (earthRadius2 <= 0) {
26862           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
26863         }
26864       };
26865     }
26866   });
26867
26868   // node_modules/circle-to-polygon/input-validation/validateBearing.js
26869   var require_validateBearing = __commonJS({
26870     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
26871       exports2.validateBearing = function validateBearing(bearing) {
26872         if (typeof bearing !== "number") {
26873           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
26874           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
26875         }
26876       };
26877     }
26878   });
26879
26880   // node_modules/circle-to-polygon/input-validation/index.js
26881   var require_input_validation = __commonJS({
26882     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
26883       var validateCenter = require_validateCenter().validateCenter;
26884       var validateRadius = require_validateRadius().validateRadius;
26885       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
26886       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
26887       var validateBearing = require_validateBearing().validateBearing;
26888       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
26889         validateCenter(center);
26890         validateRadius(radius);
26891         validateNumberOfEdges(numberOfEdges);
26892         validateEarthRadius(earthRadius2);
26893         validateBearing(bearing);
26894       }
26895       exports2.validateCenter = validateCenter;
26896       exports2.validateRadius = validateRadius;
26897       exports2.validateNumberOfEdges = validateNumberOfEdges;
26898       exports2.validateEarthRadius = validateEarthRadius;
26899       exports2.validateBearing = validateBearing;
26900       exports2.validateInput = validateInput;
26901     }
26902   });
26903
26904   // node_modules/circle-to-polygon/index.js
26905   var require_circle_to_polygon = __commonJS({
26906     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
26907       "use strict";
26908       var { validateInput } = require_input_validation();
26909       var defaultEarthRadius = 6378137;
26910       function toRadians(angleInDegrees) {
26911         return angleInDegrees * Math.PI / 180;
26912       }
26913       function toDegrees(angleInRadians) {
26914         return angleInRadians * 180 / Math.PI;
26915       }
26916       function offset(c1, distance, earthRadius2, bearing) {
26917         var lat1 = toRadians(c1[1]);
26918         var lon1 = toRadians(c1[0]);
26919         var dByR = distance / earthRadius2;
26920         var lat = Math.asin(
26921           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
26922         );
26923         var lon = lon1 + Math.atan2(
26924           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
26925           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
26926         );
26927         return [toDegrees(lon), toDegrees(lat)];
26928       }
26929       module2.exports = function circleToPolygon2(center, radius, options) {
26930         var n3 = getNumberOfEdges(options);
26931         var earthRadius2 = getEarthRadius(options);
26932         var bearing = getBearing(options);
26933         var direction = getDirection(options);
26934         validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
26935         var start2 = toRadians(bearing);
26936         var coordinates = [];
26937         for (var i3 = 0; i3 < n3; ++i3) {
26938           coordinates.push(
26939             offset(
26940               center,
26941               radius,
26942               earthRadius2,
26943               start2 + direction * 2 * Math.PI * -i3 / n3
26944             )
26945           );
26946         }
26947         coordinates.push(coordinates[0]);
26948         return {
26949           type: "Polygon",
26950           coordinates: [coordinates]
26951         };
26952       };
26953       function getNumberOfEdges(options) {
26954         if (isUndefinedOrNull(options)) {
26955           return 32;
26956         } else if (isObjectNotArray(options)) {
26957           var numberOfEdges = options.numberOfEdges;
26958           return numberOfEdges === void 0 ? 32 : numberOfEdges;
26959         }
26960         return options;
26961       }
26962       function getEarthRadius(options) {
26963         if (isUndefinedOrNull(options)) {
26964           return defaultEarthRadius;
26965         } else if (isObjectNotArray(options)) {
26966           var earthRadius2 = options.earthRadius;
26967           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
26968         }
26969         return defaultEarthRadius;
26970       }
26971       function getDirection(options) {
26972         if (isObjectNotArray(options) && options.rightHandRule) {
26973           return -1;
26974         }
26975         return 1;
26976       }
26977       function getBearing(options) {
26978         if (isUndefinedOrNull(options)) {
26979           return 0;
26980         } else if (isObjectNotArray(options)) {
26981           var bearing = options.bearing;
26982           return bearing === void 0 ? 0 : bearing;
26983         }
26984         return 0;
26985       }
26986       function isObjectNotArray(argument) {
26987         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
26988       }
26989       function isUndefinedOrNull(argument) {
26990         return argument === null || argument === void 0;
26991       }
26992     }
26993   });
26994
26995   // node_modules/geojson-precision/index.js
26996   var require_geojson_precision = __commonJS({
26997     "node_modules/geojson-precision/index.js"(exports2, module2) {
26998       (function() {
26999         function parse(t2, coordinatePrecision, extrasPrecision) {
27000           function point(p2) {
27001             return p2.map(function(e3, index) {
27002               if (index < 2) {
27003                 return 1 * e3.toFixed(coordinatePrecision);
27004               } else {
27005                 return 1 * e3.toFixed(extrasPrecision);
27006               }
27007             });
27008           }
27009           function multi(l2) {
27010             return l2.map(point);
27011           }
27012           function poly(p2) {
27013             return p2.map(multi);
27014           }
27015           function multiPoly(m3) {
27016             return m3.map(poly);
27017           }
27018           function geometry(obj) {
27019             if (!obj) {
27020               return {};
27021             }
27022             switch (obj.type) {
27023               case "Point":
27024                 obj.coordinates = point(obj.coordinates);
27025                 return obj;
27026               case "LineString":
27027               case "MultiPoint":
27028                 obj.coordinates = multi(obj.coordinates);
27029                 return obj;
27030               case "Polygon":
27031               case "MultiLineString":
27032                 obj.coordinates = poly(obj.coordinates);
27033                 return obj;
27034               case "MultiPolygon":
27035                 obj.coordinates = multiPoly(obj.coordinates);
27036                 return obj;
27037               case "GeometryCollection":
27038                 obj.geometries = obj.geometries.map(geometry);
27039                 return obj;
27040               default:
27041                 return {};
27042             }
27043           }
27044           function feature3(obj) {
27045             obj.geometry = geometry(obj.geometry);
27046             return obj;
27047           }
27048           function featureCollection(f2) {
27049             f2.features = f2.features.map(feature3);
27050             return f2;
27051           }
27052           function geometryCollection(g3) {
27053             g3.geometries = g3.geometries.map(geometry);
27054             return g3;
27055           }
27056           if (!t2) {
27057             return t2;
27058           }
27059           switch (t2.type) {
27060             case "Feature":
27061               return feature3(t2);
27062             case "GeometryCollection":
27063               return geometryCollection(t2);
27064             case "FeatureCollection":
27065               return featureCollection(t2);
27066             case "Point":
27067             case "LineString":
27068             case "Polygon":
27069             case "MultiPoint":
27070             case "MultiPolygon":
27071             case "MultiLineString":
27072               return geometry(t2);
27073             default:
27074               return t2;
27075           }
27076         }
27077         module2.exports = parse;
27078         module2.exports.parse = parse;
27079       })();
27080     }
27081   });
27082
27083   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
27084   var require_json_stringify_pretty_compact = __commonJS({
27085     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
27086       function isObject2(obj) {
27087         return typeof obj === "object" && obj !== null;
27088       }
27089       function forEach(obj, cb) {
27090         if (Array.isArray(obj)) {
27091           obj.forEach(cb);
27092         } else if (isObject2(obj)) {
27093           Object.keys(obj).forEach(function(key) {
27094             var val = obj[key];
27095             cb(val, key);
27096           });
27097         }
27098       }
27099       function getTreeDepth(obj) {
27100         var depth = 0;
27101         if (Array.isArray(obj) || isObject2(obj)) {
27102           forEach(obj, function(val) {
27103             if (Array.isArray(val) || isObject2(val)) {
27104               var tmpDepth = getTreeDepth(val);
27105               if (tmpDepth > depth) {
27106                 depth = tmpDepth;
27107               }
27108             }
27109           });
27110           return depth + 1;
27111         }
27112         return depth;
27113       }
27114       function stringify3(obj, options) {
27115         options = options || {};
27116         var indent = JSON.stringify([1], null, get4(options, "indent", 2)).slice(2, -3);
27117         var addMargin = get4(options, "margins", false);
27118         var addArrayMargin = get4(options, "arrayMargins", false);
27119         var addObjectMargin = get4(options, "objectMargins", false);
27120         var maxLength = indent === "" ? Infinity : get4(options, "maxLength", 80);
27121         var maxNesting = get4(options, "maxNesting", Infinity);
27122         return function _stringify(obj2, currentIndent, reserved) {
27123           if (obj2 && typeof obj2.toJSON === "function") {
27124             obj2 = obj2.toJSON();
27125           }
27126           var string = JSON.stringify(obj2);
27127           if (string === void 0) {
27128             return string;
27129           }
27130           var length2 = maxLength - currentIndent.length - reserved;
27131           var treeDepth = getTreeDepth(obj2);
27132           if (treeDepth <= maxNesting && string.length <= length2) {
27133             var prettified = prettify(string, {
27134               addMargin,
27135               addArrayMargin,
27136               addObjectMargin
27137             });
27138             if (prettified.length <= length2) {
27139               return prettified;
27140             }
27141           }
27142           if (isObject2(obj2)) {
27143             var nextIndent = currentIndent + indent;
27144             var items = [];
27145             var delimiters;
27146             var comma = function(array2, index2) {
27147               return index2 === array2.length - 1 ? 0 : 1;
27148             };
27149             if (Array.isArray(obj2)) {
27150               for (var index = 0; index < obj2.length; index++) {
27151                 items.push(
27152                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
27153                 );
27154               }
27155               delimiters = "[]";
27156             } else {
27157               Object.keys(obj2).forEach(function(key, index2, array2) {
27158                 var keyPart = JSON.stringify(key) + ": ";
27159                 var value = _stringify(
27160                   obj2[key],
27161                   nextIndent,
27162                   keyPart.length + comma(array2, index2)
27163                 );
27164                 if (value !== void 0) {
27165                   items.push(keyPart + value);
27166                 }
27167               });
27168               delimiters = "{}";
27169             }
27170             if (items.length > 0) {
27171               return [
27172                 delimiters[0],
27173                 indent + items.join(",\n" + nextIndent),
27174                 delimiters[1]
27175               ].join("\n" + currentIndent);
27176             }
27177           }
27178           return string;
27179         }(obj, "", 0);
27180       }
27181       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
27182       function prettify(string, options) {
27183         options = options || {};
27184         var tokens = {
27185           "{": "{",
27186           "}": "}",
27187           "[": "[",
27188           "]": "]",
27189           ",": ", ",
27190           ":": ": "
27191         };
27192         if (options.addMargin || options.addObjectMargin) {
27193           tokens["{"] = "{ ";
27194           tokens["}"] = " }";
27195         }
27196         if (options.addMargin || options.addArrayMargin) {
27197           tokens["["] = "[ ";
27198           tokens["]"] = " ]";
27199         }
27200         return string.replace(stringOrChar, function(match, string2) {
27201           return string2 ? match : tokens[match];
27202         });
27203       }
27204       function get4(options, name, defaultValue) {
27205         return name in options ? options[name] : defaultValue;
27206       }
27207       module2.exports = stringify3;
27208     }
27209   });
27210
27211   // node_modules/@rapideditor/location-conflation/index.mjs
27212   function _clip(features, which) {
27213     if (!Array.isArray(features) || !features.length) return null;
27214     const fn = { UNION: union, DIFFERENCE: difference }[which];
27215     const args = features.map((feature3) => feature3.geometry.coordinates);
27216     const coords = fn.apply(null, args);
27217     return {
27218       type: "Feature",
27219       properties: {},
27220       geometry: {
27221         type: whichType(coords),
27222         coordinates: coords
27223       }
27224     };
27225     function whichType(coords2) {
27226       const a4 = Array.isArray(coords2);
27227       const b3 = a4 && Array.isArray(coords2[0]);
27228       const c2 = b3 && Array.isArray(coords2[0][0]);
27229       const d2 = c2 && Array.isArray(coords2[0][0][0]);
27230       return d2 ? "MultiPolygon" : "Polygon";
27231     }
27232   }
27233   function _cloneDeep(obj) {
27234     return JSON.parse(JSON.stringify(obj));
27235   }
27236   function _sortLocations(a4, b3) {
27237     const rank = { countrycoder: 1, geojson: 2, point: 3 };
27238     const aRank = rank[a4.type];
27239     const bRank = rank[b3.type];
27240     return aRank > bRank ? 1 : aRank < bRank ? -1 : a4.id.localeCompare(b3.id);
27241   }
27242   var import_geojson_area, import_circle_to_polygon, import_geojson_precision, import_json_stringify_pretty_compact, LocationConflation;
27243   var init_location_conflation = __esm({
27244     "node_modules/@rapideditor/location-conflation/index.mjs"() {
27245       init_country_coder();
27246       init_esm2();
27247       import_geojson_area = __toESM(require_geojson_area(), 1);
27248       import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
27249       import_geojson_precision = __toESM(require_geojson_precision(), 1);
27250       import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
27251       LocationConflation = class {
27252         // constructor
27253         //
27254         // `fc`  Optional FeatureCollection of known features
27255         //
27256         // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
27257         // Each feature must have a filename-like `id`, for example: `something.geojson`
27258         //
27259         // {
27260         //   "type": "FeatureCollection"
27261         //   "features": [
27262         //     {
27263         //       "type": "Feature",
27264         //       "id": "philly_metro.geojson",
27265         //       "properties": { … },
27266         //       "geometry": { … }
27267         //     }
27268         //   ]
27269         // }
27270         constructor(fc) {
27271           this._cache = {};
27272           this.strict = true;
27273           if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
27274             fc.features.forEach((feature3) => {
27275               feature3.properties = feature3.properties || {};
27276               let props = feature3.properties;
27277               let id2 = feature3.id || props.id;
27278               if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
27279               id2 = id2.toLowerCase();
27280               feature3.id = id2;
27281               props.id = id2;
27282               if (!props.area) {
27283                 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
27284                 props.area = Number(area.toFixed(2));
27285               }
27286               this._cache[id2] = feature3;
27287             });
27288           }
27289           let world = _cloneDeep(feature("Q2"));
27290           world.geometry = {
27291             type: "Polygon",
27292             coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
27293           };
27294           world.id = "Q2";
27295           world.properties.id = "Q2";
27296           world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
27297           this._cache.Q2 = world;
27298         }
27299         // validateLocation
27300         // `location`  The location to validate
27301         //
27302         // Pass a `location` value to validate
27303         //
27304         // Returns a result like:
27305         //   {
27306         //     type:     'point', 'geojson', or 'countrycoder'
27307         //     location:  the queried location
27308         //     id:        the stable identifier for the feature
27309         //   }
27310         // or `null` if the location is invalid
27311         //
27312         validateLocation(location) {
27313           if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
27314             const lon = location[0];
27315             const lat = location[1];
27316             const radius = location[2];
27317             if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
27318               const id2 = "[" + location.toString() + "]";
27319               return { type: "point", location, id: id2 };
27320             }
27321           } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
27322             const id2 = location.toLowerCase();
27323             if (this._cache[id2]) {
27324               return { type: "geojson", location, id: id2 };
27325             }
27326           } else if (typeof location === "string" || typeof location === "number") {
27327             const feature3 = feature(location);
27328             if (feature3) {
27329               const id2 = feature3.properties.wikidata;
27330               return { type: "countrycoder", location, id: id2 };
27331             }
27332           }
27333           if (this.strict) {
27334             throw new Error(`validateLocation:  Invalid location: "${location}".`);
27335           } else {
27336             return null;
27337           }
27338         }
27339         // resolveLocation
27340         // `location`  The location to resolve
27341         //
27342         // Pass a `location` value to resolve
27343         //
27344         // Returns a result like:
27345         //   {
27346         //     type:      'point', 'geojson', or 'countrycoder'
27347         //     location:  the queried location
27348         //     id:        a stable identifier for the feature
27349         //     feature:   the resolved GeoJSON feature
27350         //   }
27351         //  or `null` if the location is invalid
27352         //
27353         resolveLocation(location) {
27354           const valid = this.validateLocation(location);
27355           if (!valid) return null;
27356           const id2 = valid.id;
27357           if (this._cache[id2]) {
27358             return Object.assign(valid, { feature: this._cache[id2] });
27359           }
27360           if (valid.type === "point") {
27361             const lon = location[0];
27362             const lat = location[1];
27363             const radius = location[2] || 25;
27364             const EDGES = 10;
27365             const PRECISION = 3;
27366             const area = Math.PI * radius * radius;
27367             const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
27368               type: "Feature",
27369               id: id2,
27370               properties: { id: id2, area: Number(area.toFixed(2)) },
27371               geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
27372               // km to m
27373             }, PRECISION);
27374             return Object.assign(valid, { feature: feature3 });
27375           } else if (valid.type === "geojson") {
27376           } else if (valid.type === "countrycoder") {
27377             let feature3 = _cloneDeep(feature(id2));
27378             let props = feature3.properties;
27379             if (Array.isArray(props.members)) {
27380               let aggregate = aggregateFeature(id2);
27381               aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
27382               feature3.geometry = aggregate.geometry;
27383             }
27384             if (!props.area) {
27385               const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
27386               props.area = Number(area.toFixed(2));
27387             }
27388             feature3.id = id2;
27389             props.id = id2;
27390             this._cache[id2] = feature3;
27391             return Object.assign(valid, { feature: feature3 });
27392           }
27393           if (this.strict) {
27394             throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
27395           } else {
27396             return null;
27397           }
27398         }
27399         // validateLocationSet
27400         // `locationSet`  the locationSet to validate
27401         //
27402         // Pass a locationSet Object to validate like:
27403         //   {
27404         //     include: [ Array of locations ],
27405         //     exclude: [ Array of locations ]
27406         //   }
27407         //
27408         // Returns a result like:
27409         //   {
27410         //     type:         'locationset'
27411         //     locationSet:  the queried locationSet
27412         //     id:           the stable identifier for the feature
27413         //   }
27414         // or `null` if the locationSet is invalid
27415         //
27416         validateLocationSet(locationSet) {
27417           locationSet = locationSet || {};
27418           const validator = this.validateLocation.bind(this);
27419           let include = (locationSet.include || []).map(validator).filter(Boolean);
27420           let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
27421           if (!include.length) {
27422             if (this.strict) {
27423               throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
27424             } else {
27425               locationSet.include = ["Q2"];
27426               include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
27427             }
27428           }
27429           include.sort(_sortLocations);
27430           let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
27431           if (exclude.length) {
27432             exclude.sort(_sortLocations);
27433             id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
27434           }
27435           return { type: "locationset", locationSet, id: id2 };
27436         }
27437         // resolveLocationSet
27438         // `locationSet`  the locationSet to resolve
27439         //
27440         // Pass a locationSet Object to validate like:
27441         //   {
27442         //     include: [ Array of locations ],
27443         //     exclude: [ Array of locations ]
27444         //   }
27445         //
27446         // Returns a result like:
27447         //   {
27448         //     type:         'locationset'
27449         //     locationSet:  the queried locationSet
27450         //     id:           the stable identifier for the feature
27451         //     feature:      the resolved GeoJSON feature
27452         //   }
27453         // or `null` if the locationSet is invalid
27454         //
27455         resolveLocationSet(locationSet) {
27456           locationSet = locationSet || {};
27457           const valid = this.validateLocationSet(locationSet);
27458           if (!valid) return null;
27459           const id2 = valid.id;
27460           if (this._cache[id2]) {
27461             return Object.assign(valid, { feature: this._cache[id2] });
27462           }
27463           const resolver = this.resolveLocation.bind(this);
27464           const includes = (locationSet.include || []).map(resolver).filter(Boolean);
27465           const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
27466           if (includes.length === 1 && excludes.length === 0) {
27467             return Object.assign(valid, { feature: includes[0].feature });
27468           }
27469           const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
27470           const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
27471           let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
27472           const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
27473           resultGeoJSON.id = id2;
27474           resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
27475           this._cache[id2] = resultGeoJSON;
27476           return Object.assign(valid, { feature: resultGeoJSON });
27477         }
27478         // stringify
27479         // convenience method to prettyStringify the given object
27480         stringify(obj, options) {
27481           return (0, import_json_stringify_pretty_compact.default)(obj, options);
27482         }
27483       };
27484     }
27485   });
27486
27487   // modules/core/LocationManager.js
27488   var LocationManager_exports = {};
27489   __export(LocationManager_exports, {
27490     LocationManager: () => LocationManager,
27491     locationManager: () => _sharedLocationManager
27492   });
27493   var import_which_polygon2, import_geojson_area2, _loco, LocationManager, _sharedLocationManager;
27494   var init_LocationManager = __esm({
27495     "modules/core/LocationManager.js"() {
27496       "use strict";
27497       init_location_conflation();
27498       import_which_polygon2 = __toESM(require_which_polygon());
27499       import_geojson_area2 = __toESM(require_geojson_area());
27500       _loco = new LocationConflation();
27501       LocationManager = class {
27502         /**
27503          * @constructor
27504          */
27505         constructor() {
27506           this._wp = null;
27507           this._resolved = /* @__PURE__ */ new Map();
27508           this._knownLocationSets = /* @__PURE__ */ new Map();
27509           this._locationIncludedIn = /* @__PURE__ */ new Map();
27510           this._locationExcludedIn = /* @__PURE__ */ new Map();
27511           const world = { locationSet: { include: ["Q2"] } };
27512           this._resolveLocationSet(world);
27513           this._rebuildIndex();
27514         }
27515         /**
27516          * _validateLocationSet
27517          * Pass an Object with a `locationSet` property.
27518          * Validates the `locationSet` and sets a `locationSetID` property on the object.
27519          * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
27520          *
27521          * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
27522          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
27523          *
27524          * @param  `obj`  Object to check, it should have `locationSet` property
27525          */
27526         _validateLocationSet(obj) {
27527           if (obj.locationSetID) return;
27528           try {
27529             let locationSet = obj.locationSet;
27530             if (!locationSet) {
27531               throw new Error("object missing locationSet property");
27532             }
27533             if (!locationSet.include) {
27534               locationSet.include = ["Q2"];
27535             }
27536             const locationSetID = _loco.validateLocationSet(locationSet).id;
27537             obj.locationSetID = locationSetID;
27538             if (this._knownLocationSets.has(locationSetID)) return;
27539             let area = 0;
27540             (locationSet.include || []).forEach((location) => {
27541               const locationID = _loco.validateLocation(location).id;
27542               let geojson = this._resolved.get(locationID);
27543               if (!geojson) {
27544                 geojson = _loco.resolveLocation(location).feature;
27545                 this._resolved.set(locationID, geojson);
27546               }
27547               area += geojson.properties.area;
27548               let s2 = this._locationIncludedIn.get(locationID);
27549               if (!s2) {
27550                 s2 = /* @__PURE__ */ new Set();
27551                 this._locationIncludedIn.set(locationID, s2);
27552               }
27553               s2.add(locationSetID);
27554             });
27555             (locationSet.exclude || []).forEach((location) => {
27556               const locationID = _loco.validateLocation(location).id;
27557               let geojson = this._resolved.get(locationID);
27558               if (!geojson) {
27559                 geojson = _loco.resolveLocation(location).feature;
27560                 this._resolved.set(locationID, geojson);
27561               }
27562               area -= geojson.properties.area;
27563               let s2 = this._locationExcludedIn.get(locationID);
27564               if (!s2) {
27565                 s2 = /* @__PURE__ */ new Set();
27566                 this._locationExcludedIn.set(locationID, s2);
27567               }
27568               s2.add(locationSetID);
27569             });
27570             this._knownLocationSets.set(locationSetID, area);
27571           } catch {
27572             obj.locationSet = { include: ["Q2"] };
27573             obj.locationSetID = "+[Q2]";
27574           }
27575         }
27576         /**
27577          * _resolveLocationSet
27578          * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
27579          * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
27580          *
27581          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
27582          *
27583          * @param  `obj`  Object to check, it should have `locationSet` property
27584          */
27585         _resolveLocationSet(obj) {
27586           this._validateLocationSet(obj);
27587           if (this._resolved.has(obj.locationSetID)) return;
27588           try {
27589             const result = _loco.resolveLocationSet(obj.locationSet);
27590             const locationSetID = result.id;
27591             obj.locationSetID = locationSetID;
27592             if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
27593               throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
27594             }
27595             let geojson = JSON.parse(JSON.stringify(result.feature));
27596             geojson.id = locationSetID;
27597             geojson.properties.id = locationSetID;
27598             this._resolved.set(locationSetID, geojson);
27599           } catch {
27600             obj.locationSet = { include: ["Q2"] };
27601             obj.locationSetID = "+[Q2]";
27602           }
27603         }
27604         /**
27605          * _rebuildIndex
27606          * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
27607          */
27608         _rebuildIndex() {
27609           this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
27610         }
27611         /**
27612          * mergeCustomGeoJSON
27613          * Accepts a FeatureCollection-like object containing custom locations
27614          * Each feature must have a filename-like `id`, for example: `something.geojson`
27615          * {
27616          *   "type": "FeatureCollection"
27617          *   "features": [
27618          *     {
27619          *       "type": "Feature",
27620          *       "id": "philly_metro.geojson",
27621          *       "properties": { … },
27622          *       "geometry": { … }
27623          *     }
27624          *   ]
27625          * }
27626          *
27627          * @param  `fc`  FeatureCollection-like Object containing custom locations
27628          */
27629         mergeCustomGeoJSON(fc) {
27630           if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features)) return;
27631           fc.features.forEach((feature3) => {
27632             feature3.properties = feature3.properties || {};
27633             let props = feature3.properties;
27634             let id2 = feature3.id || props.id;
27635             if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
27636             id2 = id2.toLowerCase();
27637             feature3.id = id2;
27638             props.id = id2;
27639             if (!props.area) {
27640               const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
27641               props.area = Number(area.toFixed(2));
27642             }
27643             _loco._cache[id2] = feature3;
27644           });
27645         }
27646         /**
27647          * mergeLocationSets
27648          * Accepts an Array of Objects containing `locationSet` properties:
27649          * [
27650          *  { id: 'preset1', locationSet: {…} },
27651          *  { id: 'preset2', locationSet: {…} },
27652          *  …
27653          * ]
27654          * After validating, the Objects will be decorated with a `locationSetID` property:
27655          * [
27656          *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
27657          *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
27658          *  …
27659          * ]
27660          *
27661          * @param  `objects`  Objects to check - they should have `locationSet` property
27662          * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
27663          */
27664         mergeLocationSets(objects) {
27665           if (!Array.isArray(objects)) return Promise.reject("nothing to do");
27666           objects.forEach((obj) => this._validateLocationSet(obj));
27667           this._rebuildIndex();
27668           return Promise.resolve(objects);
27669         }
27670         /**
27671          * locationSetID
27672          * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
27673          * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
27674          *
27675          * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
27676          * @return  String locationSetID, e.g. `+[Q30]`
27677          */
27678         locationSetID(locationSet) {
27679           let locationSetID;
27680           try {
27681             locationSetID = _loco.validateLocationSet(locationSet).id;
27682           } catch {
27683             locationSetID = "+[Q2]";
27684           }
27685           return locationSetID;
27686         }
27687         /**
27688          * feature
27689          * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
27690          * A GeoJSON feature:
27691          * {
27692          *   type: 'Feature',
27693          *   id: '+[Q30]',
27694          *   properties: { id: '+[Q30]', area: 21817019.17, … },
27695          *   geometry: { … }
27696          * }
27697          *
27698          * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
27699          * @return  GeoJSON object (fallback to world)
27700          */
27701         feature(locationSetID = "+[Q2]") {
27702           const feature3 = this._resolved.get(locationSetID);
27703           return feature3 || this._resolved.get("+[Q2]");
27704         }
27705         /**
27706          * locationSetsAt
27707          * Find all the locationSets valid at the given location.
27708          * Results include the area (in km²) to facilitate sorting.
27709          *
27710          * Object of locationSetIDs to areas (in km²)
27711          * {
27712          *   "+[Q2]": 511207893.3958111,
27713          *   "+[Q30]": 21817019.17,
27714          *   "+[new_jersey.geojson]": 22390.77,
27715          *   …
27716          * }
27717          *
27718          * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
27719          * @return  Object of locationSetIDs valid at given location
27720          */
27721         locationSetsAt(loc) {
27722           let result = {};
27723           const hits = this._wp(loc, true) || [];
27724           const thiz = this;
27725           hits.forEach((prop) => {
27726             if (prop.id[0] !== "+") return;
27727             const locationSetID = prop.id;
27728             const area = thiz._knownLocationSets.get(locationSetID);
27729             if (area) {
27730               result[locationSetID] = area;
27731             }
27732           });
27733           hits.forEach((prop) => {
27734             if (prop.id[0] === "+") return;
27735             const locationID = prop.id;
27736             const included = thiz._locationIncludedIn.get(locationID);
27737             (included || []).forEach((locationSetID) => {
27738               const area = thiz._knownLocationSets.get(locationSetID);
27739               if (area) {
27740                 result[locationSetID] = area;
27741               }
27742             });
27743           });
27744           hits.forEach((prop) => {
27745             if (prop.id[0] === "+") return;
27746             const locationID = prop.id;
27747             const excluded = thiz._locationExcludedIn.get(locationID);
27748             (excluded || []).forEach((locationSetID) => {
27749               delete result[locationSetID];
27750             });
27751           });
27752           return result;
27753         }
27754         // Direct access to the location-conflation resolver
27755         loco() {
27756           return _loco;
27757         }
27758       };
27759       _sharedLocationManager = new LocationManager();
27760     }
27761   });
27762
27763   // modules/presets/collection.js
27764   var collection_exports = {};
27765   __export(collection_exports, {
27766     presetCollection: () => presetCollection
27767   });
27768   function presetCollection(collection) {
27769     const MAXRESULTS = 50;
27770     let _this = {};
27771     let _memo = {};
27772     _this.collection = collection;
27773     _this.item = (id2) => {
27774       if (_memo[id2]) return _memo[id2];
27775       const found = _this.collection.find((d2) => d2.id === id2);
27776       if (found) _memo[id2] = found;
27777       return found;
27778     };
27779     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
27780     _this.matchGeometry = (geometry) => {
27781       return presetCollection(
27782         _this.collection.filter((d2) => d2.matchGeometry(geometry))
27783       );
27784     };
27785     _this.matchAllGeometry = (geometries) => {
27786       return presetCollection(
27787         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
27788       );
27789     };
27790     _this.matchAnyGeometry = (geometries) => {
27791       return presetCollection(
27792         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
27793       );
27794     };
27795     _this.fallback = (geometry) => {
27796       let id2 = geometry;
27797       if (id2 === "vertex") id2 = "point";
27798       return _this.item(id2);
27799     };
27800     _this.search = (value, geometry, loc) => {
27801       if (!value) return _this;
27802       value = value.toLowerCase().trim();
27803       function leading(a4) {
27804         const index = a4.indexOf(value);
27805         return index === 0 || a4[index - 1] === " ";
27806       }
27807       function leadingStrict(a4) {
27808         const index = a4.indexOf(value);
27809         return index === 0;
27810       }
27811       function sortPresets(nameProp, aliasesProp) {
27812         return function sortNames(a4, b3) {
27813           let aCompare = a4[nameProp]();
27814           let bCompare = b3[nameProp]();
27815           if (aliasesProp) {
27816             const findMatchingAlias = (strings) => {
27817               if (strings.some((s2) => s2 === value)) {
27818                 return strings.find((s2) => s2 === value);
27819               } else {
27820                 return strings.filter((s2) => s2.includes(value)).sort((a5, b4) => a5.length - b4.length)[0];
27821               }
27822             };
27823             aCompare = findMatchingAlias([aCompare].concat(a4[aliasesProp]()));
27824             bCompare = findMatchingAlias([bCompare].concat(b3[aliasesProp]()));
27825           }
27826           if (value === aCompare) return -1;
27827           if (value === bCompare) return 1;
27828           let i3 = b3.originalScore - a4.originalScore;
27829           if (i3 !== 0) return i3;
27830           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
27831           if (i3 !== 0) return i3;
27832           return aCompare.length - bCompare.length;
27833         };
27834       }
27835       let pool = _this.collection;
27836       if (Array.isArray(loc)) {
27837         const validHere = _sharedLocationManager.locationSetsAt(loc);
27838         pool = pool.filter((a4) => !a4.locationSetID || validHere[a4.locationSetID]);
27839       }
27840       const searchable = pool.filter((a4) => a4.searchable !== false && a4.suggestion !== true);
27841       const suggestions = pool.filter((a4) => a4.suggestion === true);
27842       const leadingNames = searchable.filter((a4) => leading(a4.searchName()) || a4.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
27843       const leadingSuggestions = suggestions.filter((a4) => leadingStrict(a4.searchName())).sort(sortPresets("searchName"));
27844       const leadingNamesStripped = searchable.filter((a4) => leading(a4.searchNameStripped()) || a4.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
27845       const leadingSuggestionsStripped = suggestions.filter((a4) => leadingStrict(a4.searchNameStripped())).sort(sortPresets("searchNameStripped"));
27846       const leadingTerms = searchable.filter((a4) => (a4.terms() || []).some(leading));
27847       const leadingSuggestionTerms = suggestions.filter((a4) => (a4.terms() || []).some(leading));
27848       const leadingTagValues = searchable.filter((a4) => Object.values(a4.tags || {}).filter((val) => val !== "*").some(leading));
27849       const similarName = searchable.map((a4) => ({ preset: a4, dist: utilEditDistance(value, a4.searchName()) })).filter((a4) => a4.dist + Math.min(value.length - a4.preset.searchName().length, 0) < 3).sort((a4, b3) => a4.dist - b3.dist).map((a4) => a4.preset);
27850       const similarSuggestions = suggestions.map((a4) => ({ preset: a4, dist: utilEditDistance(value, a4.searchName()) })).filter((a4) => a4.dist + Math.min(value.length - a4.preset.searchName().length, 0) < 1).sort((a4, b3) => a4.dist - b3.dist).map((a4) => a4.preset);
27851       const similarTerms = searchable.filter((a4) => {
27852         return (a4.terms() || []).some((b3) => {
27853           return utilEditDistance(value, b3) + Math.min(value.length - b3.length, 0) < 3;
27854         });
27855       });
27856       let leadingTagKeyValues = [];
27857       if (value.includes("=")) {
27858         leadingTagKeyValues = searchable.filter((a4) => a4.tags && Object.keys(a4.tags).some((key) => key + "=" + a4.tags[key] === value)).concat(searchable.filter((a4) => a4.tags && Object.keys(a4.tags).some((key) => leading(key + "=" + a4.tags[key]))));
27859       }
27860       let results = leadingNames.concat(
27861         leadingSuggestions,
27862         leadingNamesStripped,
27863         leadingSuggestionsStripped,
27864         leadingTerms,
27865         leadingSuggestionTerms,
27866         leadingTagValues,
27867         similarName,
27868         similarSuggestions,
27869         similarTerms,
27870         leadingTagKeyValues
27871       ).slice(0, MAXRESULTS - 1);
27872       if (geometry) {
27873         if (typeof geometry === "string") {
27874           results.push(_this.fallback(geometry));
27875         } else {
27876           geometry.forEach((geom) => results.push(_this.fallback(geom)));
27877         }
27878       }
27879       return presetCollection(utilArrayUniq(results));
27880     };
27881     return _this;
27882   }
27883   var init_collection = __esm({
27884     "modules/presets/collection.js"() {
27885       "use strict";
27886       init_LocationManager();
27887       init_array3();
27888       init_util();
27889     }
27890   });
27891
27892   // modules/presets/category.js
27893   var category_exports = {};
27894   __export(category_exports, {
27895     presetCategory: () => presetCategory
27896   });
27897   function presetCategory(categoryID, category, allPresets) {
27898     let _this = Object.assign({}, category);
27899     let _searchName;
27900     let _searchNameStripped;
27901     _this.id = categoryID;
27902     _this.members = presetCollection(
27903       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
27904     );
27905     _this.geometry = _this.members.collection.reduce((acc, preset) => {
27906       for (let i3 in preset.geometry) {
27907         const geometry = preset.geometry[i3];
27908         if (acc.indexOf(geometry) === -1) {
27909           acc.push(geometry);
27910         }
27911       }
27912       return acc;
27913     }, []);
27914     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27915     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
27916     _this.matchScore = () => -1;
27917     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27918     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27919     _this.terms = () => [];
27920     _this.searchName = () => {
27921       if (!_searchName) {
27922         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27923       }
27924       return _searchName;
27925     };
27926     _this.searchNameStripped = () => {
27927       if (!_searchNameStripped) {
27928         _searchNameStripped = _this.searchName();
27929         if (_searchNameStripped.normalize) _searchNameStripped = _searchNameStripped.normalize("NFD");
27930         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27931       }
27932       return _searchNameStripped;
27933     };
27934     _this.searchAliases = () => [];
27935     _this.searchAliasesStripped = () => [];
27936     return _this;
27937   }
27938   var init_category = __esm({
27939     "modules/presets/category.js"() {
27940       "use strict";
27941       init_localizer();
27942       init_collection();
27943     }
27944   });
27945
27946   // modules/presets/field.js
27947   var field_exports = {};
27948   __export(field_exports, {
27949     presetField: () => presetField
27950   });
27951   function presetField(fieldID, field, allFields) {
27952     allFields = allFields || {};
27953     let _this = Object.assign({}, field);
27954     _this.id = fieldID;
27955     _this.safeid = utilSafeClassName(fieldID);
27956     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27957     _this.matchAllGeometry = (geometries) => {
27958       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27959     };
27960     _this.t = (scope, options) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options);
27961     _this.t.html = (scope, options) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options);
27962     _this.t.append = (scope, options) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options);
27963     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
27964     _this.resolveReference = (which) => {
27965       const referenceRegex = /^\{(.*)\}$/;
27966       const match = (field[which] || "").match(referenceRegex);
27967       if (match) {
27968         const field2 = allFields[match[1]];
27969         if (field2) {
27970           return field2;
27971         }
27972         console.error(`Unable to resolve referenced field: ${match[1]}`);
27973       }
27974       return _this;
27975     };
27976     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27977     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27978     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27979     _this.originalTerms = (_this.terms || []).join();
27980     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27981     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27982     return _this;
27983   }
27984   var init_field = __esm({
27985     "modules/presets/field.js"() {
27986       "use strict";
27987       init_localizer();
27988       init_util2();
27989     }
27990   });
27991
27992   // modules/presets/preset.js
27993   var preset_exports = {};
27994   __export(preset_exports, {
27995     presetPreset: () => presetPreset
27996   });
27997   function presetPreset(presetID, preset, addable, allFields, allPresets) {
27998     allFields = allFields || {};
27999     allPresets = allPresets || {};
28000     let _this = Object.assign({}, preset);
28001     let _addable = addable || false;
28002     let _searchName;
28003     let _searchNameStripped;
28004     let _searchAliases;
28005     let _searchAliasesStripped;
28006     const referenceRegex = /^\{(.*)\}$/;
28007     _this.id = presetID;
28008     _this.safeid = utilSafeClassName(presetID);
28009     _this.originalTerms = (_this.terms || []).join();
28010     _this.originalName = _this.name || "";
28011     _this.originalAliases = (_this.aliases || []).join("\n");
28012     _this.originalScore = _this.matchScore || 1;
28013     _this.originalReference = _this.reference || {};
28014     _this.originalFields = _this.fields || [];
28015     _this.originalMoreFields = _this.moreFields || [];
28016     _this.fields = (loc) => resolveFields("fields", loc);
28017     _this.moreFields = (loc) => resolveFields("moreFields", loc);
28018     _this.tags = _this.tags || {};
28019     _this.addTags = _this.addTags || _this.tags;
28020     _this.removeTags = _this.removeTags || _this.addTags;
28021     _this.geometry = _this.geometry || [];
28022     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
28023     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
28024     _this.matchScore = (entityTags) => {
28025       const tags = _this.tags;
28026       let seen = {};
28027       let score = 0;
28028       for (let k3 in tags) {
28029         seen[k3] = true;
28030         if (entityTags[k3] === tags[k3]) {
28031           score += _this.originalScore;
28032         } else if (tags[k3] === "*" && k3 in entityTags) {
28033           score += _this.originalScore / 2;
28034         } else {
28035           return -1;
28036         }
28037       }
28038       const addTags = _this.addTags;
28039       for (let k3 in addTags) {
28040         if (!seen[k3] && entityTags[k3] === addTags[k3]) {
28041           score += _this.originalScore;
28042         }
28043       }
28044       if (_this.searchable === false) {
28045         score *= 0.999;
28046       }
28047       return score;
28048     };
28049     _this.t = (scope, options) => {
28050       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
28051       return _t(textID, options);
28052     };
28053     _this.t.append = (scope, options) => {
28054       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
28055       return _t.append(textID, options);
28056     };
28057     function resolveReference(which) {
28058       const match = (_this[which] || "").match(referenceRegex);
28059       if (match) {
28060         const preset2 = allPresets[match[1]];
28061         if (preset2) {
28062           return preset2;
28063         }
28064         console.error(`Unable to resolve referenced preset: ${match[1]}`);
28065       }
28066       return _this;
28067     }
28068     _this.name = () => {
28069       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
28070     };
28071     _this.nameLabel = () => {
28072       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
28073     };
28074     _this.subtitle = () => {
28075       if (_this.suggestion) {
28076         let path = presetID.split("/");
28077         path.pop();
28078         return _t("_tagging.presets.presets." + path.join("/") + ".name");
28079       }
28080       return null;
28081     };
28082     _this.subtitleLabel = () => {
28083       if (_this.suggestion) {
28084         let path = presetID.split("/");
28085         path.pop();
28086         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
28087       }
28088       return null;
28089     };
28090     _this.aliases = () => {
28091       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/).filter(Boolean);
28092     };
28093     _this.terms = () => {
28094       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
28095     };
28096     _this.searchName = () => {
28097       if (!_searchName) {
28098         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
28099       }
28100       return _searchName;
28101     };
28102     _this.searchNameStripped = () => {
28103       if (!_searchNameStripped) {
28104         _searchNameStripped = stripDiacritics(_this.searchName());
28105       }
28106       return _searchNameStripped;
28107     };
28108     _this.searchAliases = () => {
28109       if (!_searchAliases) {
28110         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
28111       }
28112       return _searchAliases;
28113     };
28114     _this.searchAliasesStripped = () => {
28115       if (!_searchAliasesStripped) {
28116         _searchAliasesStripped = _this.searchAliases();
28117         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
28118       }
28119       return _searchAliasesStripped;
28120     };
28121     _this.isFallback = () => {
28122       const tagCount = Object.keys(_this.tags).length;
28123       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
28124     };
28125     _this.addable = function(val) {
28126       if (!arguments.length) return _addable;
28127       _addable = val;
28128       return _this;
28129     };
28130     _this.reference = () => {
28131       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
28132       if (qid) {
28133         return { qid };
28134       }
28135       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
28136       let value = _this.originalReference.value || _this.tags[key];
28137       if (value === "*") {
28138         return { key };
28139       } else {
28140         return { key, value };
28141       }
28142     };
28143     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
28144       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
28145       tags = utilObjectOmit(tags, Object.keys(removeTags));
28146       if (geometry && !skipFieldDefaults) {
28147         _this.fields(loc).forEach((field) => {
28148           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
28149             delete tags[field.key];
28150           }
28151         });
28152       }
28153       delete tags.area;
28154       return tags;
28155     };
28156     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
28157       const addTags = _this.addTags;
28158       tags = Object.assign({}, tags);
28159       for (let k3 in addTags) {
28160         if (addTags[k3] === "*") {
28161           if (_this.tags[k3] || !tags[k3]) {
28162             tags[k3] = "yes";
28163           }
28164         } else {
28165           tags[k3] = addTags[k3];
28166         }
28167       }
28168       if (!addTags.hasOwnProperty("area")) {
28169         delete tags.area;
28170         if (geometry === "area") {
28171           let needsAreaTag = true;
28172           for (let k3 in addTags) {
28173             if (_this.geometry.indexOf("line") === -1 && k3 in osmAreaKeys || k3 in osmAreaKeysExceptions && addTags[k3] in osmAreaKeysExceptions[k3]) {
28174               needsAreaTag = false;
28175               break;
28176             }
28177           }
28178           if (needsAreaTag) {
28179             tags.area = "yes";
28180           }
28181         }
28182       }
28183       if (geometry && !skipFieldDefaults) {
28184         _this.fields(loc).forEach((field) => {
28185           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
28186             tags[field.key] = field.default;
28187           }
28188         });
28189       }
28190       return tags;
28191     };
28192     function resolveFields(which, loc) {
28193       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
28194       let resolved = [];
28195       fieldIDs.forEach((fieldID) => {
28196         const match = fieldID.match(referenceRegex);
28197         if (match !== null) {
28198           resolved = resolved.concat(inheritFields(allPresets[match[1]], which, loc));
28199         } else if (allFields[fieldID]) {
28200           resolved.push(allFields[fieldID]);
28201         } else {
28202           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
28203         }
28204       });
28205       if (!resolved.length) {
28206         const endIndex = _this.id.lastIndexOf("/");
28207         const parentID = endIndex && _this.id.substring(0, endIndex);
28208         if (parentID) {
28209           let parent2 = allPresets[parentID];
28210           if (loc) {
28211             const validHere = _sharedLocationManager.locationSetsAt(loc);
28212             if ((parent2 == null ? void 0 : parent2.locationSetID) && !validHere[parent2.locationSetID]) {
28213               const candidateIDs = Object.keys(allPresets).filter((k3) => k3.startsWith(parentID));
28214               parent2 = allPresets[candidateIDs.find((candidateID) => {
28215                 const candidate = allPresets[candidateID];
28216                 return validHere[candidate.locationSetID] && isEqual_default(candidate.tags, parent2.tags);
28217               })];
28218             }
28219           }
28220           resolved = inheritFields(parent2, which, loc);
28221         }
28222       }
28223       if (loc) {
28224         const validHere = _sharedLocationManager.locationSetsAt(loc);
28225         resolved = resolved.filter((field) => !field.locationSetID || validHere[field.locationSetID]);
28226       }
28227       return resolved;
28228       function inheritFields(parent2, which2, loc2) {
28229         if (!parent2) return [];
28230         if (which2 === "fields") {
28231           return parent2.fields(loc2).filter(shouldInherit);
28232         } else if (which2 === "moreFields") {
28233           return parent2.moreFields(loc2).filter(shouldInherit);
28234         } else {
28235           return [];
28236         }
28237       }
28238       function shouldInherit(f2) {
28239         if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
28240         f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check") return false;
28241         if (f2.key && (_this.originalFields.some((originalField) => {
28242           var _a4;
28243           return f2.key === ((_a4 = allFields[originalField]) == null ? void 0 : _a4.key);
28244         }) || _this.originalMoreFields.some((originalField) => {
28245           var _a4;
28246           return f2.key === ((_a4 = allFields[originalField]) == null ? void 0 : _a4.key);
28247         }))) {
28248           return false;
28249         }
28250         return true;
28251       }
28252     }
28253     function stripDiacritics(s2) {
28254       if (s2.normalize) s2 = s2.normalize("NFD");
28255       s2 = s2.replace(/[\u0300-\u036f]/g, "");
28256       return s2;
28257     }
28258     return _this;
28259   }
28260   var init_preset = __esm({
28261     "modules/presets/preset.js"() {
28262       "use strict";
28263       init_lodash();
28264       init_localizer();
28265       init_tags();
28266       init_util();
28267       init_util2();
28268       init_LocationManager();
28269     }
28270   });
28271
28272   // modules/presets/index.js
28273   var presets_exports = {};
28274   __export(presets_exports, {
28275     presetCategory: () => presetCategory,
28276     presetCollection: () => presetCollection,
28277     presetField: () => presetField,
28278     presetIndex: () => presetIndex,
28279     presetManager: () => _mainPresetIndex,
28280     presetPreset: () => presetPreset
28281   });
28282   function presetIndex() {
28283     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
28284     const MAXRECENTS = 30;
28285     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
28286     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
28287     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
28288     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
28289     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
28290     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
28291     let _defaults = {
28292       point: presetCollection([POINT]),
28293       vertex: presetCollection([POINT]),
28294       line: presetCollection([LINE]),
28295       area: presetCollection([AREA]),
28296       relation: presetCollection([RELATION])
28297     };
28298     let _fields = {};
28299     let _categories = {};
28300     let _universal = [];
28301     let _addablePresetIDs = null;
28302     let _recents;
28303     let _favorites;
28304     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28305     let _loadPromise;
28306     _this.ensureLoaded = (bypassCache) => {
28307       if (_loadPromise && !bypassCache) return _loadPromise;
28308       return _loadPromise = Promise.all([
28309         _mainFileFetcher.get("preset_categories"),
28310         _mainFileFetcher.get("preset_defaults"),
28311         _mainFileFetcher.get("preset_presets"),
28312         _mainFileFetcher.get("preset_fields")
28313       ]).then((vals) => {
28314         _this.merge({
28315           categories: vals[0],
28316           defaults: vals[1],
28317           presets: vals[2],
28318           fields: vals[3]
28319         });
28320         osmSetAreaKeys(_this.areaKeys());
28321         osmSetLineTags(_this.lineTags());
28322         osmSetPointTags(_this.pointTags());
28323         osmSetVertexTags(_this.vertexTags());
28324       });
28325     };
28326     _this.merge = (d2) => {
28327       let newLocationSets = [];
28328       if (d2.fields) {
28329         Object.keys(d2.fields).forEach((fieldID) => {
28330           let f2 = d2.fields[fieldID];
28331           if (f2) {
28332             f2 = presetField(fieldID, f2, _fields);
28333             if (f2.locationSet) newLocationSets.push(f2);
28334             _fields[fieldID] = f2;
28335           } else {
28336             delete _fields[fieldID];
28337           }
28338         });
28339       }
28340       if (d2.presets) {
28341         Object.keys(d2.presets).forEach((presetID) => {
28342           let p2 = d2.presets[presetID];
28343           if (p2) {
28344             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
28345             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
28346             if (p2.locationSet) newLocationSets.push(p2);
28347             _presets[presetID] = p2;
28348           } else {
28349             const existing = _presets[presetID];
28350             if (existing && !existing.isFallback()) {
28351               delete _presets[presetID];
28352             }
28353           }
28354         });
28355       }
28356       if (d2.categories) {
28357         Object.keys(d2.categories).forEach((categoryID) => {
28358           let c2 = d2.categories[categoryID];
28359           if (c2) {
28360             c2 = presetCategory(categoryID, c2, _presets);
28361             if (c2.locationSet) newLocationSets.push(c2);
28362             _categories[categoryID] = c2;
28363           } else {
28364             delete _categories[categoryID];
28365           }
28366         });
28367       }
28368       _this.collection = Object.values(_presets).concat(Object.values(_categories));
28369       if (d2.defaults) {
28370         Object.keys(d2.defaults).forEach((geometry) => {
28371           const def = d2.defaults[geometry];
28372           if (Array.isArray(def)) {
28373             _defaults[geometry] = presetCollection(
28374               def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
28375             );
28376           } else {
28377             delete _defaults[geometry];
28378           }
28379         });
28380       }
28381       _universal = Object.values(_fields).filter((field) => field.universal);
28382       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28383       _this.collection.forEach((preset) => {
28384         (preset.geometry || []).forEach((geometry) => {
28385           let g3 = _geometryIndex[geometry];
28386           for (let key in preset.tags) {
28387             g3[key] = g3[key] || {};
28388             let value = preset.tags[key];
28389             (g3[key][value] = g3[key][value] || []).push(preset);
28390           }
28391         });
28392       });
28393       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
28394         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
28395       }
28396       if (newLocationSets.length) {
28397         _sharedLocationManager.mergeLocationSets(newLocationSets);
28398       }
28399       return _this;
28400     };
28401     _this.match = (entity, resolver) => {
28402       return resolver.transient(entity, "presetMatch", () => {
28403         let geometry = entity.geometry(resolver);
28404         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
28405           geometry = "point";
28406         }
28407         const entityExtent = entity.extent(resolver);
28408         return _this.matchTags(entity.tags, geometry, entityExtent.center());
28409       });
28410     };
28411     _this.matchTags = (tags, geometry, loc) => {
28412       const keyIndex = _geometryIndex[geometry];
28413       let bestScore = -1;
28414       let bestMatch;
28415       let matchCandidates = [];
28416       for (let k3 in tags) {
28417         let indexMatches = [];
28418         let valueIndex = keyIndex[k3];
28419         if (!valueIndex) continue;
28420         let keyValueMatches = valueIndex[tags[k3]];
28421         if (keyValueMatches) indexMatches.push(...keyValueMatches);
28422         let keyStarMatches = valueIndex["*"];
28423         if (keyStarMatches) indexMatches.push(...keyStarMatches);
28424         if (indexMatches.length === 0) continue;
28425         for (let i3 = 0; i3 < indexMatches.length; i3++) {
28426           const candidate = indexMatches[i3];
28427           const score = candidate.matchScore(tags);
28428           if (score === -1) {
28429             continue;
28430           }
28431           matchCandidates.push({ score, candidate });
28432           if (score > bestScore) {
28433             bestScore = score;
28434             bestMatch = candidate;
28435           }
28436         }
28437       }
28438       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
28439         const validHere = _sharedLocationManager.locationSetsAt(loc);
28440         if (!validHere[bestMatch.locationSetID]) {
28441           matchCandidates.sort((a4, b3) => a4.score < b3.score ? 1 : -1);
28442           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
28443             const candidateScore = matchCandidates[i3];
28444             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
28445               bestMatch = candidateScore.candidate;
28446               bestScore = candidateScore.score;
28447               break;
28448             }
28449           }
28450         }
28451       }
28452       if (!bestMatch || bestMatch.isFallback()) {
28453         for (let k3 in tags) {
28454           if (/^addr:/.test(k3) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
28455             bestMatch = keyIndex["addr:*"]["*"][0];
28456             break;
28457           }
28458         }
28459       }
28460       return bestMatch || _this.fallback(geometry);
28461     };
28462     _this.allowsVertex = (entity, resolver) => {
28463       if (entity.type !== "node") return false;
28464       if (Object.keys(entity.tags).length === 0) return true;
28465       return resolver.transient(entity, "vertexMatch", () => {
28466         if (entity.isOnAddressLine(resolver)) return true;
28467         const geometries = osmNodeGeometriesForTags(entity.tags);
28468         if (geometries.vertex) return true;
28469         if (geometries.point) return false;
28470         return true;
28471       });
28472     };
28473     _this.areaKeys = () => {
28474       const ignore = {
28475         barrier: true,
28476         highway: true,
28477         footway: true,
28478         railway: true,
28479         junction: true,
28480         type: true
28481       };
28482       let areaKeys = {};
28483       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
28484       presets.forEach((p2) => {
28485         const keys2 = p2.tags && Object.keys(p2.tags);
28486         const key = keys2 && keys2.length && keys2[0];
28487         if (!key) return;
28488         if (ignore[key]) return;
28489         if (p2.geometry.indexOf("area") !== -1) {
28490           areaKeys[key] = areaKeys[key] || {};
28491         }
28492       });
28493       presets.forEach((p2) => {
28494         let key;
28495         for (key in p2.addTags) {
28496           const value = p2.addTags[key];
28497           if (key in areaKeys && // probably an area...
28498           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
28499           value !== "*") {
28500             areaKeys[key][value] = true;
28501           }
28502         }
28503       });
28504       return areaKeys;
28505     };
28506     _this.lineTags = () => {
28507       return _this.collection.filter((lineTags, d2) => {
28508         if (d2.suggestion || d2.replacement || d2.searchable === false) return lineTags;
28509         const keys2 = d2.tags && Object.keys(d2.tags);
28510         const key = keys2 && keys2.length && keys2[0];
28511         if (!key) return lineTags;
28512         if (d2.geometry.indexOf("line") !== -1) {
28513           lineTags[key] = lineTags[key] || [];
28514           lineTags[key].push(d2.tags);
28515         }
28516         return lineTags;
28517       }, {});
28518     };
28519     _this.pointTags = () => {
28520       return _this.collection.reduce((pointTags, d2) => {
28521         if (d2.suggestion || d2.replacement || d2.searchable === false) return pointTags;
28522         const keys2 = d2.tags && Object.keys(d2.tags);
28523         const key = keys2 && keys2.length && keys2[0];
28524         if (!key) return pointTags;
28525         if (d2.geometry.indexOf("point") !== -1) {
28526           pointTags[key] = pointTags[key] || {};
28527           pointTags[key][d2.tags[key]] = true;
28528         }
28529         return pointTags;
28530       }, {});
28531     };
28532     _this.vertexTags = () => {
28533       return _this.collection.reduce((vertexTags, d2) => {
28534         if (d2.suggestion || d2.replacement || d2.searchable === false) return vertexTags;
28535         const keys2 = d2.tags && Object.keys(d2.tags);
28536         const key = keys2 && keys2.length && keys2[0];
28537         if (!key) return vertexTags;
28538         if (d2.geometry.indexOf("vertex") !== -1) {
28539           vertexTags[key] = vertexTags[key] || {};
28540           vertexTags[key][d2.tags[key]] = true;
28541         }
28542         return vertexTags;
28543       }, {});
28544     };
28545     _this.field = (id2) => _fields[id2];
28546     _this.universal = () => _universal;
28547     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
28548       let recents = [];
28549       if (startWithRecents) {
28550         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
28551       }
28552       let defaults;
28553       if (_addablePresetIDs) {
28554         defaults = Array.from(_addablePresetIDs).map(function(id2) {
28555           var preset = _this.item(id2);
28556           if (preset && preset.matchGeometry(geometry)) return preset;
28557           return null;
28558         }).filter(Boolean);
28559       } else {
28560         defaults = _defaults[geometry].collection.concat(_this.fallback(geometry));
28561       }
28562       let result = presetCollection(
28563         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
28564       );
28565       if (Array.isArray(loc)) {
28566         const validHere = _sharedLocationManager.locationSetsAt(loc);
28567         result.collection = result.collection.filter((a4) => !a4.locationSetID || validHere[a4.locationSetID]);
28568       }
28569       return result;
28570     };
28571     _this.addablePresetIDs = function(val) {
28572       if (!arguments.length) return _addablePresetIDs;
28573       if (Array.isArray(val)) val = new Set(val);
28574       _addablePresetIDs = val;
28575       if (_addablePresetIDs) {
28576         _this.collection.forEach((p2) => {
28577           if (p2.addable) p2.addable(_addablePresetIDs.has(p2.id));
28578         });
28579       } else {
28580         _this.collection.forEach((p2) => {
28581           if (p2.addable) p2.addable(true);
28582         });
28583       }
28584       return _this;
28585     };
28586     _this.recent = () => {
28587       return presetCollection(
28588         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
28589       );
28590     };
28591     function RibbonItem(preset, source) {
28592       let item = {};
28593       item.preset = preset;
28594       item.source = source;
28595       item.isFavorite = () => item.source === "favorite";
28596       item.isRecent = () => item.source === "recent";
28597       item.matches = (preset2) => item.preset.id === preset2.id;
28598       item.minified = () => ({ pID: item.preset.id });
28599       return item;
28600     }
28601     function ribbonItemForMinified(d2, source) {
28602       if (d2 && d2.pID) {
28603         const preset = _this.item(d2.pID);
28604         if (!preset) return null;
28605         return RibbonItem(preset, source);
28606       }
28607       return null;
28608     }
28609     _this.getGenericRibbonItems = () => {
28610       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
28611     };
28612     _this.getAddable = () => {
28613       if (!_addablePresetIDs) return [];
28614       return _addablePresetIDs.map((id2) => {
28615         const preset = _this.item(id2);
28616         if (preset) return RibbonItem(preset, "addable");
28617         return null;
28618       }).filter(Boolean);
28619     };
28620     function setRecents(items) {
28621       _recents = items;
28622       const minifiedItems = items.map((d2) => d2.minified());
28623       corePreferences("preset_recents", JSON.stringify(minifiedItems));
28624       dispatch14.call("recentsChange");
28625     }
28626     _this.getRecents = () => {
28627       if (!_recents) {
28628         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
28629           let item = ribbonItemForMinified(d2, "recent");
28630           if (item && item.preset.addable()) acc.push(item);
28631           return acc;
28632         }, []);
28633       }
28634       return _recents;
28635     };
28636     _this.addRecent = (preset, besidePreset, after) => {
28637       const recents = _this.getRecents();
28638       const beforeItem = _this.recentMatching(besidePreset);
28639       let toIndex = recents.indexOf(beforeItem);
28640       if (after) toIndex += 1;
28641       const newItem = RibbonItem(preset, "recent");
28642       recents.splice(toIndex, 0, newItem);
28643       setRecents(recents);
28644     };
28645     _this.removeRecent = (preset) => {
28646       const item = _this.recentMatching(preset);
28647       if (item) {
28648         let items = _this.getRecents();
28649         items.splice(items.indexOf(item), 1);
28650         setRecents(items);
28651       }
28652     };
28653     _this.recentMatching = (preset) => {
28654       const items = _this.getRecents();
28655       for (let i3 in items) {
28656         if (items[i3].matches(preset)) {
28657           return items[i3];
28658         }
28659       }
28660       return null;
28661     };
28662     _this.moveItem = (items, fromIndex, toIndex) => {
28663       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return null;
28664       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
28665       return items;
28666     };
28667     _this.moveRecent = (item, beforeItem) => {
28668       const recents = _this.getRecents();
28669       const fromIndex = recents.indexOf(item);
28670       const toIndex = recents.indexOf(beforeItem);
28671       const items = _this.moveItem(recents, fromIndex, toIndex);
28672       if (items) setRecents(items);
28673     };
28674     _this.setMostRecent = (preset) => {
28675       if (preset.searchable === false) return;
28676       let items = _this.getRecents();
28677       let item = _this.recentMatching(preset);
28678       if (item) {
28679         items.splice(items.indexOf(item), 1);
28680       } else {
28681         item = RibbonItem(preset, "recent");
28682       }
28683       while (items.length >= MAXRECENTS) {
28684         items.pop();
28685       }
28686       items.unshift(item);
28687       setRecents(items);
28688     };
28689     function setFavorites(items) {
28690       _favorites = items;
28691       const minifiedItems = items.map((d2) => d2.minified());
28692       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
28693       dispatch14.call("favoritePreset");
28694     }
28695     _this.addFavorite = (preset, besidePreset, after) => {
28696       const favorites = _this.getFavorites();
28697       const beforeItem = _this.favoriteMatching(besidePreset);
28698       let toIndex = favorites.indexOf(beforeItem);
28699       if (after) toIndex += 1;
28700       const newItem = RibbonItem(preset, "favorite");
28701       favorites.splice(toIndex, 0, newItem);
28702       setFavorites(favorites);
28703     };
28704     _this.toggleFavorite = (preset) => {
28705       const favs = _this.getFavorites();
28706       const favorite = _this.favoriteMatching(preset);
28707       if (favorite) {
28708         favs.splice(favs.indexOf(favorite), 1);
28709       } else {
28710         if (favs.length === 10) {
28711           favs.pop();
28712         }
28713         favs.push(RibbonItem(preset, "favorite"));
28714       }
28715       setFavorites(favs);
28716     };
28717     _this.removeFavorite = (preset) => {
28718       const item = _this.favoriteMatching(preset);
28719       if (item) {
28720         const items = _this.getFavorites();
28721         items.splice(items.indexOf(item), 1);
28722         setFavorites(items);
28723       }
28724     };
28725     _this.getFavorites = () => {
28726       if (!_favorites) {
28727         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
28728         if (!rawFavorites) {
28729           rawFavorites = [];
28730           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
28731         }
28732         _favorites = rawFavorites.reduce((output, d2) => {
28733           const item = ribbonItemForMinified(d2, "favorite");
28734           if (item && item.preset.addable()) output.push(item);
28735           return output;
28736         }, []);
28737       }
28738       return _favorites;
28739     };
28740     _this.favoriteMatching = (preset) => {
28741       const favs = _this.getFavorites();
28742       for (let index in favs) {
28743         if (favs[index].matches(preset)) {
28744           return favs[index];
28745         }
28746       }
28747       return null;
28748     };
28749     return utilRebind(_this, dispatch14, "on");
28750   }
28751   var _mainPresetIndex;
28752   var init_presets = __esm({
28753     "modules/presets/index.js"() {
28754       "use strict";
28755       init_src4();
28756       init_preferences();
28757       init_file_fetcher();
28758       init_LocationManager();
28759       init_tags();
28760       init_category();
28761       init_collection();
28762       init_field();
28763       init_preset();
28764       init_util();
28765       _mainPresetIndex = presetIndex();
28766     }
28767   });
28768
28769   // modules/behavior/edit.js
28770   var edit_exports = {};
28771   __export(edit_exports, {
28772     behaviorEdit: () => behaviorEdit
28773   });
28774   function behaviorEdit(context) {
28775     function behavior() {
28776       context.map().minzoom(context.minEditableZoom());
28777     }
28778     behavior.off = function() {
28779       context.map().minzoom(0);
28780     };
28781     return behavior;
28782   }
28783   var init_edit = __esm({
28784     "modules/behavior/edit.js"() {
28785       "use strict";
28786     }
28787   });
28788
28789   // modules/behavior/hover.js
28790   var hover_exports = {};
28791   __export(hover_exports, {
28792     behaviorHover: () => behaviorHover
28793   });
28794   function behaviorHover(context) {
28795     var dispatch14 = dispatch_default("hover");
28796     var _selection = select_default2(null);
28797     var _newNodeId = null;
28798     var _initialNodeID = null;
28799     var _altDisables;
28800     var _ignoreVertex;
28801     var _targets = [];
28802     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
28803     function keydown(d3_event) {
28804       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
28805         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
28806         _selection.classed("hover-disabled", true);
28807         dispatch14.call("hover", this, null);
28808       }
28809     }
28810     function keyup(d3_event) {
28811       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
28812         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
28813         _selection.classed("hover-disabled", false);
28814         dispatch14.call("hover", this, _targets);
28815       }
28816     }
28817     function behavior(selection2) {
28818       _selection = selection2;
28819       _targets = [];
28820       if (_initialNodeID) {
28821         _newNodeId = _initialNodeID;
28822         _initialNodeID = null;
28823       } else {
28824         _newNodeId = null;
28825       }
28826       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
28827       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
28828       function eventTarget(d3_event) {
28829         var datum2 = d3_event.target && d3_event.target.__data__;
28830         if (typeof datum2 !== "object") return null;
28831         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
28832           return datum2.properties.entity;
28833         }
28834         return datum2;
28835       }
28836       function pointerover(d3_event) {
28837         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons) return;
28838         var target = eventTarget(d3_event);
28839         if (target && _targets.indexOf(target) === -1) {
28840           _targets.push(target);
28841           updateHover(d3_event, _targets);
28842         }
28843       }
28844       function pointerout(d3_event) {
28845         var target = eventTarget(d3_event);
28846         var index = _targets.indexOf(target);
28847         if (index !== -1) {
28848           _targets.splice(index);
28849           updateHover(d3_event, _targets);
28850         }
28851       }
28852       function allowsVertex(d2) {
28853         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
28854       }
28855       function modeAllowsHover(target) {
28856         var mode = context.mode();
28857         if (mode.id === "add-point") {
28858           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
28859         }
28860         return true;
28861       }
28862       function updateHover(d3_event, targets) {
28863         _selection.selectAll(".hover").classed("hover", false);
28864         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
28865         var mode = context.mode();
28866         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
28867           var node = targets.find(function(target) {
28868             return target instanceof osmEntity && target.type === "node";
28869           });
28870           _newNodeId = node && node.id;
28871         }
28872         targets = targets.filter(function(datum3) {
28873           if (datum3 instanceof osmEntity) {
28874             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
28875           }
28876           return true;
28877         });
28878         var selector = "";
28879         for (var i3 in targets) {
28880           var datum2 = targets[i3];
28881           if (datum2.__featurehash__) {
28882             selector += ", .data" + datum2.__featurehash__;
28883           } else if (datum2 instanceof QAItem) {
28884             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
28885           } else if (datum2 instanceof osmNote) {
28886             selector += ", .note-" + datum2.id;
28887           } else if (datum2 instanceof osmEntity) {
28888             selector += ", ." + datum2.id;
28889             if (datum2.type === "relation") {
28890               for (var j3 in datum2.members) {
28891                 selector += ", ." + datum2.members[j3].id;
28892               }
28893             }
28894           }
28895         }
28896         var suppressed = _altDisables && d3_event && d3_event.altKey;
28897         if (selector.trim().length) {
28898           selector = selector.slice(1);
28899           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
28900         }
28901         dispatch14.call("hover", this, !suppressed && targets);
28902       }
28903     }
28904     behavior.off = function(selection2) {
28905       selection2.selectAll(".hover").classed("hover", false);
28906       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
28907       selection2.classed("hover-disabled", false);
28908       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
28909       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
28910     };
28911     behavior.altDisables = function(val) {
28912       if (!arguments.length) return _altDisables;
28913       _altDisables = val;
28914       return behavior;
28915     };
28916     behavior.ignoreVertex = function(val) {
28917       if (!arguments.length) return _ignoreVertex;
28918       _ignoreVertex = val;
28919       return behavior;
28920     };
28921     behavior.initialNodeID = function(nodeId) {
28922       _initialNodeID = nodeId;
28923       return behavior;
28924     };
28925     return utilRebind(behavior, dispatch14, "on");
28926   }
28927   var init_hover = __esm({
28928     "modules/behavior/hover.js"() {
28929       "use strict";
28930       init_src4();
28931       init_src5();
28932       init_presets();
28933       init_osm();
28934       init_util();
28935     }
28936   });
28937
28938   // modules/behavior/draw.js
28939   var draw_exports = {};
28940   __export(draw_exports, {
28941     behaviorDraw: () => behaviorDraw
28942   });
28943   function behaviorDraw(context) {
28944     var dispatch14 = dispatch_default(
28945       "move",
28946       "down",
28947       "downcancel",
28948       "click",
28949       "clickWay",
28950       "clickNode",
28951       "undo",
28952       "cancel",
28953       "finish"
28954     );
28955     var keybinding = utilKeybinding("draw");
28956     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
28957     var _edit = behaviorEdit(context);
28958     var _closeTolerance = 4;
28959     var _tolerance = 12;
28960     var _mouseLeave = false;
28961     var _lastMouse = null;
28962     var _lastPointerUpEvent;
28963     var _downPointer;
28964     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
28965     function datum2(d3_event) {
28966       var mode = context.mode();
28967       var isNote = mode && mode.id.indexOf("note") !== -1;
28968       if (d3_event.altKey || isNote) return {};
28969       var element;
28970       if (d3_event.type === "keydown") {
28971         element = _lastMouse && _lastMouse.target;
28972       } else {
28973         element = d3_event.target;
28974       }
28975       var d2 = element.__data__;
28976       return d2 && d2.properties && d2.properties.target ? d2 : {};
28977     }
28978     function pointerdown(d3_event) {
28979       if (_downPointer) return;
28980       var pointerLocGetter = utilFastMouse(this);
28981       _downPointer = {
28982         id: d3_event.pointerId || "mouse",
28983         pointerLocGetter,
28984         downTime: +/* @__PURE__ */ new Date(),
28985         downLoc: pointerLocGetter(d3_event)
28986       };
28987       dispatch14.call("down", this, d3_event, datum2(d3_event));
28988     }
28989     function pointerup(d3_event) {
28990       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse")) return;
28991       var downPointer = _downPointer;
28992       _downPointer = null;
28993       _lastPointerUpEvent = d3_event;
28994       if (downPointer.isCancelled) return;
28995       var t2 = +/* @__PURE__ */ new Date();
28996       var p2 = downPointer.pointerLocGetter(d3_event);
28997       var dist = geoVecLength(downPointer.downLoc, p2);
28998       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
28999         select_default2(window).on("click.draw-block", function() {
29000           d3_event.stopPropagation();
29001         }, true);
29002         context.map().dblclickZoomEnable(false);
29003         window.setTimeout(function() {
29004           context.map().dblclickZoomEnable(true);
29005           select_default2(window).on("click.draw-block", null);
29006         }, 500);
29007         click(d3_event, p2);
29008       }
29009     }
29010     function pointermove(d3_event) {
29011       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
29012         var p2 = _downPointer.pointerLocGetter(d3_event);
29013         var dist = geoVecLength(_downPointer.downLoc, p2);
29014         if (dist >= _closeTolerance) {
29015           _downPointer.isCancelled = true;
29016           dispatch14.call("downcancel", this);
29017         }
29018       }
29019       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer) return;
29020       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return;
29021       _lastMouse = d3_event;
29022       dispatch14.call("move", this, d3_event, datum2(d3_event));
29023     }
29024     function pointercancel(d3_event) {
29025       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
29026         if (!_downPointer.isCancelled) {
29027           dispatch14.call("downcancel", this);
29028         }
29029         _downPointer = null;
29030       }
29031     }
29032     function mouseenter() {
29033       _mouseLeave = false;
29034     }
29035     function mouseleave() {
29036       _mouseLeave = true;
29037     }
29038     function allowsVertex(d2) {
29039       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
29040     }
29041     function click(d3_event, loc) {
29042       var d2 = datum2(d3_event);
29043       var target = d2 && d2.properties && d2.properties.entity;
29044       var mode = context.mode();
29045       if (target && target.type === "node" && allowsVertex(target)) {
29046         dispatch14.call("clickNode", this, target, d2);
29047         return;
29048       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
29049         var choice = geoChooseEdge(
29050           context.graph().childNodes(target),
29051           loc,
29052           context.projection,
29053           context.activeID()
29054         );
29055         if (choice) {
29056           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
29057           dispatch14.call("clickWay", this, choice.loc, edge, d2);
29058           return;
29059         }
29060       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
29061         var locLatLng = context.projection.invert(loc);
29062         dispatch14.call("click", this, locLatLng, d2);
29063       }
29064     }
29065     function space(d3_event) {
29066       d3_event.preventDefault();
29067       d3_event.stopPropagation();
29068       var currSpace = context.map().mouse();
29069       if (_disableSpace && _lastSpace) {
29070         var dist = geoVecLength(_lastSpace, currSpace);
29071         if (dist > _tolerance) {
29072           _disableSpace = false;
29073         }
29074       }
29075       if (_disableSpace || _mouseLeave || !_lastMouse) return;
29076       _lastSpace = currSpace;
29077       _disableSpace = true;
29078       select_default2(window).on("keyup.space-block", function() {
29079         d3_event.preventDefault();
29080         d3_event.stopPropagation();
29081         _disableSpace = false;
29082         select_default2(window).on("keyup.space-block", null);
29083       });
29084       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
29085       context.projection(context.map().center());
29086       click(d3_event, loc);
29087     }
29088     function backspace(d3_event) {
29089       d3_event.preventDefault();
29090       dispatch14.call("undo");
29091     }
29092     function del(d3_event) {
29093       d3_event.preventDefault();
29094       dispatch14.call("cancel");
29095     }
29096     function ret(d3_event) {
29097       d3_event.preventDefault();
29098       dispatch14.call("finish");
29099     }
29100     function behavior(selection2) {
29101       context.install(_hover);
29102       context.install(_edit);
29103       _downPointer = null;
29104       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
29105       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
29106       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
29107       select_default2(document).call(keybinding);
29108       return behavior;
29109     }
29110     behavior.off = function(selection2) {
29111       context.ui().sidebar.hover.cancel();
29112       context.uninstall(_hover);
29113       context.uninstall(_edit);
29114       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
29115       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
29116       select_default2(document).call(keybinding.unbind);
29117     };
29118     behavior.hover = function() {
29119       return _hover;
29120     };
29121     return utilRebind(behavior, dispatch14, "on");
29122   }
29123   var _disableSpace, _lastSpace;
29124   var init_draw = __esm({
29125     "modules/behavior/draw.js"() {
29126       "use strict";
29127       init_src4();
29128       init_src5();
29129       init_presets();
29130       init_edit();
29131       init_hover();
29132       init_geo2();
29133       init_util();
29134       _disableSpace = false;
29135       _lastSpace = null;
29136     }
29137   });
29138
29139   // node_modules/d3-scale/src/init.js
29140   function initRange(domain, range3) {
29141     switch (arguments.length) {
29142       case 0:
29143         break;
29144       case 1:
29145         this.range(domain);
29146         break;
29147       default:
29148         this.range(range3).domain(domain);
29149         break;
29150     }
29151     return this;
29152   }
29153   var init_init = __esm({
29154     "node_modules/d3-scale/src/init.js"() {
29155     }
29156   });
29157
29158   // node_modules/d3-scale/src/constant.js
29159   function constants(x2) {
29160     return function() {
29161       return x2;
29162     };
29163   }
29164   var init_constant6 = __esm({
29165     "node_modules/d3-scale/src/constant.js"() {
29166     }
29167   });
29168
29169   // node_modules/d3-scale/src/number.js
29170   function number2(x2) {
29171     return +x2;
29172   }
29173   var init_number3 = __esm({
29174     "node_modules/d3-scale/src/number.js"() {
29175     }
29176   });
29177
29178   // node_modules/d3-scale/src/continuous.js
29179   function identity4(x2) {
29180     return x2;
29181   }
29182   function normalize(a4, b3) {
29183     return (b3 -= a4 = +a4) ? function(x2) {
29184       return (x2 - a4) / b3;
29185     } : constants(isNaN(b3) ? NaN : 0.5);
29186   }
29187   function clamper(a4, b3) {
29188     var t2;
29189     if (a4 > b3) t2 = a4, a4 = b3, b3 = t2;
29190     return function(x2) {
29191       return Math.max(a4, Math.min(b3, x2));
29192     };
29193   }
29194   function bimap(domain, range3, interpolate) {
29195     var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
29196     if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
29197     else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
29198     return function(x2) {
29199       return r0(d0(x2));
29200     };
29201   }
29202   function polymap(domain, range3, interpolate) {
29203     var j3 = Math.min(domain.length, range3.length) - 1, d2 = new Array(j3), r2 = new Array(j3), i3 = -1;
29204     if (domain[j3] < domain[0]) {
29205       domain = domain.slice().reverse();
29206       range3 = range3.slice().reverse();
29207     }
29208     while (++i3 < j3) {
29209       d2[i3] = normalize(domain[i3], domain[i3 + 1]);
29210       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
29211     }
29212     return function(x2) {
29213       var i4 = bisect_default(domain, x2, 1, j3) - 1;
29214       return r2[i4](d2[i4](x2));
29215     };
29216   }
29217   function copy(source, target) {
29218     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
29219   }
29220   function transformer2() {
29221     var domain = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp2 = identity4, piecewise, output, input;
29222     function rescale() {
29223       var n3 = Math.min(domain.length, range3.length);
29224       if (clamp2 !== identity4) clamp2 = clamper(domain[0], domain[n3 - 1]);
29225       piecewise = n3 > 2 ? polymap : bimap;
29226       output = input = null;
29227       return scale;
29228     }
29229     function scale(x2) {
29230       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain.map(transform2), range3, interpolate)))(transform2(clamp2(x2)));
29231     }
29232     scale.invert = function(y2) {
29233       return clamp2(untransform((input || (input = piecewise(range3, domain.map(transform2), number_default)))(y2)));
29234     };
29235     scale.domain = function(_3) {
29236       return arguments.length ? (domain = Array.from(_3, number2), rescale()) : domain.slice();
29237     };
29238     scale.range = function(_3) {
29239       return arguments.length ? (range3 = Array.from(_3), rescale()) : range3.slice();
29240     };
29241     scale.rangeRound = function(_3) {
29242       return range3 = Array.from(_3), interpolate = round_default, rescale();
29243     };
29244     scale.clamp = function(_3) {
29245       return arguments.length ? (clamp2 = _3 ? true : identity4, rescale()) : clamp2 !== identity4;
29246     };
29247     scale.interpolate = function(_3) {
29248       return arguments.length ? (interpolate = _3, rescale()) : interpolate;
29249     };
29250     scale.unknown = function(_3) {
29251       return arguments.length ? (unknown = _3, scale) : unknown;
29252     };
29253     return function(t2, u2) {
29254       transform2 = t2, untransform = u2;
29255       return rescale();
29256     };
29257   }
29258   function continuous() {
29259     return transformer2()(identity4, identity4);
29260   }
29261   var unit;
29262   var init_continuous = __esm({
29263     "node_modules/d3-scale/src/continuous.js"() {
29264       init_src();
29265       init_src8();
29266       init_constant6();
29267       init_number3();
29268       unit = [0, 1];
29269     }
29270   });
29271
29272   // node_modules/d3-format/src/formatDecimal.js
29273   function formatDecimal_default(x2) {
29274     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
29275   }
29276   function formatDecimalParts(x2, p2) {
29277     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0) return null;
29278     var i3, coefficient = x2.slice(0, i3);
29279     return [
29280       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
29281       +x2.slice(i3 + 1)
29282     ];
29283   }
29284   var init_formatDecimal = __esm({
29285     "node_modules/d3-format/src/formatDecimal.js"() {
29286     }
29287   });
29288
29289   // node_modules/d3-format/src/exponent.js
29290   function exponent_default(x2) {
29291     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
29292   }
29293   var init_exponent = __esm({
29294     "node_modules/d3-format/src/exponent.js"() {
29295       init_formatDecimal();
29296     }
29297   });
29298
29299   // node_modules/d3-format/src/formatGroup.js
29300   function formatGroup_default(grouping, thousands) {
29301     return function(value, width) {
29302       var i3 = value.length, t2 = [], j3 = 0, g3 = grouping[0], length2 = 0;
29303       while (i3 > 0 && g3 > 0) {
29304         if (length2 + g3 + 1 > width) g3 = Math.max(1, width - length2);
29305         t2.push(value.substring(i3 -= g3, i3 + g3));
29306         if ((length2 += g3 + 1) > width) break;
29307         g3 = grouping[j3 = (j3 + 1) % grouping.length];
29308       }
29309       return t2.reverse().join(thousands);
29310     };
29311   }
29312   var init_formatGroup = __esm({
29313     "node_modules/d3-format/src/formatGroup.js"() {
29314     }
29315   });
29316
29317   // node_modules/d3-format/src/formatNumerals.js
29318   function formatNumerals_default(numerals) {
29319     return function(value) {
29320       return value.replace(/[0-9]/g, function(i3) {
29321         return numerals[+i3];
29322       });
29323     };
29324   }
29325   var init_formatNumerals = __esm({
29326     "node_modules/d3-format/src/formatNumerals.js"() {
29327     }
29328   });
29329
29330   // node_modules/d3-format/src/formatSpecifier.js
29331   function formatSpecifier(specifier) {
29332     if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
29333     var match;
29334     return new FormatSpecifier({
29335       fill: match[1],
29336       align: match[2],
29337       sign: match[3],
29338       symbol: match[4],
29339       zero: match[5],
29340       width: match[6],
29341       comma: match[7],
29342       precision: match[8] && match[8].slice(1),
29343       trim: match[9],
29344       type: match[10]
29345     });
29346   }
29347   function FormatSpecifier(specifier) {
29348     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
29349     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
29350     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
29351     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
29352     this.zero = !!specifier.zero;
29353     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
29354     this.comma = !!specifier.comma;
29355     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
29356     this.trim = !!specifier.trim;
29357     this.type = specifier.type === void 0 ? "" : specifier.type + "";
29358   }
29359   var re;
29360   var init_formatSpecifier = __esm({
29361     "node_modules/d3-format/src/formatSpecifier.js"() {
29362       re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
29363       formatSpecifier.prototype = FormatSpecifier.prototype;
29364       FormatSpecifier.prototype.toString = function() {
29365         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;
29366       };
29367     }
29368   });
29369
29370   // node_modules/d3-format/src/formatTrim.js
29371   function formatTrim_default(s2) {
29372     out: for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
29373       switch (s2[i3]) {
29374         case ".":
29375           i0 = i1 = i3;
29376           break;
29377         case "0":
29378           if (i0 === 0) i0 = i3;
29379           i1 = i3;
29380           break;
29381         default:
29382           if (!+s2[i3]) break out;
29383           if (i0 > 0) i0 = 0;
29384           break;
29385       }
29386     }
29387     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
29388   }
29389   var init_formatTrim = __esm({
29390     "node_modules/d3-format/src/formatTrim.js"() {
29391     }
29392   });
29393
29394   // node_modules/d3-format/src/formatPrefixAuto.js
29395   function formatPrefixAuto_default(x2, p2) {
29396     var d2 = formatDecimalParts(x2, p2);
29397     if (!d2) return x2 + "";
29398     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;
29399     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];
29400   }
29401   var prefixExponent;
29402   var init_formatPrefixAuto = __esm({
29403     "node_modules/d3-format/src/formatPrefixAuto.js"() {
29404       init_formatDecimal();
29405     }
29406   });
29407
29408   // node_modules/d3-format/src/formatRounded.js
29409   function formatRounded_default(x2, p2) {
29410     var d2 = formatDecimalParts(x2, p2);
29411     if (!d2) return x2 + "";
29412     var coefficient = d2[0], exponent = d2[1];
29413     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");
29414   }
29415   var init_formatRounded = __esm({
29416     "node_modules/d3-format/src/formatRounded.js"() {
29417       init_formatDecimal();
29418     }
29419   });
29420
29421   // node_modules/d3-format/src/formatTypes.js
29422   var formatTypes_default;
29423   var init_formatTypes = __esm({
29424     "node_modules/d3-format/src/formatTypes.js"() {
29425       init_formatDecimal();
29426       init_formatPrefixAuto();
29427       init_formatRounded();
29428       formatTypes_default = {
29429         "%": (x2, p2) => (x2 * 100).toFixed(p2),
29430         "b": (x2) => Math.round(x2).toString(2),
29431         "c": (x2) => x2 + "",
29432         "d": formatDecimal_default,
29433         "e": (x2, p2) => x2.toExponential(p2),
29434         "f": (x2, p2) => x2.toFixed(p2),
29435         "g": (x2, p2) => x2.toPrecision(p2),
29436         "o": (x2) => Math.round(x2).toString(8),
29437         "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
29438         "r": formatRounded_default,
29439         "s": formatPrefixAuto_default,
29440         "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
29441         "x": (x2) => Math.round(x2).toString(16)
29442       };
29443     }
29444   });
29445
29446   // node_modules/d3-format/src/identity.js
29447   function identity_default5(x2) {
29448     return x2;
29449   }
29450   var init_identity4 = __esm({
29451     "node_modules/d3-format/src/identity.js"() {
29452     }
29453   });
29454
29455   // node_modules/d3-format/src/locale.js
29456   function locale_default(locale3) {
29457     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 + "";
29458     function newFormat(specifier) {
29459       specifier = formatSpecifier(specifier);
29460       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;
29461       if (type2 === "n") comma = true, type2 = "g";
29462       else if (!formatTypes_default[type2]) precision3 === void 0 && (precision3 = 12), trim = true, type2 = "g";
29463       if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "=";
29464       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
29465       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
29466       precision3 = precision3 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision3)) : Math.max(0, Math.min(20, precision3));
29467       function format2(value) {
29468         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
29469         if (type2 === "c") {
29470           valueSuffix = formatType(value) + valueSuffix;
29471           value = "";
29472         } else {
29473           value = +value;
29474           var valueNegative = value < 0 || 1 / value < 0;
29475           value = isNaN(value) ? nan : formatType(Math.abs(value), precision3);
29476           if (trim) value = formatTrim_default(value);
29477           if (valueNegative && +value === 0 && sign2 !== "+") valueNegative = false;
29478           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
29479           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
29480           if (maybeSuffix) {
29481             i3 = -1, n3 = value.length;
29482             while (++i3 < n3) {
29483               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
29484                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
29485                 value = value.slice(0, i3);
29486                 break;
29487               }
29488             }
29489           }
29490         }
29491         if (comma && !zero3) value = group(value, Infinity);
29492         var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
29493         if (comma && zero3) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
29494         switch (align) {
29495           case "<":
29496             value = valuePrefix + value + valueSuffix + padding;
29497             break;
29498           case "=":
29499             value = valuePrefix + padding + value + valueSuffix;
29500             break;
29501           case "^":
29502             value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
29503             break;
29504           default:
29505             value = padding + valuePrefix + value + valueSuffix;
29506             break;
29507         }
29508         return numerals(value);
29509       }
29510       format2.toString = function() {
29511         return specifier + "";
29512       };
29513       return format2;
29514     }
29515     function formatPrefix2(specifier, value) {
29516       var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k3 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
29517       return function(value2) {
29518         return f2(k3 * value2) + prefix;
29519       };
29520     }
29521     return {
29522       format: newFormat,
29523       formatPrefix: formatPrefix2
29524     };
29525   }
29526   var map, prefixes;
29527   var init_locale = __esm({
29528     "node_modules/d3-format/src/locale.js"() {
29529       init_exponent();
29530       init_formatGroup();
29531       init_formatNumerals();
29532       init_formatSpecifier();
29533       init_formatTrim();
29534       init_formatTypes();
29535       init_formatPrefixAuto();
29536       init_identity4();
29537       map = Array.prototype.map;
29538       prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
29539     }
29540   });
29541
29542   // node_modules/d3-format/src/defaultLocale.js
29543   function defaultLocale(definition) {
29544     locale = locale_default(definition);
29545     format = locale.format;
29546     formatPrefix = locale.formatPrefix;
29547     return locale;
29548   }
29549   var locale, format, formatPrefix;
29550   var init_defaultLocale = __esm({
29551     "node_modules/d3-format/src/defaultLocale.js"() {
29552       init_locale();
29553       defaultLocale({
29554         thousands: ",",
29555         grouping: [3],
29556         currency: ["$", ""]
29557       });
29558     }
29559   });
29560
29561   // node_modules/d3-format/src/precisionFixed.js
29562   function precisionFixed_default(step) {
29563     return Math.max(0, -exponent_default(Math.abs(step)));
29564   }
29565   var init_precisionFixed = __esm({
29566     "node_modules/d3-format/src/precisionFixed.js"() {
29567       init_exponent();
29568     }
29569   });
29570
29571   // node_modules/d3-format/src/precisionPrefix.js
29572   function precisionPrefix_default(step, value) {
29573     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
29574   }
29575   var init_precisionPrefix = __esm({
29576     "node_modules/d3-format/src/precisionPrefix.js"() {
29577       init_exponent();
29578     }
29579   });
29580
29581   // node_modules/d3-format/src/precisionRound.js
29582   function precisionRound_default(step, max3) {
29583     step = Math.abs(step), max3 = Math.abs(max3) - step;
29584     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
29585   }
29586   var init_precisionRound = __esm({
29587     "node_modules/d3-format/src/precisionRound.js"() {
29588       init_exponent();
29589     }
29590   });
29591
29592   // node_modules/d3-format/src/index.js
29593   var init_src13 = __esm({
29594     "node_modules/d3-format/src/index.js"() {
29595       init_defaultLocale();
29596       init_formatSpecifier();
29597       init_precisionFixed();
29598       init_precisionPrefix();
29599       init_precisionRound();
29600     }
29601   });
29602
29603   // node_modules/d3-scale/src/tickFormat.js
29604   function tickFormat(start2, stop, count, specifier) {
29605     var step = tickStep(start2, stop, count), precision3;
29606     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
29607     switch (specifier.type) {
29608       case "s": {
29609         var value = Math.max(Math.abs(start2), Math.abs(stop));
29610         if (specifier.precision == null && !isNaN(precision3 = precisionPrefix_default(step, value))) specifier.precision = precision3;
29611         return formatPrefix(specifier, value);
29612       }
29613       case "":
29614       case "e":
29615       case "g":
29616       case "p":
29617       case "r": {
29618         if (specifier.precision == null && !isNaN(precision3 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop))))) specifier.precision = precision3 - (specifier.type === "e");
29619         break;
29620       }
29621       case "f":
29622       case "%": {
29623         if (specifier.precision == null && !isNaN(precision3 = precisionFixed_default(step))) specifier.precision = precision3 - (specifier.type === "%") * 2;
29624         break;
29625       }
29626     }
29627     return format(specifier);
29628   }
29629   var init_tickFormat = __esm({
29630     "node_modules/d3-scale/src/tickFormat.js"() {
29631       init_src();
29632       init_src13();
29633     }
29634   });
29635
29636   // node_modules/d3-scale/src/linear.js
29637   function linearish(scale) {
29638     var domain = scale.domain;
29639     scale.ticks = function(count) {
29640       var d2 = domain();
29641       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
29642     };
29643     scale.tickFormat = function(count, specifier) {
29644       var d2 = domain();
29645       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
29646     };
29647     scale.nice = function(count) {
29648       if (count == null) count = 10;
29649       var d2 = domain();
29650       var i0 = 0;
29651       var i1 = d2.length - 1;
29652       var start2 = d2[i0];
29653       var stop = d2[i1];
29654       var prestep;
29655       var step;
29656       var maxIter = 10;
29657       if (stop < start2) {
29658         step = start2, start2 = stop, stop = step;
29659         step = i0, i0 = i1, i1 = step;
29660       }
29661       while (maxIter-- > 0) {
29662         step = tickIncrement(start2, stop, count);
29663         if (step === prestep) {
29664           d2[i0] = start2;
29665           d2[i1] = stop;
29666           return domain(d2);
29667         } else if (step > 0) {
29668           start2 = Math.floor(start2 / step) * step;
29669           stop = Math.ceil(stop / step) * step;
29670         } else if (step < 0) {
29671           start2 = Math.ceil(start2 * step) / step;
29672           stop = Math.floor(stop * step) / step;
29673         } else {
29674           break;
29675         }
29676         prestep = step;
29677       }
29678       return scale;
29679     };
29680     return scale;
29681   }
29682   function linear3() {
29683     var scale = continuous();
29684     scale.copy = function() {
29685       return copy(scale, linear3());
29686     };
29687     initRange.apply(scale, arguments);
29688     return linearish(scale);
29689   }
29690   var init_linear2 = __esm({
29691     "node_modules/d3-scale/src/linear.js"() {
29692       init_src();
29693       init_continuous();
29694       init_init();
29695       init_tickFormat();
29696     }
29697   });
29698
29699   // node_modules/d3-scale/src/quantize.js
29700   function quantize() {
29701     var x05 = 0, x12 = 1, n3 = 1, domain = [0.5], range3 = [0, 1], unknown;
29702     function scale(x2) {
29703       return x2 != null && x2 <= x2 ? range3[bisect_default(domain, x2, 0, n3)] : unknown;
29704     }
29705     function rescale() {
29706       var i3 = -1;
29707       domain = new Array(n3);
29708       while (++i3 < n3) domain[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
29709       return scale;
29710     }
29711     scale.domain = function(_3) {
29712       return arguments.length ? ([x05, x12] = _3, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
29713     };
29714     scale.range = function(_3) {
29715       return arguments.length ? (n3 = (range3 = Array.from(_3)).length - 1, rescale()) : range3.slice();
29716     };
29717     scale.invertExtent = function(y2) {
29718       var i3 = range3.indexOf(y2);
29719       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain[0]] : i3 >= n3 ? [domain[n3 - 1], x12] : [domain[i3 - 1], domain[i3]];
29720     };
29721     scale.unknown = function(_3) {
29722       return arguments.length ? (unknown = _3, scale) : scale;
29723     };
29724     scale.thresholds = function() {
29725       return domain.slice();
29726     };
29727     scale.copy = function() {
29728       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
29729     };
29730     return initRange.apply(linearish(scale), arguments);
29731   }
29732   var init_quantize2 = __esm({
29733     "node_modules/d3-scale/src/quantize.js"() {
29734       init_src();
29735       init_linear2();
29736       init_init();
29737     }
29738   });
29739
29740   // node_modules/d3-time/src/interval.js
29741   function timeInterval(floori, offseti, count, field) {
29742     function interval2(date) {
29743       return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date;
29744     }
29745     interval2.floor = (date) => {
29746       return floori(date = /* @__PURE__ */ new Date(+date)), date;
29747     };
29748     interval2.ceil = (date) => {
29749       return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
29750     };
29751     interval2.round = (date) => {
29752       const d0 = interval2(date), d1 = interval2.ceil(date);
29753       return date - d0 < d1 - date ? d0 : d1;
29754     };
29755     interval2.offset = (date, step) => {
29756       return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date;
29757     };
29758     interval2.range = (start2, stop, step) => {
29759       const range3 = [];
29760       start2 = interval2.ceil(start2);
29761       step = step == null ? 1 : Math.floor(step);
29762       if (!(start2 < stop) || !(step > 0)) return range3;
29763       let previous;
29764       do
29765         range3.push(previous = /* @__PURE__ */ new Date(+start2)), offseti(start2, step), floori(start2);
29766       while (previous < start2 && start2 < stop);
29767       return range3;
29768     };
29769     interval2.filter = (test) => {
29770       return timeInterval((date) => {
29771         if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
29772       }, (date, step) => {
29773         if (date >= date) {
29774           if (step < 0) while (++step <= 0) {
29775             while (offseti(date, -1), !test(date)) {
29776             }
29777           }
29778           else while (--step >= 0) {
29779             while (offseti(date, 1), !test(date)) {
29780             }
29781           }
29782         }
29783       });
29784     };
29785     if (count) {
29786       interval2.count = (start2, end) => {
29787         t0.setTime(+start2), t1.setTime(+end);
29788         floori(t0), floori(t1);
29789         return Math.floor(count(t0, t1));
29790       };
29791       interval2.every = (step) => {
29792         step = Math.floor(step);
29793         return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field ? (d2) => field(d2) % step === 0 : (d2) => interval2.count(0, d2) % step === 0);
29794       };
29795     }
29796     return interval2;
29797   }
29798   var t0, t1;
29799   var init_interval = __esm({
29800     "node_modules/d3-time/src/interval.js"() {
29801       t0 = /* @__PURE__ */ new Date();
29802       t1 = /* @__PURE__ */ new Date();
29803     }
29804   });
29805
29806   // node_modules/d3-time/src/duration.js
29807   var durationSecond, durationMinute, durationHour, durationDay, durationWeek, durationMonth, durationYear;
29808   var init_duration2 = __esm({
29809     "node_modules/d3-time/src/duration.js"() {
29810       durationSecond = 1e3;
29811       durationMinute = durationSecond * 60;
29812       durationHour = durationMinute * 60;
29813       durationDay = durationHour * 24;
29814       durationWeek = durationDay * 7;
29815       durationMonth = durationDay * 30;
29816       durationYear = durationDay * 365;
29817     }
29818   });
29819
29820   // node_modules/d3-time/src/day.js
29821   var timeDay, timeDays, utcDay, utcDays, unixDay, unixDays;
29822   var init_day = __esm({
29823     "node_modules/d3-time/src/day.js"() {
29824       init_interval();
29825       init_duration2();
29826       timeDay = timeInterval(
29827         (date) => date.setHours(0, 0, 0, 0),
29828         (date, step) => date.setDate(date.getDate() + step),
29829         (start2, end) => (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationDay,
29830         (date) => date.getDate() - 1
29831       );
29832       timeDays = timeDay.range;
29833       utcDay = timeInterval((date) => {
29834         date.setUTCHours(0, 0, 0, 0);
29835       }, (date, step) => {
29836         date.setUTCDate(date.getUTCDate() + step);
29837       }, (start2, end) => {
29838         return (end - start2) / durationDay;
29839       }, (date) => {
29840         return date.getUTCDate() - 1;
29841       });
29842       utcDays = utcDay.range;
29843       unixDay = timeInterval((date) => {
29844         date.setUTCHours(0, 0, 0, 0);
29845       }, (date, step) => {
29846         date.setUTCDate(date.getUTCDate() + step);
29847       }, (start2, end) => {
29848         return (end - start2) / durationDay;
29849       }, (date) => {
29850         return Math.floor(date / durationDay);
29851       });
29852       unixDays = unixDay.range;
29853     }
29854   });
29855
29856   // node_modules/d3-time/src/week.js
29857   function timeWeekday(i3) {
29858     return timeInterval((date) => {
29859       date.setDate(date.getDate() - (date.getDay() + 7 - i3) % 7);
29860       date.setHours(0, 0, 0, 0);
29861     }, (date, step) => {
29862       date.setDate(date.getDate() + step * 7);
29863     }, (start2, end) => {
29864       return (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationWeek;
29865     });
29866   }
29867   function utcWeekday(i3) {
29868     return timeInterval((date) => {
29869       date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i3) % 7);
29870       date.setUTCHours(0, 0, 0, 0);
29871     }, (date, step) => {
29872       date.setUTCDate(date.getUTCDate() + step * 7);
29873     }, (start2, end) => {
29874       return (end - start2) / durationWeek;
29875     });
29876   }
29877   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;
29878   var init_week = __esm({
29879     "node_modules/d3-time/src/week.js"() {
29880       init_interval();
29881       init_duration2();
29882       timeSunday = timeWeekday(0);
29883       timeMonday = timeWeekday(1);
29884       timeTuesday = timeWeekday(2);
29885       timeWednesday = timeWeekday(3);
29886       timeThursday = timeWeekday(4);
29887       timeFriday = timeWeekday(5);
29888       timeSaturday = timeWeekday(6);
29889       timeSundays = timeSunday.range;
29890       timeMondays = timeMonday.range;
29891       timeTuesdays = timeTuesday.range;
29892       timeWednesdays = timeWednesday.range;
29893       timeThursdays = timeThursday.range;
29894       timeFridays = timeFriday.range;
29895       timeSaturdays = timeSaturday.range;
29896       utcSunday = utcWeekday(0);
29897       utcMonday = utcWeekday(1);
29898       utcTuesday = utcWeekday(2);
29899       utcWednesday = utcWeekday(3);
29900       utcThursday = utcWeekday(4);
29901       utcFriday = utcWeekday(5);
29902       utcSaturday = utcWeekday(6);
29903       utcSundays = utcSunday.range;
29904       utcMondays = utcMonday.range;
29905       utcTuesdays = utcTuesday.range;
29906       utcWednesdays = utcWednesday.range;
29907       utcThursdays = utcThursday.range;
29908       utcFridays = utcFriday.range;
29909       utcSaturdays = utcSaturday.range;
29910     }
29911   });
29912
29913   // node_modules/d3-time/src/year.js
29914   var timeYear, timeYears, utcYear, utcYears;
29915   var init_year = __esm({
29916     "node_modules/d3-time/src/year.js"() {
29917       init_interval();
29918       timeYear = timeInterval((date) => {
29919         date.setMonth(0, 1);
29920         date.setHours(0, 0, 0, 0);
29921       }, (date, step) => {
29922         date.setFullYear(date.getFullYear() + step);
29923       }, (start2, end) => {
29924         return end.getFullYear() - start2.getFullYear();
29925       }, (date) => {
29926         return date.getFullYear();
29927       });
29928       timeYear.every = (k3) => {
29929         return !isFinite(k3 = Math.floor(k3)) || !(k3 > 0) ? null : timeInterval((date) => {
29930           date.setFullYear(Math.floor(date.getFullYear() / k3) * k3);
29931           date.setMonth(0, 1);
29932           date.setHours(0, 0, 0, 0);
29933         }, (date, step) => {
29934           date.setFullYear(date.getFullYear() + step * k3);
29935         });
29936       };
29937       timeYears = timeYear.range;
29938       utcYear = timeInterval((date) => {
29939         date.setUTCMonth(0, 1);
29940         date.setUTCHours(0, 0, 0, 0);
29941       }, (date, step) => {
29942         date.setUTCFullYear(date.getUTCFullYear() + step);
29943       }, (start2, end) => {
29944         return end.getUTCFullYear() - start2.getUTCFullYear();
29945       }, (date) => {
29946         return date.getUTCFullYear();
29947       });
29948       utcYear.every = (k3) => {
29949         return !isFinite(k3 = Math.floor(k3)) || !(k3 > 0) ? null : timeInterval((date) => {
29950           date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k3) * k3);
29951           date.setUTCMonth(0, 1);
29952           date.setUTCHours(0, 0, 0, 0);
29953         }, (date, step) => {
29954           date.setUTCFullYear(date.getUTCFullYear() + step * k3);
29955         });
29956       };
29957       utcYears = utcYear.range;
29958     }
29959   });
29960
29961   // node_modules/d3-time/src/index.js
29962   var init_src14 = __esm({
29963     "node_modules/d3-time/src/index.js"() {
29964       init_day();
29965       init_week();
29966       init_year();
29967     }
29968   });
29969
29970   // node_modules/d3-time-format/src/locale.js
29971   function localDate(d2) {
29972     if (0 <= d2.y && d2.y < 100) {
29973       var date = new Date(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
29974       date.setFullYear(d2.y);
29975       return date;
29976     }
29977     return new Date(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
29978   }
29979   function utcDate(d2) {
29980     if (0 <= d2.y && d2.y < 100) {
29981       var date = new Date(Date.UTC(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
29982       date.setUTCFullYear(d2.y);
29983       return date;
29984     }
29985     return new Date(Date.UTC(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
29986   }
29987   function newDate(y2, m3, d2) {
29988     return { y: y2, m: m3, d: d2, H: 0, M: 0, S: 0, L: 0 };
29989   }
29990   function formatLocale(locale3) {
29991     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;
29992     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);
29993     var formats = {
29994       "a": formatShortWeekday,
29995       "A": formatWeekday,
29996       "b": formatShortMonth,
29997       "B": formatMonth,
29998       "c": null,
29999       "d": formatDayOfMonth,
30000       "e": formatDayOfMonth,
30001       "f": formatMicroseconds,
30002       "g": formatYearISO,
30003       "G": formatFullYearISO,
30004       "H": formatHour24,
30005       "I": formatHour12,
30006       "j": formatDayOfYear,
30007       "L": formatMilliseconds,
30008       "m": formatMonthNumber,
30009       "M": formatMinutes,
30010       "p": formatPeriod,
30011       "q": formatQuarter,
30012       "Q": formatUnixTimestamp,
30013       "s": formatUnixTimestampSeconds,
30014       "S": formatSeconds,
30015       "u": formatWeekdayNumberMonday,
30016       "U": formatWeekNumberSunday,
30017       "V": formatWeekNumberISO,
30018       "w": formatWeekdayNumberSunday,
30019       "W": formatWeekNumberMonday,
30020       "x": null,
30021       "X": null,
30022       "y": formatYear,
30023       "Y": formatFullYear,
30024       "Z": formatZone,
30025       "%": formatLiteralPercent
30026     };
30027     var utcFormats = {
30028       "a": formatUTCShortWeekday,
30029       "A": formatUTCWeekday,
30030       "b": formatUTCShortMonth,
30031       "B": formatUTCMonth,
30032       "c": null,
30033       "d": formatUTCDayOfMonth,
30034       "e": formatUTCDayOfMonth,
30035       "f": formatUTCMicroseconds,
30036       "g": formatUTCYearISO,
30037       "G": formatUTCFullYearISO,
30038       "H": formatUTCHour24,
30039       "I": formatUTCHour12,
30040       "j": formatUTCDayOfYear,
30041       "L": formatUTCMilliseconds,
30042       "m": formatUTCMonthNumber,
30043       "M": formatUTCMinutes,
30044       "p": formatUTCPeriod,
30045       "q": formatUTCQuarter,
30046       "Q": formatUnixTimestamp,
30047       "s": formatUnixTimestampSeconds,
30048       "S": formatUTCSeconds,
30049       "u": formatUTCWeekdayNumberMonday,
30050       "U": formatUTCWeekNumberSunday,
30051       "V": formatUTCWeekNumberISO,
30052       "w": formatUTCWeekdayNumberSunday,
30053       "W": formatUTCWeekNumberMonday,
30054       "x": null,
30055       "X": null,
30056       "y": formatUTCYear,
30057       "Y": formatUTCFullYear,
30058       "Z": formatUTCZone,
30059       "%": formatLiteralPercent
30060     };
30061     var parses = {
30062       "a": parseShortWeekday,
30063       "A": parseWeekday,
30064       "b": parseShortMonth,
30065       "B": parseMonth,
30066       "c": parseLocaleDateTime,
30067       "d": parseDayOfMonth,
30068       "e": parseDayOfMonth,
30069       "f": parseMicroseconds,
30070       "g": parseYear,
30071       "G": parseFullYear,
30072       "H": parseHour24,
30073       "I": parseHour24,
30074       "j": parseDayOfYear,
30075       "L": parseMilliseconds,
30076       "m": parseMonthNumber,
30077       "M": parseMinutes,
30078       "p": parsePeriod,
30079       "q": parseQuarter,
30080       "Q": parseUnixTimestamp,
30081       "s": parseUnixTimestampSeconds,
30082       "S": parseSeconds,
30083       "u": parseWeekdayNumberMonday,
30084       "U": parseWeekNumberSunday,
30085       "V": parseWeekNumberISO,
30086       "w": parseWeekdayNumberSunday,
30087       "W": parseWeekNumberMonday,
30088       "x": parseLocaleDate,
30089       "X": parseLocaleTime,
30090       "y": parseYear,
30091       "Y": parseFullYear,
30092       "Z": parseZone,
30093       "%": parseLiteralPercent
30094     };
30095     formats.x = newFormat(locale_date, formats);
30096     formats.X = newFormat(locale_time, formats);
30097     formats.c = newFormat(locale_dateTime, formats);
30098     utcFormats.x = newFormat(locale_date, utcFormats);
30099     utcFormats.X = newFormat(locale_time, utcFormats);
30100     utcFormats.c = newFormat(locale_dateTime, utcFormats);
30101     function newFormat(specifier, formats2) {
30102       return function(date) {
30103         var string = [], i3 = -1, j3 = 0, n3 = specifier.length, c2, pad3, format2;
30104         if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date);
30105         while (++i3 < n3) {
30106           if (specifier.charCodeAt(i3) === 37) {
30107             string.push(specifier.slice(j3, i3));
30108             if ((pad3 = pads[c2 = specifier.charAt(++i3)]) != null) c2 = specifier.charAt(++i3);
30109             else pad3 = c2 === "e" ? " " : "0";
30110             if (format2 = formats2[c2]) c2 = format2(date, pad3);
30111             string.push(c2);
30112             j3 = i3 + 1;
30113           }
30114         }
30115         string.push(specifier.slice(j3, i3));
30116         return string.join("");
30117       };
30118     }
30119     function newParse(specifier, Z3) {
30120       return function(string) {
30121         var d2 = newDate(1900, void 0, 1), i3 = parseSpecifier(d2, specifier, string += "", 0), week, day;
30122         if (i3 != string.length) return null;
30123         if ("Q" in d2) return new Date(d2.Q);
30124         if ("s" in d2) return new Date(d2.s * 1e3 + ("L" in d2 ? d2.L : 0));
30125         if (Z3 && !("Z" in d2)) d2.Z = 0;
30126         if ("p" in d2) d2.H = d2.H % 12 + d2.p * 12;
30127         if (d2.m === void 0) d2.m = "q" in d2 ? d2.q : 0;
30128         if ("V" in d2) {
30129           if (d2.V < 1 || d2.V > 53) return null;
30130           if (!("w" in d2)) d2.w = 1;
30131           if ("Z" in d2) {
30132             week = utcDate(newDate(d2.y, 0, 1)), day = week.getUTCDay();
30133             week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
30134             week = utcDay.offset(week, (d2.V - 1) * 7);
30135             d2.y = week.getUTCFullYear();
30136             d2.m = week.getUTCMonth();
30137             d2.d = week.getUTCDate() + (d2.w + 6) % 7;
30138           } else {
30139             week = localDate(newDate(d2.y, 0, 1)), day = week.getDay();
30140             week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
30141             week = timeDay.offset(week, (d2.V - 1) * 7);
30142             d2.y = week.getFullYear();
30143             d2.m = week.getMonth();
30144             d2.d = week.getDate() + (d2.w + 6) % 7;
30145           }
30146         } else if ("W" in d2 || "U" in d2) {
30147           if (!("w" in d2)) d2.w = "u" in d2 ? d2.u % 7 : "W" in d2 ? 1 : 0;
30148           day = "Z" in d2 ? utcDate(newDate(d2.y, 0, 1)).getUTCDay() : localDate(newDate(d2.y, 0, 1)).getDay();
30149           d2.m = 0;
30150           d2.d = "W" in d2 ? (d2.w + 6) % 7 + d2.W * 7 - (day + 5) % 7 : d2.w + d2.U * 7 - (day + 6) % 7;
30151         }
30152         if ("Z" in d2) {
30153           d2.H += d2.Z / 100 | 0;
30154           d2.M += d2.Z % 100;
30155           return utcDate(d2);
30156         }
30157         return localDate(d2);
30158       };
30159     }
30160     function parseSpecifier(d2, specifier, string, j3) {
30161       var i3 = 0, n3 = specifier.length, m3 = string.length, c2, parse;
30162       while (i3 < n3) {
30163         if (j3 >= m3) return -1;
30164         c2 = specifier.charCodeAt(i3++);
30165         if (c2 === 37) {
30166           c2 = specifier.charAt(i3++);
30167           parse = parses[c2 in pads ? specifier.charAt(i3++) : c2];
30168           if (!parse || (j3 = parse(d2, string, j3)) < 0) return -1;
30169         } else if (c2 != string.charCodeAt(j3++)) {
30170           return -1;
30171         }
30172       }
30173       return j3;
30174     }
30175     function parsePeriod(d2, string, i3) {
30176       var n3 = periodRe.exec(string.slice(i3));
30177       return n3 ? (d2.p = periodLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30178     }
30179     function parseShortWeekday(d2, string, i3) {
30180       var n3 = shortWeekdayRe.exec(string.slice(i3));
30181       return n3 ? (d2.w = shortWeekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30182     }
30183     function parseWeekday(d2, string, i3) {
30184       var n3 = weekdayRe.exec(string.slice(i3));
30185       return n3 ? (d2.w = weekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30186     }
30187     function parseShortMonth(d2, string, i3) {
30188       var n3 = shortMonthRe.exec(string.slice(i3));
30189       return n3 ? (d2.m = shortMonthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30190     }
30191     function parseMonth(d2, string, i3) {
30192       var n3 = monthRe.exec(string.slice(i3));
30193       return n3 ? (d2.m = monthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30194     }
30195     function parseLocaleDateTime(d2, string, i3) {
30196       return parseSpecifier(d2, locale_dateTime, string, i3);
30197     }
30198     function parseLocaleDate(d2, string, i3) {
30199       return parseSpecifier(d2, locale_date, string, i3);
30200     }
30201     function parseLocaleTime(d2, string, i3) {
30202       return parseSpecifier(d2, locale_time, string, i3);
30203     }
30204     function formatShortWeekday(d2) {
30205       return locale_shortWeekdays[d2.getDay()];
30206     }
30207     function formatWeekday(d2) {
30208       return locale_weekdays[d2.getDay()];
30209     }
30210     function formatShortMonth(d2) {
30211       return locale_shortMonths[d2.getMonth()];
30212     }
30213     function formatMonth(d2) {
30214       return locale_months[d2.getMonth()];
30215     }
30216     function formatPeriod(d2) {
30217       return locale_periods[+(d2.getHours() >= 12)];
30218     }
30219     function formatQuarter(d2) {
30220       return 1 + ~~(d2.getMonth() / 3);
30221     }
30222     function formatUTCShortWeekday(d2) {
30223       return locale_shortWeekdays[d2.getUTCDay()];
30224     }
30225     function formatUTCWeekday(d2) {
30226       return locale_weekdays[d2.getUTCDay()];
30227     }
30228     function formatUTCShortMonth(d2) {
30229       return locale_shortMonths[d2.getUTCMonth()];
30230     }
30231     function formatUTCMonth(d2) {
30232       return locale_months[d2.getUTCMonth()];
30233     }
30234     function formatUTCPeriod(d2) {
30235       return locale_periods[+(d2.getUTCHours() >= 12)];
30236     }
30237     function formatUTCQuarter(d2) {
30238       return 1 + ~~(d2.getUTCMonth() / 3);
30239     }
30240     return {
30241       format: function(specifier) {
30242         var f2 = newFormat(specifier += "", formats);
30243         f2.toString = function() {
30244           return specifier;
30245         };
30246         return f2;
30247       },
30248       parse: function(specifier) {
30249         var p2 = newParse(specifier += "", false);
30250         p2.toString = function() {
30251           return specifier;
30252         };
30253         return p2;
30254       },
30255       utcFormat: function(specifier) {
30256         var f2 = newFormat(specifier += "", utcFormats);
30257         f2.toString = function() {
30258           return specifier;
30259         };
30260         return f2;
30261       },
30262       utcParse: function(specifier) {
30263         var p2 = newParse(specifier += "", true);
30264         p2.toString = function() {
30265           return specifier;
30266         };
30267         return p2;
30268       }
30269     };
30270   }
30271   function pad(value, fill, width) {
30272     var sign2 = value < 0 ? "-" : "", string = (sign2 ? -value : value) + "", length2 = string.length;
30273     return sign2 + (length2 < width ? new Array(width - length2 + 1).join(fill) + string : string);
30274   }
30275   function requote(s2) {
30276     return s2.replace(requoteRe, "\\$&");
30277   }
30278   function formatRe(names) {
30279     return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
30280   }
30281   function formatLookup(names) {
30282     return new Map(names.map((name, i3) => [name.toLowerCase(), i3]));
30283   }
30284   function parseWeekdayNumberSunday(d2, string, i3) {
30285     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
30286     return n3 ? (d2.w = +n3[0], i3 + n3[0].length) : -1;
30287   }
30288   function parseWeekdayNumberMonday(d2, string, i3) {
30289     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
30290     return n3 ? (d2.u = +n3[0], i3 + n3[0].length) : -1;
30291   }
30292   function parseWeekNumberSunday(d2, string, i3) {
30293     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30294     return n3 ? (d2.U = +n3[0], i3 + n3[0].length) : -1;
30295   }
30296   function parseWeekNumberISO(d2, string, i3) {
30297     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30298     return n3 ? (d2.V = +n3[0], i3 + n3[0].length) : -1;
30299   }
30300   function parseWeekNumberMonday(d2, string, i3) {
30301     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30302     return n3 ? (d2.W = +n3[0], i3 + n3[0].length) : -1;
30303   }
30304   function parseFullYear(d2, string, i3) {
30305     var n3 = numberRe.exec(string.slice(i3, i3 + 4));
30306     return n3 ? (d2.y = +n3[0], i3 + n3[0].length) : -1;
30307   }
30308   function parseYear(d2, string, i3) {
30309     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30310     return n3 ? (d2.y = +n3[0] + (+n3[0] > 68 ? 1900 : 2e3), i3 + n3[0].length) : -1;
30311   }
30312   function parseZone(d2, string, i3) {
30313     var n3 = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i3, i3 + 6));
30314     return n3 ? (d2.Z = n3[1] ? 0 : -(n3[2] + (n3[3] || "00")), i3 + n3[0].length) : -1;
30315   }
30316   function parseQuarter(d2, string, i3) {
30317     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
30318     return n3 ? (d2.q = n3[0] * 3 - 3, i3 + n3[0].length) : -1;
30319   }
30320   function parseMonthNumber(d2, string, i3) {
30321     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30322     return n3 ? (d2.m = n3[0] - 1, i3 + n3[0].length) : -1;
30323   }
30324   function parseDayOfMonth(d2, string, i3) {
30325     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30326     return n3 ? (d2.d = +n3[0], i3 + n3[0].length) : -1;
30327   }
30328   function parseDayOfYear(d2, string, i3) {
30329     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
30330     return n3 ? (d2.m = 0, d2.d = +n3[0], i3 + n3[0].length) : -1;
30331   }
30332   function parseHour24(d2, string, i3) {
30333     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30334     return n3 ? (d2.H = +n3[0], i3 + n3[0].length) : -1;
30335   }
30336   function parseMinutes(d2, string, i3) {
30337     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30338     return n3 ? (d2.M = +n3[0], i3 + n3[0].length) : -1;
30339   }
30340   function parseSeconds(d2, string, i3) {
30341     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30342     return n3 ? (d2.S = +n3[0], i3 + n3[0].length) : -1;
30343   }
30344   function parseMilliseconds(d2, string, i3) {
30345     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
30346     return n3 ? (d2.L = +n3[0], i3 + n3[0].length) : -1;
30347   }
30348   function parseMicroseconds(d2, string, i3) {
30349     var n3 = numberRe.exec(string.slice(i3, i3 + 6));
30350     return n3 ? (d2.L = Math.floor(n3[0] / 1e3), i3 + n3[0].length) : -1;
30351   }
30352   function parseLiteralPercent(d2, string, i3) {
30353     var n3 = percentRe.exec(string.slice(i3, i3 + 1));
30354     return n3 ? i3 + n3[0].length : -1;
30355   }
30356   function parseUnixTimestamp(d2, string, i3) {
30357     var n3 = numberRe.exec(string.slice(i3));
30358     return n3 ? (d2.Q = +n3[0], i3 + n3[0].length) : -1;
30359   }
30360   function parseUnixTimestampSeconds(d2, string, i3) {
30361     var n3 = numberRe.exec(string.slice(i3));
30362     return n3 ? (d2.s = +n3[0], i3 + n3[0].length) : -1;
30363   }
30364   function formatDayOfMonth(d2, p2) {
30365     return pad(d2.getDate(), p2, 2);
30366   }
30367   function formatHour24(d2, p2) {
30368     return pad(d2.getHours(), p2, 2);
30369   }
30370   function formatHour12(d2, p2) {
30371     return pad(d2.getHours() % 12 || 12, p2, 2);
30372   }
30373   function formatDayOfYear(d2, p2) {
30374     return pad(1 + timeDay.count(timeYear(d2), d2), p2, 3);
30375   }
30376   function formatMilliseconds(d2, p2) {
30377     return pad(d2.getMilliseconds(), p2, 3);
30378   }
30379   function formatMicroseconds(d2, p2) {
30380     return formatMilliseconds(d2, p2) + "000";
30381   }
30382   function formatMonthNumber(d2, p2) {
30383     return pad(d2.getMonth() + 1, p2, 2);
30384   }
30385   function formatMinutes(d2, p2) {
30386     return pad(d2.getMinutes(), p2, 2);
30387   }
30388   function formatSeconds(d2, p2) {
30389     return pad(d2.getSeconds(), p2, 2);
30390   }
30391   function formatWeekdayNumberMonday(d2) {
30392     var day = d2.getDay();
30393     return day === 0 ? 7 : day;
30394   }
30395   function formatWeekNumberSunday(d2, p2) {
30396     return pad(timeSunday.count(timeYear(d2) - 1, d2), p2, 2);
30397   }
30398   function dISO(d2) {
30399     var day = d2.getDay();
30400     return day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
30401   }
30402   function formatWeekNumberISO(d2, p2) {
30403     d2 = dISO(d2);
30404     return pad(timeThursday.count(timeYear(d2), d2) + (timeYear(d2).getDay() === 4), p2, 2);
30405   }
30406   function formatWeekdayNumberSunday(d2) {
30407     return d2.getDay();
30408   }
30409   function formatWeekNumberMonday(d2, p2) {
30410     return pad(timeMonday.count(timeYear(d2) - 1, d2), p2, 2);
30411   }
30412   function formatYear(d2, p2) {
30413     return pad(d2.getFullYear() % 100, p2, 2);
30414   }
30415   function formatYearISO(d2, p2) {
30416     d2 = dISO(d2);
30417     return pad(d2.getFullYear() % 100, p2, 2);
30418   }
30419   function formatFullYear(d2, p2) {
30420     return pad(d2.getFullYear() % 1e4, p2, 4);
30421   }
30422   function formatFullYearISO(d2, p2) {
30423     var day = d2.getDay();
30424     d2 = day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
30425     return pad(d2.getFullYear() % 1e4, p2, 4);
30426   }
30427   function formatZone(d2) {
30428     var z3 = d2.getTimezoneOffset();
30429     return (z3 > 0 ? "-" : (z3 *= -1, "+")) + pad(z3 / 60 | 0, "0", 2) + pad(z3 % 60, "0", 2);
30430   }
30431   function formatUTCDayOfMonth(d2, p2) {
30432     return pad(d2.getUTCDate(), p2, 2);
30433   }
30434   function formatUTCHour24(d2, p2) {
30435     return pad(d2.getUTCHours(), p2, 2);
30436   }
30437   function formatUTCHour12(d2, p2) {
30438     return pad(d2.getUTCHours() % 12 || 12, p2, 2);
30439   }
30440   function formatUTCDayOfYear(d2, p2) {
30441     return pad(1 + utcDay.count(utcYear(d2), d2), p2, 3);
30442   }
30443   function formatUTCMilliseconds(d2, p2) {
30444     return pad(d2.getUTCMilliseconds(), p2, 3);
30445   }
30446   function formatUTCMicroseconds(d2, p2) {
30447     return formatUTCMilliseconds(d2, p2) + "000";
30448   }
30449   function formatUTCMonthNumber(d2, p2) {
30450     return pad(d2.getUTCMonth() + 1, p2, 2);
30451   }
30452   function formatUTCMinutes(d2, p2) {
30453     return pad(d2.getUTCMinutes(), p2, 2);
30454   }
30455   function formatUTCSeconds(d2, p2) {
30456     return pad(d2.getUTCSeconds(), p2, 2);
30457   }
30458   function formatUTCWeekdayNumberMonday(d2) {
30459     var dow = d2.getUTCDay();
30460     return dow === 0 ? 7 : dow;
30461   }
30462   function formatUTCWeekNumberSunday(d2, p2) {
30463     return pad(utcSunday.count(utcYear(d2) - 1, d2), p2, 2);
30464   }
30465   function UTCdISO(d2) {
30466     var day = d2.getUTCDay();
30467     return day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
30468   }
30469   function formatUTCWeekNumberISO(d2, p2) {
30470     d2 = UTCdISO(d2);
30471     return pad(utcThursday.count(utcYear(d2), d2) + (utcYear(d2).getUTCDay() === 4), p2, 2);
30472   }
30473   function formatUTCWeekdayNumberSunday(d2) {
30474     return d2.getUTCDay();
30475   }
30476   function formatUTCWeekNumberMonday(d2, p2) {
30477     return pad(utcMonday.count(utcYear(d2) - 1, d2), p2, 2);
30478   }
30479   function formatUTCYear(d2, p2) {
30480     return pad(d2.getUTCFullYear() % 100, p2, 2);
30481   }
30482   function formatUTCYearISO(d2, p2) {
30483     d2 = UTCdISO(d2);
30484     return pad(d2.getUTCFullYear() % 100, p2, 2);
30485   }
30486   function formatUTCFullYear(d2, p2) {
30487     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
30488   }
30489   function formatUTCFullYearISO(d2, p2) {
30490     var day = d2.getUTCDay();
30491     d2 = day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
30492     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
30493   }
30494   function formatUTCZone() {
30495     return "+0000";
30496   }
30497   function formatLiteralPercent() {
30498     return "%";
30499   }
30500   function formatUnixTimestamp(d2) {
30501     return +d2;
30502   }
30503   function formatUnixTimestampSeconds(d2) {
30504     return Math.floor(+d2 / 1e3);
30505   }
30506   var pads, numberRe, percentRe, requoteRe;
30507   var init_locale2 = __esm({
30508     "node_modules/d3-time-format/src/locale.js"() {
30509       init_src14();
30510       pads = { "-": "", "_": " ", "0": "0" };
30511       numberRe = /^\s*\d+/;
30512       percentRe = /^%/;
30513       requoteRe = /[\\^$*+?|[\]().{}]/g;
30514     }
30515   });
30516
30517   // node_modules/d3-time-format/src/defaultLocale.js
30518   function defaultLocale2(definition) {
30519     locale2 = formatLocale(definition);
30520     timeFormat = locale2.format;
30521     timeParse = locale2.parse;
30522     utcFormat = locale2.utcFormat;
30523     utcParse = locale2.utcParse;
30524     return locale2;
30525   }
30526   var locale2, timeFormat, timeParse, utcFormat, utcParse;
30527   var init_defaultLocale2 = __esm({
30528     "node_modules/d3-time-format/src/defaultLocale.js"() {
30529       init_locale2();
30530       defaultLocale2({
30531         dateTime: "%x, %X",
30532         date: "%-m/%-d/%Y",
30533         time: "%-I:%M:%S %p",
30534         periods: ["AM", "PM"],
30535         days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
30536         shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
30537         months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
30538         shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
30539       });
30540     }
30541   });
30542
30543   // node_modules/d3-time-format/src/index.js
30544   var init_src15 = __esm({
30545     "node_modules/d3-time-format/src/index.js"() {
30546       init_defaultLocale2();
30547     }
30548   });
30549
30550   // node_modules/d3-scale/src/index.js
30551   var init_src16 = __esm({
30552     "node_modules/d3-scale/src/index.js"() {
30553       init_linear2();
30554       init_quantize2();
30555     }
30556   });
30557
30558   // modules/behavior/breathe.js
30559   var breathe_exports = {};
30560   __export(breathe_exports, {
30561     behaviorBreathe: () => behaviorBreathe
30562   });
30563   function behaviorBreathe() {
30564     var duration = 800;
30565     var steps = 4;
30566     var selector = ".selected.shadow, .selected .shadow";
30567     var _selected = select_default2(null);
30568     var _classed = "";
30569     var _params = {};
30570     var _done = false;
30571     var _timer;
30572     function ratchetyInterpolator(a4, b3, steps2, units) {
30573       a4 = Number(a4);
30574       b3 = Number(b3);
30575       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a4, b3), steps2));
30576       return function(t2) {
30577         return String(sample(t2)) + (units || "");
30578       };
30579     }
30580     function reset(selection2) {
30581       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
30582     }
30583     function setAnimationParams(transition2, fromTo) {
30584       var toFrom = fromTo === "from" ? "to" : "from";
30585       transition2.styleTween("stroke-opacity", function(d2) {
30586         return ratchetyInterpolator(
30587           _params[d2.id][toFrom].opacity,
30588           _params[d2.id][fromTo].opacity,
30589           steps
30590         );
30591       }).styleTween("stroke-width", function(d2) {
30592         return ratchetyInterpolator(
30593           _params[d2.id][toFrom].width,
30594           _params[d2.id][fromTo].width,
30595           steps,
30596           "px"
30597         );
30598       }).styleTween("fill-opacity", function(d2) {
30599         return ratchetyInterpolator(
30600           _params[d2.id][toFrom].opacity,
30601           _params[d2.id][fromTo].opacity,
30602           steps
30603         );
30604       }).styleTween("r", function(d2) {
30605         return ratchetyInterpolator(
30606           _params[d2.id][toFrom].width,
30607           _params[d2.id][fromTo].width,
30608           steps,
30609           "px"
30610         );
30611       });
30612     }
30613     function calcAnimationParams(selection2) {
30614       selection2.call(reset).each(function(d2) {
30615         var s2 = select_default2(this);
30616         var tag = s2.node().tagName;
30617         var p2 = { "from": {}, "to": {} };
30618         var opacity;
30619         var width;
30620         if (tag === "circle") {
30621           opacity = Number(s2.style("fill-opacity") || 0.5);
30622           width = Number(s2.style("r") || 15.5);
30623         } else {
30624           opacity = Number(s2.style("stroke-opacity") || 0.7);
30625           width = Number(s2.style("stroke-width") || 10);
30626         }
30627         p2.tag = tag;
30628         p2.from.opacity = opacity * 0.6;
30629         p2.to.opacity = opacity * 1.25;
30630         p2.from.width = width * 0.7;
30631         p2.to.width = width * (tag === "circle" ? 1.5 : 1);
30632         _params[d2.id] = p2;
30633       });
30634     }
30635     function run(surface, fromTo) {
30636       var toFrom = fromTo === "from" ? "to" : "from";
30637       var currSelected = surface.selectAll(selector);
30638       var currClassed = surface.attr("class");
30639       if (_done || currSelected.empty()) {
30640         _selected.call(reset);
30641         _selected = select_default2(null);
30642         return;
30643       }
30644       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
30645         _selected.call(reset);
30646         _classed = currClassed;
30647         _selected = currSelected.call(calcAnimationParams);
30648       }
30649       var didCallNextRun = false;
30650       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
30651         if (!didCallNextRun) {
30652           surface.call(run, toFrom);
30653           didCallNextRun = true;
30654         }
30655         if (!select_default2(this).classed("selected")) {
30656           reset(select_default2(this));
30657         }
30658       });
30659     }
30660     function behavior(surface) {
30661       _done = false;
30662       _timer = timer(function() {
30663         if (surface.selectAll(selector).empty()) {
30664           return false;
30665         }
30666         surface.call(run, "from");
30667         _timer.stop();
30668         return true;
30669       }, 20);
30670     }
30671     behavior.restartIfNeeded = function(surface) {
30672       if (_selected.empty()) {
30673         surface.call(run, "from");
30674         if (_timer) {
30675           _timer.stop();
30676         }
30677       }
30678     };
30679     behavior.off = function() {
30680       _done = true;
30681       if (_timer) {
30682         _timer.stop();
30683       }
30684       _selected.interrupt().call(reset);
30685     };
30686     return behavior;
30687   }
30688   var import_fast_deep_equal2;
30689   var init_breathe = __esm({
30690     "modules/behavior/breathe.js"() {
30691       "use strict";
30692       import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
30693       init_src8();
30694       init_src5();
30695       init_src16();
30696       init_src9();
30697     }
30698   });
30699
30700   // node_modules/d3-dsv/src/index.js
30701   var init_src17 = __esm({
30702     "node_modules/d3-dsv/src/index.js"() {
30703     }
30704   });
30705
30706   // node_modules/d3-fetch/src/text.js
30707   function responseText(response) {
30708     if (!response.ok) throw new Error(response.status + " " + response.statusText);
30709     return response.text();
30710   }
30711   function text_default3(input, init2) {
30712     return fetch(input, init2).then(responseText);
30713   }
30714   var init_text3 = __esm({
30715     "node_modules/d3-fetch/src/text.js"() {
30716     }
30717   });
30718
30719   // node_modules/d3-fetch/src/json.js
30720   function responseJson(response) {
30721     if (!response.ok) throw new Error(response.status + " " + response.statusText);
30722     if (response.status === 204 || response.status === 205) return;
30723     return response.json();
30724   }
30725   function json_default(input, init2) {
30726     return fetch(input, init2).then(responseJson);
30727   }
30728   var init_json = __esm({
30729     "node_modules/d3-fetch/src/json.js"() {
30730     }
30731   });
30732
30733   // node_modules/d3-fetch/src/xml.js
30734   function parser(type2) {
30735     return (input, init2) => text_default3(input, init2).then((text) => new DOMParser().parseFromString(text, type2));
30736   }
30737   var xml_default, html, svg;
30738   var init_xml = __esm({
30739     "node_modules/d3-fetch/src/xml.js"() {
30740       init_text3();
30741       xml_default = parser("application/xml");
30742       html = parser("text/html");
30743       svg = parser("image/svg+xml");
30744     }
30745   });
30746
30747   // node_modules/d3-fetch/src/index.js
30748   var init_src18 = __esm({
30749     "node_modules/d3-fetch/src/index.js"() {
30750       init_json();
30751       init_text3();
30752       init_xml();
30753     }
30754   });
30755
30756   // modules/core/difference.js
30757   var difference_exports = {};
30758   __export(difference_exports, {
30759     coreDifference: () => coreDifference
30760   });
30761   function coreDifference(base, head) {
30762     var _changes = {};
30763     var _didChange = {};
30764     var _diff = {};
30765     function checkEntityID(id2) {
30766       var h3 = head.entities[id2];
30767       var b3 = base.entities[id2];
30768       if (h3 === b3) return;
30769       if (_changes[id2]) return;
30770       if (!h3 && b3) {
30771         _changes[id2] = { base: b3, head: h3 };
30772         _didChange.deletion = true;
30773         return;
30774       }
30775       if (h3 && !b3) {
30776         _changes[id2] = { base: b3, head: h3 };
30777         _didChange.addition = true;
30778         return;
30779       }
30780       if (h3 && b3) {
30781         if (h3.members && b3.members && !(0, import_fast_deep_equal3.default)(h3.members, b3.members)) {
30782           _changes[id2] = { base: b3, head: h3 };
30783           _didChange.geometry = true;
30784           _didChange.properties = true;
30785           return;
30786         }
30787         if (h3.loc && b3.loc && !geoVecEqual(h3.loc, b3.loc)) {
30788           _changes[id2] = { base: b3, head: h3 };
30789           _didChange.geometry = true;
30790         }
30791         if (h3.nodes && b3.nodes && !(0, import_fast_deep_equal3.default)(h3.nodes, b3.nodes)) {
30792           _changes[id2] = { base: b3, head: h3 };
30793           _didChange.geometry = true;
30794         }
30795         if (h3.tags && b3.tags && !(0, import_fast_deep_equal3.default)(h3.tags, b3.tags)) {
30796           _changes[id2] = { base: b3, head: h3 };
30797           _didChange.properties = true;
30798         }
30799       }
30800     }
30801     function load() {
30802       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
30803       for (var i3 = 0; i3 < ids.length; i3++) {
30804         checkEntityID(ids[i3]);
30805       }
30806     }
30807     load();
30808     _diff.length = function length2() {
30809       return Object.keys(_changes).length;
30810     };
30811     _diff.changes = function changes() {
30812       return _changes;
30813     };
30814     _diff.didChange = _didChange;
30815     _diff.extantIDs = function extantIDs(includeRelMembers) {
30816       var result = /* @__PURE__ */ new Set();
30817       Object.keys(_changes).forEach(function(id2) {
30818         if (_changes[id2].head) {
30819           result.add(id2);
30820         }
30821         var h3 = _changes[id2].head;
30822         var b3 = _changes[id2].base;
30823         var entity = h3 || b3;
30824         if (includeRelMembers && entity.type === "relation") {
30825           var mh = h3 ? h3.members.map(function(m3) {
30826             return m3.id;
30827           }) : [];
30828           var mb = b3 ? b3.members.map(function(m3) {
30829             return m3.id;
30830           }) : [];
30831           utilArrayUnion(mh, mb).forEach(function(memberID) {
30832             if (head.hasEntity(memberID)) {
30833               result.add(memberID);
30834             }
30835           });
30836         }
30837       });
30838       return Array.from(result);
30839     };
30840     _diff.modified = function modified() {
30841       var result = [];
30842       Object.values(_changes).forEach(function(change) {
30843         if (change.base && change.head) {
30844           result.push(change.head);
30845         }
30846       });
30847       return result;
30848     };
30849     _diff.created = function created() {
30850       var result = [];
30851       Object.values(_changes).forEach(function(change) {
30852         if (!change.base && change.head) {
30853           result.push(change.head);
30854         }
30855       });
30856       return result;
30857     };
30858     _diff.deleted = function deleted() {
30859       var result = [];
30860       Object.values(_changes).forEach(function(change) {
30861         if (change.base && !change.head) {
30862           result.push(change.base);
30863         }
30864       });
30865       return result;
30866     };
30867     _diff.summary = function summary() {
30868       var relevant = {};
30869       var keys2 = Object.keys(_changes);
30870       for (var i3 = 0; i3 < keys2.length; i3++) {
30871         var change = _changes[keys2[i3]];
30872         if (change.head && change.head.geometry(head) !== "vertex") {
30873           addEntity(change.head, head, change.base ? "modified" : "created");
30874         } else if (change.base && change.base.geometry(base) !== "vertex") {
30875           addEntity(change.base, base, "deleted");
30876         } else if (change.base && change.head) {
30877           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
30878           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
30879           if (moved) {
30880             addParents(change.head);
30881           }
30882           if (retagged || moved && change.head.hasInterestingTags()) {
30883             addEntity(change.head, head, "modified");
30884           }
30885         } else if (change.head && change.head.hasInterestingTags()) {
30886           addEntity(change.head, head, "created");
30887         } else if (change.base && change.base.hasInterestingTags()) {
30888           addEntity(change.base, base, "deleted");
30889         }
30890       }
30891       return Object.values(relevant);
30892       function addEntity(entity, graph, changeType) {
30893         relevant[entity.id] = {
30894           entity,
30895           graph,
30896           changeType
30897         };
30898       }
30899       function addParents(entity) {
30900         var parents = head.parentWays(entity);
30901         for (var j3 = parents.length - 1; j3 >= 0; j3--) {
30902           var parent2 = parents[j3];
30903           if (!(parent2.id in relevant)) {
30904             addEntity(parent2, head, "modified");
30905           }
30906         }
30907       }
30908     };
30909     _diff.complete = function complete(extent) {
30910       var result = {};
30911       var id2, change;
30912       for (id2 in _changes) {
30913         change = _changes[id2];
30914         var h3 = change.head;
30915         var b3 = change.base;
30916         var entity = h3 || b3;
30917         var i3;
30918         if (extent && (!h3 || !h3.intersects(extent, head)) && (!b3 || !b3.intersects(extent, base))) {
30919           continue;
30920         }
30921         result[id2] = h3;
30922         if (entity.type === "way") {
30923           var nh = h3 ? h3.nodes : [];
30924           var nb = b3 ? b3.nodes : [];
30925           var diff;
30926           diff = utilArrayDifference(nh, nb);
30927           for (i3 = 0; i3 < diff.length; i3++) {
30928             result[diff[i3]] = head.hasEntity(diff[i3]);
30929           }
30930           diff = utilArrayDifference(nb, nh);
30931           for (i3 = 0; i3 < diff.length; i3++) {
30932             result[diff[i3]] = head.hasEntity(diff[i3]);
30933           }
30934         }
30935         if (entity.type === "relation" && entity.isMultipolygon()) {
30936           var mh = h3 ? h3.members.map(function(m3) {
30937             return m3.id;
30938           }) : [];
30939           var mb = b3 ? b3.members.map(function(m3) {
30940             return m3.id;
30941           }) : [];
30942           var ids = utilArrayUnion(mh, mb);
30943           for (i3 = 0; i3 < ids.length; i3++) {
30944             var member = head.hasEntity(ids[i3]);
30945             if (!member) continue;
30946             if (extent && !member.intersects(extent, head)) continue;
30947             result[ids[i3]] = member;
30948           }
30949         }
30950         addParents(head.parentWays(entity), result);
30951         addParents(head.parentRelations(entity), result);
30952       }
30953       return result;
30954       function addParents(parents, result2) {
30955         for (var i4 = 0; i4 < parents.length; i4++) {
30956           var parent2 = parents[i4];
30957           if (parent2.id in result2) continue;
30958           result2[parent2.id] = parent2;
30959           addParents(head.parentRelations(parent2), result2);
30960         }
30961       }
30962     };
30963     return _diff;
30964   }
30965   var import_fast_deep_equal3;
30966   var init_difference = __esm({
30967     "modules/core/difference.js"() {
30968       "use strict";
30969       import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
30970       init_geo2();
30971       init_array3();
30972     }
30973   });
30974
30975   // node_modules/quickselect/index.js
30976   function quickselect2(arr, k3, left = 0, right = arr.length - 1, compare2 = defaultCompare) {
30977     while (right > left) {
30978       if (right - left > 600) {
30979         const n3 = right - left + 1;
30980         const m3 = k3 - left + 1;
30981         const z3 = Math.log(n3);
30982         const s2 = 0.5 * Math.exp(2 * z3 / 3);
30983         const sd = 0.5 * Math.sqrt(z3 * s2 * (n3 - s2) / n3) * (m3 - n3 / 2 < 0 ? -1 : 1);
30984         const newLeft = Math.max(left, Math.floor(k3 - m3 * s2 / n3 + sd));
30985         const newRight = Math.min(right, Math.floor(k3 + (n3 - m3) * s2 / n3 + sd));
30986         quickselect2(arr, k3, newLeft, newRight, compare2);
30987       }
30988       const t2 = arr[k3];
30989       let i3 = left;
30990       let j3 = right;
30991       swap2(arr, left, k3);
30992       if (compare2(arr[right], t2) > 0) swap2(arr, left, right);
30993       while (i3 < j3) {
30994         swap2(arr, i3, j3);
30995         i3++;
30996         j3--;
30997         while (compare2(arr[i3], t2) < 0) i3++;
30998         while (compare2(arr[j3], t2) > 0) j3--;
30999       }
31000       if (compare2(arr[left], t2) === 0) swap2(arr, left, j3);
31001       else {
31002         j3++;
31003         swap2(arr, j3, right);
31004       }
31005       if (j3 <= k3) left = j3 + 1;
31006       if (k3 <= j3) right = j3 - 1;
31007     }
31008   }
31009   function swap2(arr, i3, j3) {
31010     const tmp = arr[i3];
31011     arr[i3] = arr[j3];
31012     arr[j3] = tmp;
31013   }
31014   function defaultCompare(a4, b3) {
31015     return a4 < b3 ? -1 : a4 > b3 ? 1 : 0;
31016   }
31017   var init_quickselect2 = __esm({
31018     "node_modules/quickselect/index.js"() {
31019     }
31020   });
31021
31022   // node_modules/rbush/index.js
31023   function findItem(item, items, equalsFn) {
31024     if (!equalsFn) return items.indexOf(item);
31025     for (let i3 = 0; i3 < items.length; i3++) {
31026       if (equalsFn(item, items[i3])) return i3;
31027     }
31028     return -1;
31029   }
31030   function calcBBox(node, toBBox) {
31031     distBBox(node, 0, node.children.length, toBBox, node);
31032   }
31033   function distBBox(node, k3, p2, toBBox, destNode) {
31034     if (!destNode) destNode = createNode(null);
31035     destNode.minX = Infinity;
31036     destNode.minY = Infinity;
31037     destNode.maxX = -Infinity;
31038     destNode.maxY = -Infinity;
31039     for (let i3 = k3; i3 < p2; i3++) {
31040       const child = node.children[i3];
31041       extend2(destNode, node.leaf ? toBBox(child) : child);
31042     }
31043     return destNode;
31044   }
31045   function extend2(a4, b3) {
31046     a4.minX = Math.min(a4.minX, b3.minX);
31047     a4.minY = Math.min(a4.minY, b3.minY);
31048     a4.maxX = Math.max(a4.maxX, b3.maxX);
31049     a4.maxY = Math.max(a4.maxY, b3.maxY);
31050     return a4;
31051   }
31052   function compareNodeMinX(a4, b3) {
31053     return a4.minX - b3.minX;
31054   }
31055   function compareNodeMinY(a4, b3) {
31056     return a4.minY - b3.minY;
31057   }
31058   function bboxArea(a4) {
31059     return (a4.maxX - a4.minX) * (a4.maxY - a4.minY);
31060   }
31061   function bboxMargin(a4) {
31062     return a4.maxX - a4.minX + (a4.maxY - a4.minY);
31063   }
31064   function enlargedArea(a4, b3) {
31065     return (Math.max(b3.maxX, a4.maxX) - Math.min(b3.minX, a4.minX)) * (Math.max(b3.maxY, a4.maxY) - Math.min(b3.minY, a4.minY));
31066   }
31067   function intersectionArea(a4, b3) {
31068     const minX = Math.max(a4.minX, b3.minX);
31069     const minY = Math.max(a4.minY, b3.minY);
31070     const maxX = Math.min(a4.maxX, b3.maxX);
31071     const maxY = Math.min(a4.maxY, b3.maxY);
31072     return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
31073   }
31074   function contains(a4, b3) {
31075     return a4.minX <= b3.minX && a4.minY <= b3.minY && b3.maxX <= a4.maxX && b3.maxY <= a4.maxY;
31076   }
31077   function intersects(a4, b3) {
31078     return b3.minX <= a4.maxX && b3.minY <= a4.maxY && b3.maxX >= a4.minX && b3.maxY >= a4.minY;
31079   }
31080   function createNode(children2) {
31081     return {
31082       children: children2,
31083       height: 1,
31084       leaf: true,
31085       minX: Infinity,
31086       minY: Infinity,
31087       maxX: -Infinity,
31088       maxY: -Infinity
31089     };
31090   }
31091   function multiSelect(arr, left, right, n3, compare2) {
31092     const stack = [left, right];
31093     while (stack.length) {
31094       right = stack.pop();
31095       left = stack.pop();
31096       if (right - left <= n3) continue;
31097       const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
31098       quickselect2(arr, mid, left, right, compare2);
31099       stack.push(left, mid, mid, right);
31100     }
31101   }
31102   var RBush;
31103   var init_rbush = __esm({
31104     "node_modules/rbush/index.js"() {
31105       init_quickselect2();
31106       RBush = class {
31107         constructor(maxEntries = 9) {
31108           this._maxEntries = Math.max(4, maxEntries);
31109           this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
31110           this.clear();
31111         }
31112         all() {
31113           return this._all(this.data, []);
31114         }
31115         search(bbox2) {
31116           let node = this.data;
31117           const result = [];
31118           if (!intersects(bbox2, node)) return result;
31119           const toBBox = this.toBBox;
31120           const nodesToSearch = [];
31121           while (node) {
31122             for (let i3 = 0; i3 < node.children.length; i3++) {
31123               const child = node.children[i3];
31124               const childBBox = node.leaf ? toBBox(child) : child;
31125               if (intersects(bbox2, childBBox)) {
31126                 if (node.leaf) result.push(child);
31127                 else if (contains(bbox2, childBBox)) this._all(child, result);
31128                 else nodesToSearch.push(child);
31129               }
31130             }
31131             node = nodesToSearch.pop();
31132           }
31133           return result;
31134         }
31135         collides(bbox2) {
31136           let node = this.data;
31137           if (!intersects(bbox2, node)) return false;
31138           const nodesToSearch = [];
31139           while (node) {
31140             for (let i3 = 0; i3 < node.children.length; i3++) {
31141               const child = node.children[i3];
31142               const childBBox = node.leaf ? this.toBBox(child) : child;
31143               if (intersects(bbox2, childBBox)) {
31144                 if (node.leaf || contains(bbox2, childBBox)) return true;
31145                 nodesToSearch.push(child);
31146               }
31147             }
31148             node = nodesToSearch.pop();
31149           }
31150           return false;
31151         }
31152         load(data) {
31153           if (!(data && data.length)) return this;
31154           if (data.length < this._minEntries) {
31155             for (let i3 = 0; i3 < data.length; i3++) {
31156               this.insert(data[i3]);
31157             }
31158             return this;
31159           }
31160           let node = this._build(data.slice(), 0, data.length - 1, 0);
31161           if (!this.data.children.length) {
31162             this.data = node;
31163           } else if (this.data.height === node.height) {
31164             this._splitRoot(this.data, node);
31165           } else {
31166             if (this.data.height < node.height) {
31167               const tmpNode = this.data;
31168               this.data = node;
31169               node = tmpNode;
31170             }
31171             this._insert(node, this.data.height - node.height - 1, true);
31172           }
31173           return this;
31174         }
31175         insert(item) {
31176           if (item) this._insert(item, this.data.height - 1);
31177           return this;
31178         }
31179         clear() {
31180           this.data = createNode([]);
31181           return this;
31182         }
31183         remove(item, equalsFn) {
31184           if (!item) return this;
31185           let node = this.data;
31186           const bbox2 = this.toBBox(item);
31187           const path = [];
31188           const indexes = [];
31189           let i3, parent2, goingUp;
31190           while (node || path.length) {
31191             if (!node) {
31192               node = path.pop();
31193               parent2 = path[path.length - 1];
31194               i3 = indexes.pop();
31195               goingUp = true;
31196             }
31197             if (node.leaf) {
31198               const index = findItem(item, node.children, equalsFn);
31199               if (index !== -1) {
31200                 node.children.splice(index, 1);
31201                 path.push(node);
31202                 this._condense(path);
31203                 return this;
31204               }
31205             }
31206             if (!goingUp && !node.leaf && contains(node, bbox2)) {
31207               path.push(node);
31208               indexes.push(i3);
31209               i3 = 0;
31210               parent2 = node;
31211               node = node.children[0];
31212             } else if (parent2) {
31213               i3++;
31214               node = parent2.children[i3];
31215               goingUp = false;
31216             } else node = null;
31217           }
31218           return this;
31219         }
31220         toBBox(item) {
31221           return item;
31222         }
31223         compareMinX(a4, b3) {
31224           return a4.minX - b3.minX;
31225         }
31226         compareMinY(a4, b3) {
31227           return a4.minY - b3.minY;
31228         }
31229         toJSON() {
31230           return this.data;
31231         }
31232         fromJSON(data) {
31233           this.data = data;
31234           return this;
31235         }
31236         _all(node, result) {
31237           const nodesToSearch = [];
31238           while (node) {
31239             if (node.leaf) result.push(...node.children);
31240             else nodesToSearch.push(...node.children);
31241             node = nodesToSearch.pop();
31242           }
31243           return result;
31244         }
31245         _build(items, left, right, height) {
31246           const N3 = right - left + 1;
31247           let M3 = this._maxEntries;
31248           let node;
31249           if (N3 <= M3) {
31250             node = createNode(items.slice(left, right + 1));
31251             calcBBox(node, this.toBBox);
31252             return node;
31253           }
31254           if (!height) {
31255             height = Math.ceil(Math.log(N3) / Math.log(M3));
31256             M3 = Math.ceil(N3 / Math.pow(M3, height - 1));
31257           }
31258           node = createNode([]);
31259           node.leaf = false;
31260           node.height = height;
31261           const N22 = Math.ceil(N3 / M3);
31262           const N1 = N22 * Math.ceil(Math.sqrt(M3));
31263           multiSelect(items, left, right, N1, this.compareMinX);
31264           for (let i3 = left; i3 <= right; i3 += N1) {
31265             const right2 = Math.min(i3 + N1 - 1, right);
31266             multiSelect(items, i3, right2, N22, this.compareMinY);
31267             for (let j3 = i3; j3 <= right2; j3 += N22) {
31268               const right3 = Math.min(j3 + N22 - 1, right2);
31269               node.children.push(this._build(items, j3, right3, height - 1));
31270             }
31271           }
31272           calcBBox(node, this.toBBox);
31273           return node;
31274         }
31275         _chooseSubtree(bbox2, node, level, path) {
31276           while (true) {
31277             path.push(node);
31278             if (node.leaf || path.length - 1 === level) break;
31279             let minArea = Infinity;
31280             let minEnlargement = Infinity;
31281             let targetNode;
31282             for (let i3 = 0; i3 < node.children.length; i3++) {
31283               const child = node.children[i3];
31284               const area = bboxArea(child);
31285               const enlargement = enlargedArea(bbox2, child) - area;
31286               if (enlargement < minEnlargement) {
31287                 minEnlargement = enlargement;
31288                 minArea = area < minArea ? area : minArea;
31289                 targetNode = child;
31290               } else if (enlargement === minEnlargement) {
31291                 if (area < minArea) {
31292                   minArea = area;
31293                   targetNode = child;
31294                 }
31295               }
31296             }
31297             node = targetNode || node.children[0];
31298           }
31299           return node;
31300         }
31301         _insert(item, level, isNode) {
31302           const bbox2 = isNode ? item : this.toBBox(item);
31303           const insertPath = [];
31304           const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
31305           node.children.push(item);
31306           extend2(node, bbox2);
31307           while (level >= 0) {
31308             if (insertPath[level].children.length > this._maxEntries) {
31309               this._split(insertPath, level);
31310               level--;
31311             } else break;
31312           }
31313           this._adjustParentBBoxes(bbox2, insertPath, level);
31314         }
31315         // split overflowed node into two
31316         _split(insertPath, level) {
31317           const node = insertPath[level];
31318           const M3 = node.children.length;
31319           const m3 = this._minEntries;
31320           this._chooseSplitAxis(node, m3, M3);
31321           const splitIndex = this._chooseSplitIndex(node, m3, M3);
31322           const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
31323           newNode.height = node.height;
31324           newNode.leaf = node.leaf;
31325           calcBBox(node, this.toBBox);
31326           calcBBox(newNode, this.toBBox);
31327           if (level) insertPath[level - 1].children.push(newNode);
31328           else this._splitRoot(node, newNode);
31329         }
31330         _splitRoot(node, newNode) {
31331           this.data = createNode([node, newNode]);
31332           this.data.height = node.height + 1;
31333           this.data.leaf = false;
31334           calcBBox(this.data, this.toBBox);
31335         }
31336         _chooseSplitIndex(node, m3, M3) {
31337           let index;
31338           let minOverlap = Infinity;
31339           let minArea = Infinity;
31340           for (let i3 = m3; i3 <= M3 - m3; i3++) {
31341             const bbox1 = distBBox(node, 0, i3, this.toBBox);
31342             const bbox2 = distBBox(node, i3, M3, this.toBBox);
31343             const overlap = intersectionArea(bbox1, bbox2);
31344             const area = bboxArea(bbox1) + bboxArea(bbox2);
31345             if (overlap < minOverlap) {
31346               minOverlap = overlap;
31347               index = i3;
31348               minArea = area < minArea ? area : minArea;
31349             } else if (overlap === minOverlap) {
31350               if (area < minArea) {
31351                 minArea = area;
31352                 index = i3;
31353               }
31354             }
31355           }
31356           return index || M3 - m3;
31357         }
31358         // sorts node children by the best axis for split
31359         _chooseSplitAxis(node, m3, M3) {
31360           const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
31361           const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
31362           const xMargin = this._allDistMargin(node, m3, M3, compareMinX);
31363           const yMargin = this._allDistMargin(node, m3, M3, compareMinY);
31364           if (xMargin < yMargin) node.children.sort(compareMinX);
31365         }
31366         // total margin of all possible split distributions where each node is at least m full
31367         _allDistMargin(node, m3, M3, compare2) {
31368           node.children.sort(compare2);
31369           const toBBox = this.toBBox;
31370           const leftBBox = distBBox(node, 0, m3, toBBox);
31371           const rightBBox = distBBox(node, M3 - m3, M3, toBBox);
31372           let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
31373           for (let i3 = m3; i3 < M3 - m3; i3++) {
31374             const child = node.children[i3];
31375             extend2(leftBBox, node.leaf ? toBBox(child) : child);
31376             margin += bboxMargin(leftBBox);
31377           }
31378           for (let i3 = M3 - m3 - 1; i3 >= m3; i3--) {
31379             const child = node.children[i3];
31380             extend2(rightBBox, node.leaf ? toBBox(child) : child);
31381             margin += bboxMargin(rightBBox);
31382           }
31383           return margin;
31384         }
31385         _adjustParentBBoxes(bbox2, path, level) {
31386           for (let i3 = level; i3 >= 0; i3--) {
31387             extend2(path[i3], bbox2);
31388           }
31389         }
31390         _condense(path) {
31391           for (let i3 = path.length - 1, siblings; i3 >= 0; i3--) {
31392             if (path[i3].children.length === 0) {
31393               if (i3 > 0) {
31394                 siblings = path[i3 - 1].children;
31395                 siblings.splice(siblings.indexOf(path[i3]), 1);
31396               } else this.clear();
31397             } else calcBBox(path[i3], this.toBBox);
31398           }
31399         }
31400       };
31401     }
31402   });
31403
31404   // modules/core/tree.js
31405   var tree_exports = {};
31406   __export(tree_exports, {
31407     coreTree: () => coreTree
31408   });
31409   function coreTree(head) {
31410     var _rtree = new RBush();
31411     var _bboxes = {};
31412     var _segmentsRTree = new RBush();
31413     var _segmentsBBoxes = {};
31414     var _segmentsByWayId = {};
31415     var tree = {};
31416     function entityBBox(entity) {
31417       var bbox2 = entity.extent(head).bbox();
31418       bbox2.id = entity.id;
31419       _bboxes[entity.id] = bbox2;
31420       return bbox2;
31421     }
31422     function segmentBBox(segment) {
31423       var extent = segment.extent(head);
31424       if (!extent) return null;
31425       var bbox2 = extent.bbox();
31426       bbox2.segment = segment;
31427       _segmentsBBoxes[segment.id] = bbox2;
31428       return bbox2;
31429     }
31430     function removeEntity(entity) {
31431       _rtree.remove(_bboxes[entity.id]);
31432       delete _bboxes[entity.id];
31433       if (_segmentsByWayId[entity.id]) {
31434         _segmentsByWayId[entity.id].forEach(function(segment) {
31435           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
31436           delete _segmentsBBoxes[segment.id];
31437         });
31438         delete _segmentsByWayId[entity.id];
31439       }
31440     }
31441     function loadEntities(entities) {
31442       _rtree.load(entities.map(entityBBox));
31443       var segments = [];
31444       entities.forEach(function(entity) {
31445         if (entity.segments) {
31446           var entitySegments = entity.segments(head);
31447           _segmentsByWayId[entity.id] = entitySegments;
31448           segments = segments.concat(entitySegments);
31449         }
31450       });
31451       if (segments.length) _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
31452     }
31453     function updateParents(entity, insertions, memo) {
31454       head.parentWays(entity).forEach(function(way) {
31455         if (_bboxes[way.id]) {
31456           removeEntity(way);
31457           insertions[way.id] = way;
31458         }
31459         updateParents(way, insertions, memo);
31460       });
31461       head.parentRelations(entity).forEach(function(relation) {
31462         if (memo[relation.id]) return;
31463         memo[relation.id] = true;
31464         if (_bboxes[relation.id]) {
31465           removeEntity(relation);
31466           insertions[relation.id] = relation;
31467         }
31468         updateParents(relation, insertions, memo);
31469       });
31470     }
31471     tree.rebase = function(entities, force) {
31472       var insertions = {};
31473       for (var i3 = 0; i3 < entities.length; i3++) {
31474         var entity = entities[i3];
31475         if (!entity.visible) continue;
31476         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
31477           if (!force) {
31478             continue;
31479           } else if (_bboxes[entity.id]) {
31480             removeEntity(entity);
31481           }
31482         }
31483         insertions[entity.id] = entity;
31484         updateParents(entity, insertions, {});
31485       }
31486       loadEntities(Object.values(insertions));
31487       return tree;
31488     };
31489     function updateToGraph(graph) {
31490       if (graph === head) return;
31491       var diff = coreDifference(head, graph);
31492       head = graph;
31493       var changed = diff.didChange;
31494       if (!changed.addition && !changed.deletion && !changed.geometry) return;
31495       var insertions = {};
31496       if (changed.deletion) {
31497         diff.deleted().forEach(function(entity) {
31498           removeEntity(entity);
31499         });
31500       }
31501       if (changed.geometry) {
31502         diff.modified().forEach(function(entity) {
31503           removeEntity(entity);
31504           insertions[entity.id] = entity;
31505           updateParents(entity, insertions, {});
31506         });
31507       }
31508       if (changed.addition) {
31509         diff.created().forEach(function(entity) {
31510           insertions[entity.id] = entity;
31511         });
31512       }
31513       loadEntities(Object.values(insertions));
31514     }
31515     tree.intersects = function(extent, graph) {
31516       updateToGraph(graph);
31517       return _rtree.search(extent.bbox()).map(function(bbox2) {
31518         return graph.entity(bbox2.id);
31519       });
31520     };
31521     tree.waySegments = function(extent, graph) {
31522       updateToGraph(graph);
31523       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
31524         return bbox2.segment;
31525       });
31526     };
31527     return tree;
31528   }
31529   var init_tree = __esm({
31530     "modules/core/tree.js"() {
31531       "use strict";
31532       init_rbush();
31533       init_difference();
31534     }
31535   });
31536
31537   // modules/svg/icon.js
31538   var icon_exports = {};
31539   __export(icon_exports, {
31540     svgIcon: () => svgIcon
31541   });
31542   function svgIcon(name, svgklass, useklass) {
31543     return function drawIcon(selection2) {
31544       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);
31545     };
31546   }
31547   var init_icon = __esm({
31548     "modules/svg/icon.js"() {
31549       "use strict";
31550     }
31551   });
31552
31553   // modules/ui/modal.js
31554   var modal_exports = {};
31555   __export(modal_exports, {
31556     uiModal: () => uiModal
31557   });
31558   function uiModal(selection2, blocking) {
31559     let keybinding = utilKeybinding("modal");
31560     let previous = selection2.select("div.modal");
31561     let animate = previous.empty();
31562     previous.transition().duration(200).style("opacity", 0).remove();
31563     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
31564     shaded.close = () => {
31565       shaded.transition().duration(200).style("opacity", 0).remove();
31566       modal.transition().duration(200).style("top", "0px");
31567       select_default2(document).call(keybinding.unbind);
31568     };
31569     let modal = shaded.append("div").attr("class", "modal fillL");
31570     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
31571     if (!blocking) {
31572       shaded.on("click.remove-modal", (d3_event) => {
31573         if (d3_event.target === this) {
31574           shaded.close();
31575         }
31576       });
31577       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
31578       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
31579       select_default2(document).call(keybinding);
31580     }
31581     modal.append("div").attr("class", "content");
31582     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
31583     if (animate) {
31584       shaded.transition().style("opacity", 1);
31585     } else {
31586       shaded.style("opacity", 1);
31587     }
31588     return shaded;
31589     function moveFocusToFirst() {
31590       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
31591       if (node) {
31592         node.focus();
31593       } else {
31594         select_default2(this).node().blur();
31595       }
31596     }
31597     function moveFocusToLast() {
31598       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
31599       if (nodes.length) {
31600         nodes[nodes.length - 1].focus();
31601       } else {
31602         select_default2(this).node().blur();
31603       }
31604     }
31605   }
31606   var init_modal = __esm({
31607     "modules/ui/modal.js"() {
31608       "use strict";
31609       init_src5();
31610       init_localizer();
31611       init_icon();
31612       init_util();
31613     }
31614   });
31615
31616   // modules/ui/loading.js
31617   var loading_exports = {};
31618   __export(loading_exports, {
31619     uiLoading: () => uiLoading
31620   });
31621   function uiLoading(context) {
31622     let _modalSelection = select_default2(null);
31623     let _message = "";
31624     let _blocking = false;
31625     let loading = (selection2) => {
31626       _modalSelection = uiModal(selection2, _blocking);
31627       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
31628       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
31629       loadertext.append("h3").html(_message);
31630       _modalSelection.select("button.close").attr("class", "hide");
31631       return loading;
31632     };
31633     loading.message = function(val) {
31634       if (!arguments.length) return _message;
31635       _message = val;
31636       return loading;
31637     };
31638     loading.blocking = function(val) {
31639       if (!arguments.length) return _blocking;
31640       _blocking = val;
31641       return loading;
31642     };
31643     loading.close = () => {
31644       _modalSelection.remove();
31645     };
31646     loading.isShown = () => {
31647       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
31648     };
31649     return loading;
31650   }
31651   var init_loading = __esm({
31652     "modules/ui/loading.js"() {
31653       "use strict";
31654       init_src5();
31655       init_modal();
31656     }
31657   });
31658
31659   // modules/core/history.js
31660   var history_exports = {};
31661   __export(history_exports, {
31662     coreHistory: () => coreHistory
31663   });
31664   function coreHistory(context) {
31665     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
31666     var lock = utilSessionMutex("lock");
31667     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
31668     var duration = 150;
31669     var _imageryUsed = [];
31670     var _photoOverlaysUsed = [];
31671     var _checkpoints = {};
31672     var _pausedGraph;
31673     var _stack;
31674     var _index;
31675     var _tree;
31676     function _act(actions, t2) {
31677       actions = Array.prototype.slice.call(actions);
31678       var annotation;
31679       if (typeof actions[actions.length - 1] !== "function") {
31680         annotation = actions.pop();
31681       }
31682       var graph = _stack[_index].graph;
31683       for (var i3 = 0; i3 < actions.length; i3++) {
31684         graph = actions[i3](graph, t2);
31685       }
31686       return {
31687         graph,
31688         annotation,
31689         imageryUsed: _imageryUsed,
31690         photoOverlaysUsed: _photoOverlaysUsed,
31691         transform: context.projection.transform(),
31692         selectedIDs: context.selectedIDs()
31693       };
31694     }
31695     function _perform(args, t2) {
31696       var previous = _stack[_index].graph;
31697       _stack = _stack.slice(0, _index + 1);
31698       var actionResult = _act(args, t2);
31699       _stack.push(actionResult);
31700       _index++;
31701       return change(previous);
31702     }
31703     function _replace(args, t2) {
31704       var previous = _stack[_index].graph;
31705       var actionResult = _act(args, t2);
31706       _stack[_index] = actionResult;
31707       return change(previous);
31708     }
31709     function _overwrite(args, t2) {
31710       var previous = _stack[_index].graph;
31711       var actionResult = _act(args, t2);
31712       if (_index > 0) {
31713         _index--;
31714         _stack.pop();
31715       }
31716       _stack = _stack.slice(0, _index + 1);
31717       _stack.push(actionResult);
31718       _index++;
31719       return change(previous);
31720     }
31721     function change(previous) {
31722       var difference2 = coreDifference(previous, history.graph());
31723       if (!_pausedGraph) {
31724         dispatch14.call("change", this, difference2);
31725       }
31726       return difference2;
31727     }
31728     function getKey(n3) {
31729       return "iD_" + window.location.origin + "_" + n3;
31730     }
31731     var history = {
31732       graph: function() {
31733         return _stack[_index].graph;
31734       },
31735       tree: function() {
31736         return _tree;
31737       },
31738       base: function() {
31739         return _stack[0].graph;
31740       },
31741       merge: function(entities) {
31742         var stack = _stack.map(function(state) {
31743           return state.graph;
31744         });
31745         _stack[0].graph.rebase(entities, stack, false);
31746         _tree.rebase(entities, false);
31747         dispatch14.call("merge", this, entities);
31748       },
31749       perform: function() {
31750         select_default2(document).interrupt("history.perform");
31751         var transitionable = false;
31752         var action0 = arguments[0];
31753         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
31754           transitionable = !!action0.transitionable;
31755         }
31756         if (transitionable) {
31757           var origArguments = arguments;
31758           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
31759             return function(t2) {
31760               if (t2 < 1) _overwrite([action0], t2);
31761             };
31762           }).on("start", function() {
31763             _perform([action0], 0);
31764           }).on("end interrupt", function() {
31765             _overwrite(origArguments, 1);
31766           });
31767         } else {
31768           return _perform(arguments);
31769         }
31770       },
31771       replace: function() {
31772         select_default2(document).interrupt("history.perform");
31773         return _replace(arguments, 1);
31774       },
31775       // Same as calling pop and then perform
31776       overwrite: function() {
31777         select_default2(document).interrupt("history.perform");
31778         return _overwrite(arguments, 1);
31779       },
31780       pop: function(n3) {
31781         select_default2(document).interrupt("history.perform");
31782         var previous = _stack[_index].graph;
31783         if (isNaN(+n3) || +n3 < 0) {
31784           n3 = 1;
31785         }
31786         while (n3-- > 0 && _index > 0) {
31787           _index--;
31788           _stack.pop();
31789         }
31790         return change(previous);
31791       },
31792       // Back to the previous annotated state or _index = 0.
31793       undo: function() {
31794         select_default2(document).interrupt("history.perform");
31795         var previousStack = _stack[_index];
31796         var previous = previousStack.graph;
31797         while (_index > 0) {
31798           _index--;
31799           if (_stack[_index].annotation) break;
31800         }
31801         dispatch14.call("undone", this, _stack[_index], previousStack);
31802         return change(previous);
31803       },
31804       // Forward to the next annotated state.
31805       redo: function() {
31806         select_default2(document).interrupt("history.perform");
31807         var previousStack = _stack[_index];
31808         var previous = previousStack.graph;
31809         var tryIndex = _index;
31810         while (tryIndex < _stack.length - 1) {
31811           tryIndex++;
31812           if (_stack[tryIndex].annotation) {
31813             _index = tryIndex;
31814             dispatch14.call("redone", this, _stack[_index], previousStack);
31815             break;
31816           }
31817         }
31818         return change(previous);
31819       },
31820       pauseChangeDispatch: function() {
31821         if (!_pausedGraph) {
31822           _pausedGraph = _stack[_index].graph;
31823         }
31824       },
31825       resumeChangeDispatch: function() {
31826         if (_pausedGraph) {
31827           var previous = _pausedGraph;
31828           _pausedGraph = null;
31829           return change(previous);
31830         }
31831       },
31832       undoAnnotation: function() {
31833         var i3 = _index;
31834         while (i3 >= 0) {
31835           if (_stack[i3].annotation) return _stack[i3].annotation;
31836           i3--;
31837         }
31838       },
31839       redoAnnotation: function() {
31840         var i3 = _index + 1;
31841         while (i3 <= _stack.length - 1) {
31842           if (_stack[i3].annotation) return _stack[i3].annotation;
31843           i3++;
31844         }
31845       },
31846       // Returns the entities from the active graph with bounding boxes
31847       // overlapping the given `extent`.
31848       intersects: function(extent) {
31849         return _tree.intersects(extent, _stack[_index].graph);
31850       },
31851       difference: function() {
31852         var base = _stack[0].graph;
31853         var head = _stack[_index].graph;
31854         return coreDifference(base, head);
31855       },
31856       changes: function(action) {
31857         var base = _stack[0].graph;
31858         var head = _stack[_index].graph;
31859         if (action) {
31860           head = action(head);
31861         }
31862         var difference2 = coreDifference(base, head);
31863         return {
31864           modified: difference2.modified(),
31865           created: difference2.created(),
31866           deleted: difference2.deleted()
31867         };
31868       },
31869       hasChanges: function() {
31870         return this.difference().length() > 0;
31871       },
31872       imageryUsed: function(sources) {
31873         if (sources) {
31874           _imageryUsed = sources;
31875           return history;
31876         } else {
31877           var s2 = /* @__PURE__ */ new Set();
31878           _stack.slice(1, _index + 1).forEach(function(state) {
31879             state.imageryUsed.forEach(function(source) {
31880               if (source !== "Custom") {
31881                 s2.add(source);
31882               }
31883             });
31884           });
31885           return Array.from(s2);
31886         }
31887       },
31888       photoOverlaysUsed: function(sources) {
31889         if (sources) {
31890           _photoOverlaysUsed = sources;
31891           return history;
31892         } else {
31893           var s2 = /* @__PURE__ */ new Set();
31894           _stack.slice(1, _index + 1).forEach(function(state) {
31895             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
31896               state.photoOverlaysUsed.forEach(function(photoOverlay) {
31897                 s2.add(photoOverlay);
31898               });
31899             }
31900           });
31901           return Array.from(s2);
31902         }
31903       },
31904       // save the current history state
31905       checkpoint: function(key) {
31906         _checkpoints[key] = {
31907           stack: _stack,
31908           index: _index
31909         };
31910         return history;
31911       },
31912       // restore history state to a given checkpoint or reset completely
31913       reset: function(key) {
31914         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
31915           _stack = _checkpoints[key].stack;
31916           _index = _checkpoints[key].index;
31917         } else {
31918           _stack = [{ graph: coreGraph() }];
31919           _index = 0;
31920           _tree = coreTree(_stack[0].graph);
31921           _checkpoints = {};
31922         }
31923         dispatch14.call("reset");
31924         dispatch14.call("change");
31925         return history;
31926       },
31927       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
31928       //
31929       // To use it:
31930       //  1. Start the walkthrough.
31931       //  2. Get to a "free editing" tutorial step
31932       //  3. Make your edits to the walkthrough map
31933       //  4. In your browser dev console run:
31934       //        `id.history().toIntroGraph()`
31935       //  5. This outputs stringified JSON to the browser console
31936       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
31937       toIntroGraph: function() {
31938         var nextID = { n: 0, r: 0, w: 0 };
31939         var permIDs = {};
31940         var graph = this.graph();
31941         var baseEntities = {};
31942         Object.values(graph.base().entities).forEach(function(entity) {
31943           var copy2 = copyIntroEntity(entity);
31944           baseEntities[copy2.id] = copy2;
31945         });
31946         Object.keys(graph.entities).forEach(function(id2) {
31947           var entity = graph.entities[id2];
31948           if (entity) {
31949             var copy2 = copyIntroEntity(entity);
31950             baseEntities[copy2.id] = copy2;
31951           } else {
31952             delete baseEntities[id2];
31953           }
31954         });
31955         Object.values(baseEntities).forEach(function(entity) {
31956           if (Array.isArray(entity.nodes)) {
31957             entity.nodes = entity.nodes.map(function(node) {
31958               return permIDs[node] || node;
31959             });
31960           }
31961           if (Array.isArray(entity.members)) {
31962             entity.members = entity.members.map(function(member) {
31963               member.id = permIDs[member.id] || member.id;
31964               return member;
31965             });
31966           }
31967         });
31968         return JSON.stringify({ dataIntroGraph: baseEntities });
31969         function copyIntroEntity(source) {
31970           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
31971           if (copy2.tags && !Object.keys(copy2.tags)) {
31972             delete copy2.tags;
31973           }
31974           if (Array.isArray(copy2.loc)) {
31975             copy2.loc[0] = +copy2.loc[0].toFixed(6);
31976             copy2.loc[1] = +copy2.loc[1].toFixed(6);
31977           }
31978           var match = source.id.match(/([nrw])-\d*/);
31979           if (match !== null) {
31980             var nrw = match[1];
31981             var permID;
31982             do {
31983               permID = nrw + ++nextID[nrw];
31984             } while (baseEntities.hasOwnProperty(permID));
31985             copy2.id = permIDs[source.id] = permID;
31986           }
31987           return copy2;
31988         }
31989       },
31990       toJSON: function() {
31991         if (!this.hasChanges()) return;
31992         var allEntities = {};
31993         var baseEntities = {};
31994         var base = _stack[0];
31995         var s2 = _stack.map(function(i3) {
31996           var modified = [];
31997           var deleted = [];
31998           Object.keys(i3.graph.entities).forEach(function(id2) {
31999             var entity = i3.graph.entities[id2];
32000             if (entity) {
32001               var key = osmEntity.key(entity);
32002               allEntities[key] = entity;
32003               modified.push(key);
32004             } else {
32005               deleted.push(id2);
32006             }
32007             if (id2 in base.graph.entities) {
32008               baseEntities[id2] = base.graph.entities[id2];
32009             }
32010             if (entity && entity.nodes) {
32011               entity.nodes.forEach(function(nodeID) {
32012                 if (nodeID in base.graph.entities) {
32013                   baseEntities[nodeID] = base.graph.entities[nodeID];
32014                 }
32015               });
32016             }
32017             var baseParents = base.graph._parentWays[id2];
32018             if (baseParents) {
32019               baseParents.forEach(function(parentID) {
32020                 if (parentID in base.graph.entities) {
32021                   baseEntities[parentID] = base.graph.entities[parentID];
32022                 }
32023               });
32024             }
32025           });
32026           var x2 = {};
32027           if (modified.length) x2.modified = modified;
32028           if (deleted.length) x2.deleted = deleted;
32029           if (i3.imageryUsed) x2.imageryUsed = i3.imageryUsed;
32030           if (i3.photoOverlaysUsed) x2.photoOverlaysUsed = i3.photoOverlaysUsed;
32031           if (i3.annotation) x2.annotation = i3.annotation;
32032           if (i3.transform) x2.transform = i3.transform;
32033           if (i3.selectedIDs) x2.selectedIDs = i3.selectedIDs;
32034           return x2;
32035         });
32036         return JSON.stringify({
32037           version: 3,
32038           entities: Object.values(allEntities),
32039           baseEntities: Object.values(baseEntities),
32040           stack: s2,
32041           nextIDs: osmEntity.id.next,
32042           index: _index,
32043           // note the time the changes were saved
32044           timestamp: (/* @__PURE__ */ new Date()).getTime()
32045         });
32046       },
32047       fromJSON: function(json, loadChildNodes) {
32048         var h3 = JSON.parse(json);
32049         var loadComplete = true;
32050         osmEntity.id.next = h3.nextIDs;
32051         _index = h3.index;
32052         if (h3.version === 2 || h3.version === 3) {
32053           var allEntities = {};
32054           h3.entities.forEach(function(entity) {
32055             allEntities[osmEntity.key(entity)] = osmEntity(entity);
32056           });
32057           if (h3.version === 3) {
32058             var baseEntities = h3.baseEntities.map(function(d2) {
32059               return osmEntity(d2);
32060             });
32061             var stack = _stack.map(function(state) {
32062               return state.graph;
32063             });
32064             _stack[0].graph.rebase(baseEntities, stack, true);
32065             _tree.rebase(baseEntities, true);
32066             if (loadChildNodes) {
32067               var osm = context.connection();
32068               var baseWays = baseEntities.filter(function(e3) {
32069                 return e3.type === "way";
32070               });
32071               var nodeIDs = baseWays.reduce(function(acc, way) {
32072                 return utilArrayUnion(acc, way.nodes);
32073               }, []);
32074               var missing = nodeIDs.filter(function(n3) {
32075                 return !_stack[0].graph.hasEntity(n3);
32076               });
32077               if (missing.length && osm) {
32078                 loadComplete = false;
32079                 context.map().redrawEnable(false);
32080                 var loading = uiLoading(context).blocking(true);
32081                 context.container().call(loading);
32082                 var childNodesLoaded = function(err, result) {
32083                   if (!err) {
32084                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
32085                     var visibles = visibleGroups.true || [];
32086                     var invisibles = visibleGroups.false || [];
32087                     if (visibles.length) {
32088                       var visibleIDs = visibles.map(function(entity) {
32089                         return entity.id;
32090                       });
32091                       var stack2 = _stack.map(function(state) {
32092                         return state.graph;
32093                       });
32094                       missing = utilArrayDifference(missing, visibleIDs);
32095                       _stack[0].graph.rebase(visibles, stack2, true);
32096                       _tree.rebase(visibles, true);
32097                     }
32098                     invisibles.forEach(function(entity) {
32099                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
32100                     });
32101                   }
32102                   if (err || !missing.length) {
32103                     loading.close();
32104                     context.map().redrawEnable(true);
32105                     dispatch14.call("change");
32106                     dispatch14.call("restore", this);
32107                   }
32108                 };
32109                 osm.loadMultiple(missing, childNodesLoaded);
32110               }
32111             }
32112           }
32113           _stack = h3.stack.map(function(d2) {
32114             var entities = {}, entity;
32115             if (d2.modified) {
32116               d2.modified.forEach(function(key) {
32117                 entity = allEntities[key];
32118                 entities[entity.id] = entity;
32119               });
32120             }
32121             if (d2.deleted) {
32122               d2.deleted.forEach(function(id2) {
32123                 entities[id2] = void 0;
32124               });
32125             }
32126             return {
32127               graph: coreGraph(_stack[0].graph).load(entities),
32128               annotation: d2.annotation,
32129               imageryUsed: d2.imageryUsed,
32130               photoOverlaysUsed: d2.photoOverlaysUsed,
32131               transform: d2.transform,
32132               selectedIDs: d2.selectedIDs
32133             };
32134           });
32135         } else {
32136           _stack = h3.stack.map(function(d2) {
32137             var entities = {};
32138             for (var i3 in d2.entities) {
32139               var entity = d2.entities[i3];
32140               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
32141             }
32142             d2.graph = coreGraph(_stack[0].graph).load(entities);
32143             return d2;
32144           });
32145         }
32146         var transform2 = _stack[_index].transform;
32147         if (transform2) {
32148           context.map().transformEase(transform2, 0);
32149         }
32150         if (loadComplete) {
32151           dispatch14.call("change");
32152           dispatch14.call("restore", this);
32153         }
32154         return history;
32155       },
32156       lock: function() {
32157         return lock.lock();
32158       },
32159       unlock: function() {
32160         lock.unlock();
32161       },
32162       save: function() {
32163         if (lock.locked() && // don't overwrite existing, unresolved changes
32164         !_hasUnresolvedRestorableChanges) {
32165           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
32166           if (!success) dispatch14.call("storage_error");
32167         }
32168         return history;
32169       },
32170       // delete the history version saved in localStorage
32171       clearSaved: function() {
32172         context.debouncedSave.cancel();
32173         if (lock.locked()) {
32174           _hasUnresolvedRestorableChanges = false;
32175           corePreferences(getKey("saved_history"), null);
32176           corePreferences("comment", null);
32177           corePreferences("hashtags", null);
32178           corePreferences("source", null);
32179         }
32180         return history;
32181       },
32182       savedHistoryJSON: function() {
32183         return corePreferences(getKey("saved_history"));
32184       },
32185       hasRestorableChanges: function() {
32186         return _hasUnresolvedRestorableChanges;
32187       },
32188       // load history from a version stored in localStorage
32189       restore: function() {
32190         if (lock.locked()) {
32191           _hasUnresolvedRestorableChanges = false;
32192           var json = this.savedHistoryJSON();
32193           if (json) history.fromJSON(json, true);
32194         }
32195       },
32196       _getKey: getKey
32197     };
32198     history.reset();
32199     return utilRebind(history, dispatch14, "on");
32200   }
32201   var init_history = __esm({
32202     "modules/core/history.js"() {
32203       "use strict";
32204       init_src4();
32205       init_src10();
32206       init_src5();
32207       init_preferences();
32208       init_difference();
32209       init_graph();
32210       init_tree();
32211       init_entity();
32212       init_loading();
32213       init_util();
32214     }
32215   });
32216
32217   // modules/util/utilDisplayLabel.js
32218   var utilDisplayLabel_exports = {};
32219   __export(utilDisplayLabel_exports, {
32220     utilDisplayLabel: () => utilDisplayLabel
32221   });
32222   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
32223     var result;
32224     var displayName = utilDisplayName(entity);
32225     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
32226     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
32227     if (verbose) {
32228       result = [presetName, displayName].filter(Boolean).join(" ");
32229     } else {
32230       result = displayName || presetName;
32231     }
32232     return result || utilDisplayType(entity.id);
32233   }
32234   var init_utilDisplayLabel = __esm({
32235     "modules/util/utilDisplayLabel.js"() {
32236       "use strict";
32237       init_presets();
32238       init_util2();
32239     }
32240   });
32241
32242   // modules/core/validation/models.js
32243   var models_exports = {};
32244   __export(models_exports, {
32245     validationIssue: () => validationIssue,
32246     validationIssueFix: () => validationIssueFix
32247   });
32248   function validationIssue(attrs) {
32249     this.type = attrs.type;
32250     this.subtype = attrs.subtype;
32251     this.severity = attrs.severity;
32252     this.message = attrs.message;
32253     this.reference = attrs.reference;
32254     this.entityIds = attrs.entityIds;
32255     this.loc = attrs.loc;
32256     this.data = attrs.data;
32257     this.dynamicFixes = attrs.dynamicFixes;
32258     this.hash = attrs.hash;
32259     this.id = generateID.apply(this);
32260     this.key = generateKey.apply(this);
32261     this.autoFix = null;
32262     function generateID() {
32263       var parts = [this.type];
32264       if (this.hash) {
32265         parts.push(this.hash);
32266       }
32267       if (this.subtype) {
32268         parts.push(this.subtype);
32269       }
32270       if (this.entityIds) {
32271         var entityKeys = this.entityIds.slice().sort();
32272         parts.push.apply(parts, entityKeys);
32273       }
32274       return parts.join(":");
32275     }
32276     function generateKey() {
32277       return this.id + ":" + Date.now().toString();
32278     }
32279     this.extent = function(resolver) {
32280       if (this.loc) {
32281         return geoExtent(this.loc);
32282       }
32283       if (this.entityIds && this.entityIds.length) {
32284         return this.entityIds.reduce(function(extent, entityId) {
32285           return extent.extend(resolver.entity(entityId).extent(resolver));
32286         }, geoExtent());
32287       }
32288       return null;
32289     };
32290     this.fixes = function(context) {
32291       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
32292       var issue = this;
32293       if (issue.severity === "warning") {
32294         fixes.push(new validationIssueFix({
32295           title: _t.append("issues.fix.ignore_issue.title"),
32296           icon: "iD-icon-close",
32297           onClick: function() {
32298             context.validator().ignoreIssue(this.issue.id);
32299           }
32300         }));
32301       }
32302       fixes.forEach(function(fix) {
32303         fix.id = fix.title.stringId;
32304         fix.issue = issue;
32305         if (fix.autoArgs) {
32306           issue.autoFix = fix;
32307         }
32308       });
32309       return fixes;
32310     };
32311   }
32312   function validationIssueFix(attrs) {
32313     this.title = attrs.title;
32314     this.onClick = attrs.onClick;
32315     this.disabledReason = attrs.disabledReason;
32316     this.icon = attrs.icon;
32317     this.entityIds = attrs.entityIds || [];
32318     this.autoArgs = attrs.autoArgs;
32319     this.issue = null;
32320   }
32321   var init_models = __esm({
32322     "modules/core/validation/models.js"() {
32323       "use strict";
32324       init_geo2();
32325       init_localizer();
32326     }
32327   });
32328
32329   // modules/core/validation/index.js
32330   var validation_exports = {};
32331   __export(validation_exports, {
32332     validationIssue: () => validationIssue,
32333     validationIssueFix: () => validationIssueFix
32334   });
32335   var init_validation = __esm({
32336     "modules/core/validation/index.js"() {
32337       "use strict";
32338       init_models();
32339     }
32340   });
32341
32342   // modules/services/keepRight.js
32343   var keepRight_exports = {};
32344   __export(keepRight_exports, {
32345     default: () => keepRight_default
32346   });
32347   function abortRequest(controller) {
32348     if (controller) {
32349       controller.abort();
32350     }
32351   }
32352   function abortUnwantedRequests(cache, tiles) {
32353     Object.keys(cache.inflightTile).forEach((k3) => {
32354       const wanted = tiles.find((tile) => k3 === tile.id);
32355       if (!wanted) {
32356         abortRequest(cache.inflightTile[k3]);
32357         delete cache.inflightTile[k3];
32358       }
32359     });
32360   }
32361   function encodeIssueRtree(d2) {
32362     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
32363   }
32364   function updateRtree(item, replace) {
32365     _cache.rtree.remove(item, (a4, b3) => a4.data.id === b3.data.id);
32366     if (replace) {
32367       _cache.rtree.insert(item);
32368     }
32369   }
32370   function tokenReplacements(d2) {
32371     if (!(d2 instanceof QAItem)) return;
32372     const replacements = {};
32373     const issueTemplate = _krData.errorTypes[d2.whichType];
32374     if (!issueTemplate) {
32375       console.log("No Template: ", d2.whichType);
32376       console.log("  ", d2.description);
32377       return;
32378     }
32379     if (!issueTemplate.regex) return;
32380     const errorRegex = new RegExp(issueTemplate.regex, "i");
32381     const errorMatch = errorRegex.exec(d2.description);
32382     if (!errorMatch) {
32383       console.log("Unmatched: ", d2.whichType);
32384       console.log("  ", d2.description);
32385       console.log("  ", errorRegex);
32386       return;
32387     }
32388     for (let i3 = 1; i3 < errorMatch.length; i3++) {
32389       let capture = errorMatch[i3];
32390       let idType;
32391       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
32392       if (idType && capture) {
32393         capture = parseError(capture, idType);
32394       } else {
32395         const compare2 = capture.toLowerCase();
32396         if (_krData.localizeStrings[compare2]) {
32397           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
32398         } else {
32399           capture = unescape_default(capture);
32400         }
32401       }
32402       replacements["var" + i3] = capture;
32403     }
32404     return replacements;
32405   }
32406   function parseError(capture, idType) {
32407     const compare2 = capture.toLowerCase();
32408     if (_krData.localizeStrings[compare2]) {
32409       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
32410     }
32411     switch (idType) {
32412       // link a string like "this node"
32413       case "this":
32414         capture = linkErrorObject(capture);
32415         break;
32416       case "url":
32417         capture = linkURL(capture);
32418         break;
32419       // link an entity ID
32420       case "n":
32421       case "w":
32422       case "r":
32423         capture = linkEntity(idType + capture);
32424         break;
32425       // some errors have more complex ID lists/variance
32426       case "20":
32427         capture = parse20(capture);
32428         break;
32429       case "211":
32430         capture = parse211(capture);
32431         break;
32432       case "231":
32433         capture = parse231(capture);
32434         break;
32435       case "294":
32436         capture = parse294(capture);
32437         break;
32438       case "370":
32439         capture = parse370(capture);
32440         break;
32441     }
32442     return capture;
32443     function linkErrorObject(d2) {
32444       return { html: `<a class="error_object_link">${d2}</a>` };
32445     }
32446     function linkEntity(d2) {
32447       return { html: `<a class="error_entity_link">${d2}</a>` };
32448     }
32449     function linkURL(d2) {
32450       return { html: `<a class="kr_external_link" target="_blank" href="${d2}">${d2}</a>` };
32451     }
32452     function parse211(capture2) {
32453       let newList = [];
32454       const items = capture2.split(", ");
32455       items.forEach((item) => {
32456         let id2 = linkEntity("n" + item.slice(1));
32457         newList.push(id2);
32458       });
32459       return newList.join(", ");
32460     }
32461     function parse231(capture2) {
32462       let newList = [];
32463       const items = capture2.split("),");
32464       items.forEach((item) => {
32465         const match = item.match(/\#(\d+)\((.+)\)?/);
32466         if (match !== null && match.length > 2) {
32467           newList.push(
32468             linkEntity("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
32469           );
32470         }
32471       });
32472       return newList.join(", ");
32473     }
32474     function parse294(capture2) {
32475       let newList = [];
32476       const items = capture2.split(",");
32477       items.forEach((item) => {
32478         item = item.split(" ");
32479         const role = `"${item[0]}"`;
32480         const idType2 = item[1].slice(0, 1);
32481         let id2 = item[2].slice(1);
32482         id2 = linkEntity(idType2 + id2);
32483         newList.push(`${role} ${item[1]} ${id2}`);
32484       });
32485       return newList.join(", ");
32486     }
32487     function parse370(capture2) {
32488       if (!capture2) return "";
32489       const match = capture2.match(/\(including the name (\'.+\')\)/);
32490       if (match && match.length) {
32491         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
32492       }
32493       return "";
32494     }
32495     function parse20(capture2) {
32496       let newList = [];
32497       const items = capture2.split(",");
32498       items.forEach((item) => {
32499         const id2 = linkEntity("n" + item.slice(1));
32500         newList.push(id2);
32501       });
32502       return newList.join(", ");
32503     }
32504   }
32505   var tiler, dispatch2, _tileZoom, _krUrlRoot, _krData, _cache, _krRuleset, keepRight_default;
32506   var init_keepRight = __esm({
32507     "modules/services/keepRight.js"() {
32508       "use strict";
32509       init_rbush();
32510       init_src4();
32511       init_src18();
32512       init_lodash();
32513       init_file_fetcher();
32514       init_geo2();
32515       init_osm();
32516       init_localizer();
32517       init_util();
32518       tiler = utilTiler();
32519       dispatch2 = dispatch_default("loaded");
32520       _tileZoom = 14;
32521       _krUrlRoot = "https://www.keepright.at";
32522       _krData = { errorTypes: {}, localizeStrings: {} };
32523       _krRuleset = [
32524         // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
32525         30,
32526         40,
32527         50,
32528         60,
32529         70,
32530         90,
32531         100,
32532         110,
32533         120,
32534         130,
32535         150,
32536         160,
32537         170,
32538         180,
32539         190,
32540         191,
32541         192,
32542         193,
32543         194,
32544         195,
32545         196,
32546         197,
32547         198,
32548         200,
32549         201,
32550         202,
32551         203,
32552         204,
32553         205,
32554         206,
32555         207,
32556         208,
32557         210,
32558         220,
32559         230,
32560         231,
32561         232,
32562         270,
32563         280,
32564         281,
32565         282,
32566         283,
32567         284,
32568         285,
32569         290,
32570         291,
32571         292,
32572         293,
32573         294,
32574         295,
32575         296,
32576         297,
32577         298,
32578         300,
32579         310,
32580         311,
32581         312,
32582         313,
32583         320,
32584         350,
32585         360,
32586         370,
32587         380,
32588         390,
32589         400,
32590         401,
32591         402,
32592         410,
32593         411,
32594         412,
32595         413
32596       ];
32597       keepRight_default = {
32598         title: "keepRight",
32599         init() {
32600           _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
32601           if (!_cache) {
32602             this.reset();
32603           }
32604           this.event = utilRebind(this, dispatch2, "on");
32605         },
32606         reset() {
32607           if (_cache) {
32608             Object.values(_cache.inflightTile).forEach(abortRequest);
32609           }
32610           _cache = {
32611             data: {},
32612             loadedTile: {},
32613             inflightTile: {},
32614             inflightPost: {},
32615             closed: {},
32616             rtree: new RBush()
32617           };
32618         },
32619         // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
32620         loadIssues(projection2) {
32621           const options = {
32622             format: "geojson",
32623             ch: _krRuleset
32624           };
32625           const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
32626           abortUnwantedRequests(_cache, tiles);
32627           tiles.forEach((tile) => {
32628             if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) return;
32629             const [left, top, right, bottom] = tile.extent.rectangle();
32630             const params = Object.assign({}, options, { left, bottom, right, top });
32631             const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
32632             const controller = new AbortController();
32633             _cache.inflightTile[tile.id] = controller;
32634             json_default(url, { signal: controller.signal }).then((data) => {
32635               delete _cache.inflightTile[tile.id];
32636               _cache.loadedTile[tile.id] = true;
32637               if (!data || !data.features || !data.features.length) {
32638                 throw new Error("No Data");
32639               }
32640               data.features.forEach((feature3) => {
32641                 const {
32642                   properties: {
32643                     error_type: itemType,
32644                     error_id: id2,
32645                     comment = null,
32646                     object_id: objectId,
32647                     object_type: objectType,
32648                     schema,
32649                     title
32650                   }
32651                 } = feature3;
32652                 let {
32653                   geometry: { coordinates: loc },
32654                   properties: { description = "" }
32655                 } = feature3;
32656                 const issueTemplate = _krData.errorTypes[itemType];
32657                 const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
32658                 const whichType = issueTemplate ? itemType : parentIssueType;
32659                 const whichTemplate = _krData.errorTypes[whichType];
32660                 switch (whichType) {
32661                   case "170":
32662                     description = `This feature has a FIXME tag: ${description}`;
32663                     break;
32664                   case "292":
32665                   case "293":
32666                     description = description.replace("A turn-", "This turn-");
32667                     break;
32668                   case "294":
32669                   case "295":
32670                   case "296":
32671                   case "297":
32672                   case "298":
32673                     description = `This turn-restriction~${description}`;
32674                     break;
32675                   case "300":
32676                     description = "This highway is missing a maxspeed tag";
32677                     break;
32678                   case "411":
32679                   case "412":
32680                   case "413":
32681                     description = `This feature~${description}`;
32682                     break;
32683                 }
32684                 let coincident = false;
32685                 do {
32686                   let delta = coincident ? [1e-5, 0] : [0, 1e-5];
32687                   loc = geoVecAdd(loc, delta);
32688                   let bbox2 = geoExtent(loc).bbox();
32689                   coincident = _cache.rtree.search(bbox2).length;
32690                 } while (coincident);
32691                 let d2 = new QAItem(loc, this, itemType, id2, {
32692                   comment,
32693                   description,
32694                   whichType,
32695                   parentIssueType,
32696                   severity: whichTemplate.severity || "error",
32697                   objectId,
32698                   objectType,
32699                   schema,
32700                   title
32701                 });
32702                 d2.replacements = tokenReplacements(d2);
32703                 _cache.data[id2] = d2;
32704                 _cache.rtree.insert(encodeIssueRtree(d2));
32705               });
32706               dispatch2.call("loaded");
32707             }).catch(() => {
32708               delete _cache.inflightTile[tile.id];
32709               _cache.loadedTile[tile.id] = true;
32710             });
32711           });
32712         },
32713         postUpdate(d2, callback) {
32714           if (_cache.inflightPost[d2.id]) {
32715             return callback({ message: "Error update already inflight", status: -2 }, d2);
32716           }
32717           const params = { schema: d2.schema, id: d2.id };
32718           if (d2.newStatus) {
32719             params.st = d2.newStatus;
32720           }
32721           if (d2.newComment !== void 0) {
32722             params.co = d2.newComment;
32723           }
32724           const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
32725           const controller = new AbortController();
32726           _cache.inflightPost[d2.id] = controller;
32727           json_default(url, { signal: controller.signal }).finally(() => {
32728             delete _cache.inflightPost[d2.id];
32729             if (d2.newStatus === "ignore") {
32730               this.removeItem(d2);
32731             } else if (d2.newStatus === "ignore_t") {
32732               this.removeItem(d2);
32733               _cache.closed[`${d2.schema}:${d2.id}`] = true;
32734             } else {
32735               d2 = this.replaceItem(d2.update({
32736                 comment: d2.newComment,
32737                 newComment: void 0,
32738                 newState: void 0
32739               }));
32740             }
32741             if (callback) callback(null, d2);
32742           });
32743         },
32744         // Get all cached QAItems covering the viewport
32745         getItems(projection2) {
32746           const viewport = projection2.clipExtent();
32747           const min3 = [viewport[0][0], viewport[1][1]];
32748           const max3 = [viewport[1][0], viewport[0][1]];
32749           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
32750           return _cache.rtree.search(bbox2).map((d2) => d2.data);
32751         },
32752         // Get a QAItem from cache
32753         // NOTE: Don't change method name until UI v3 is merged
32754         getError(id2) {
32755           return _cache.data[id2];
32756         },
32757         // Replace a single QAItem in the cache
32758         replaceItem(item) {
32759           if (!(item instanceof QAItem) || !item.id) return;
32760           _cache.data[item.id] = item;
32761           updateRtree(encodeIssueRtree(item), true);
32762           return item;
32763         },
32764         // Remove a single QAItem from the cache
32765         removeItem(item) {
32766           if (!(item instanceof QAItem) || !item.id) return;
32767           delete _cache.data[item.id];
32768           updateRtree(encodeIssueRtree(item), false);
32769         },
32770         issueURL(item) {
32771           return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
32772         },
32773         // Get an array of issues closed during this session.
32774         // Used to populate `closed:keepright` changeset tag
32775         getClosedIDs() {
32776           return Object.keys(_cache.closed).sort();
32777         }
32778       };
32779     }
32780   });
32781
32782   // node_modules/marked/lib/marked.esm.js
32783   function M() {
32784     return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
32785   }
32786   function H(a4) {
32787     w = a4;
32788   }
32789   function h(a4, e3 = "") {
32790     let t2 = typeof a4 == "string" ? a4 : a4.source, n3 = { replace: (s2, i3) => {
32791       let r2 = typeof i3 == "string" ? i3 : i3.source;
32792       return r2 = r2.replace(m.caret, "$1"), t2 = t2.replace(s2, r2), n3;
32793     }, getRegex: () => new RegExp(t2, e3) };
32794     return n3;
32795   }
32796   function R(a4, e3) {
32797     if (e3) {
32798       if (m.escapeTest.test(a4)) return a4.replace(m.escapeReplace, ge);
32799     } else if (m.escapeTestNoEncode.test(a4)) return a4.replace(m.escapeReplaceNoEncode, ge);
32800     return a4;
32801   }
32802   function J(a4) {
32803     try {
32804       a4 = encodeURI(a4).replace(m.percentDecode, "%");
32805     } catch {
32806       return null;
32807     }
32808     return a4;
32809   }
32810   function V(a4, e3) {
32811     var _a4;
32812     let t2 = a4.replace(m.findPipe, (i3, r2, o2) => {
32813       let l2 = false, c2 = r2;
32814       for (; --c2 >= 0 && o2[c2] === "\\"; ) l2 = !l2;
32815       return l2 ? "|" : " |";
32816     }), n3 = t2.split(m.splitPipe), s2 = 0;
32817     if (n3[0].trim() || n3.shift(), n3.length > 0 && !((_a4 = n3.at(-1)) == null ? void 0 : _a4.trim()) && n3.pop(), e3) if (n3.length > e3) n3.splice(e3);
32818     else for (; n3.length < e3; ) n3.push("");
32819     for (; s2 < n3.length; s2++) n3[s2] = n3[s2].trim().replace(m.slashPipe, "|");
32820     return n3;
32821   }
32822   function A(a4, e3, t2) {
32823     let n3 = a4.length;
32824     if (n3 === 0) return "";
32825     let s2 = 0;
32826     for (; s2 < n3; ) {
32827       let i3 = a4.charAt(n3 - s2 - 1);
32828       if (i3 === e3 && !t2) s2++;
32829       else if (i3 !== e3 && t2) s2++;
32830       else break;
32831     }
32832     return a4.slice(0, n3 - s2);
32833   }
32834   function fe(a4, e3) {
32835     if (a4.indexOf(e3[1]) === -1) return -1;
32836     let t2 = 0;
32837     for (let n3 = 0; n3 < a4.length; n3++) if (a4[n3] === "\\") n3++;
32838     else if (a4[n3] === e3[0]) t2++;
32839     else if (a4[n3] === e3[1] && (t2--, t2 < 0)) return n3;
32840     return t2 > 0 ? -2 : -1;
32841   }
32842   function de(a4, e3, t2, n3, s2) {
32843     let i3 = e3.href, r2 = e3.title || null, o2 = a4[1].replace(s2.other.outputLinkReplace, "$1");
32844     n3.state.inLink = true;
32845     let l2 = { type: a4[0].charAt(0) === "!" ? "image" : "link", raw: t2, href: i3, title: r2, text: o2, tokens: n3.inlineTokens(o2) };
32846     return n3.state.inLink = false, l2;
32847   }
32848   function Je(a4, e3, t2) {
32849     let n3 = a4.match(t2.other.indentCodeCompensation);
32850     if (n3 === null) return e3;
32851     let s2 = n3[1];
32852     return e3.split(`
32853 `).map((i3) => {
32854       let r2 = i3.match(t2.other.beginningSpace);
32855       if (r2 === null) return i3;
32856       let [o2] = r2;
32857       return o2.length >= s2.length ? i3.slice(s2.length) : i3;
32858     }).join(`
32859 `);
32860   }
32861   function k(a4, e3) {
32862     return z.parse(a4, e3);
32863   }
32864   var w, C, m, xe, be, Te, I, we, j, re2, ie, ye, F, Re, Q, Se, $e, v, U, _e, oe, Le, K, se, ze, Me, Pe, Ae, le, Ee, D, X, ae, Ce, ce, Ie, Oe, Be, pe, qe, ve, ue, De, Ze, Ge, He, Ne, je, Fe, q, Qe, he, ke, Ue, W, Ke, N, Xe, O, P, We, ge, S, b, $, _, T, _a2, L, B, z, Dt, Zt, Gt, Ht, Nt, Ft, Qt;
32865   var init_marked_esm = __esm({
32866     "node_modules/marked/lib/marked.esm.js"() {
32867       w = M();
32868       C = { exec: () => null };
32869       m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (a4) => new RegExp(`^( {0,3}${a4})((?:[  ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[   ][^\\n]*)?(?:\\n|$))`), hrRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}#`), htmlBeginRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}<(?:[a-z].*>|!--)`, "i") };
32870       xe = /^(?:[ \t]*(?:\n|$))+/;
32871       be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
32872       Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
32873       I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
32874       we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
32875       j = /(?:[*+-]|\d{1,9}[.)])/;
32876       re2 = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
32877       ie = h(re2).replace(/bull/g, j).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();
32878       ye = h(re2).replace(/bull/g, j).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();
32879       F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
32880       Re = /^[^\n]+/;
32881       Q = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
32882       Se = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
32883       $e = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex();
32884       v = "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";
32885       U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
32886       _e = h("^ {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", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
32887       oe = h(F).replace("hr", I).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", v).getRegex();
32888       Le = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex();
32889       K = { blockquote: Le, code: be, def: Se, fences: Te, heading: we, hr: I, html: _e, lheading: ie, list: $e, newline: xe, paragraph: oe, table: C, text: Re };
32890       se = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).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", v).getRegex();
32891       ze = { ...K, lheading: ye, table: se, paragraph: h(F).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).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", v).getRegex() };
32892       Me = { ...K, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: C, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(F).replace("hr", I).replace("heading", ` *#{1,6} *[^
32893 ]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
32894       Pe = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
32895       Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
32896       le = /^( {2,}|\\)\n(?!\s*$)/;
32897       Ee = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
32898       D = /[\p{P}\p{S}]/u;
32899       X = /[\s\p{P}\p{S}]/u;
32900       ae = /[^\s\p{P}\p{S}]/u;
32901       Ce = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, X).getRegex();
32902       ce = /(?!~)[\p{P}\p{S}]/u;
32903       Ie = /(?!~)[\s\p{P}\p{S}]/u;
32904       Oe = /(?:[^\s\p{P}\p{S}]|~)/u;
32905       Be = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
32906       pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
32907       qe = h(pe, "u").replace(/punct/g, D).getRegex();
32908       ve = h(pe, "u").replace(/punct/g, ce).getRegex();
32909       ue = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
32910       De = h(ue, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, X).replace(/punct/g, D).getRegex();
32911       Ze = h(ue, "gu").replace(/notPunctSpace/g, Oe).replace(/punctSpace/g, Ie).replace(/punct/g, ce).getRegex();
32912       Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, X).replace(/punct/g, D).getRegex();
32913       He = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex();
32914       Ne = h(/^<(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();
32915       je = h(U).replace("(?:-->|$)", "-->").getRegex();
32916       Fe = h("^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", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
32917       q = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
32918       Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
32919       he = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex();
32920       ke = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex();
32921       Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex();
32922       W = { _backpedal: C, anyPunctuation: He, autolink: Ne, blockSkip: Be, br: le, code: Ae, del: C, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ge, escape: Pe, link: Qe, nolink: ke, punctuation: Ce, reflink: he, reflinkSearch: Ue, tag: Fe, text: Ee, url: C };
32923       Ke = { ...W, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() };
32924       N = { ...W, emStrongRDelimAst: Ze, emStrongLDelim: ve, url: h(/^((?: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(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ };
32925       Xe = { ...N, br: h(le).replace("{2,}", "*").getRegex(), text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
32926       O = { normal: K, gfm: ze, pedantic: Me };
32927       P = { normal: W, gfm: N, breaks: Xe, pedantic: Ke };
32928       We = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
32929       ge = (a4) => We[a4];
32930       S = class {
32931         constructor(e3) {
32932           __publicField(this, "options");
32933           __publicField(this, "rules");
32934           __publicField(this, "lexer");
32935           this.options = e3 || w;
32936         }
32937         space(e3) {
32938           let t2 = this.rules.block.newline.exec(e3);
32939           if (t2 && t2[0].length > 0) return { type: "space", raw: t2[0] };
32940         }
32941         code(e3) {
32942           let t2 = this.rules.block.code.exec(e3);
32943           if (t2) {
32944             let n3 = t2[0].replace(this.rules.other.codeRemoveIndent, "");
32945             return { type: "code", raw: t2[0], codeBlockStyle: "indented", text: this.options.pedantic ? n3 : A(n3, `
32946 `) };
32947           }
32948         }
32949         fences(e3) {
32950           let t2 = this.rules.block.fences.exec(e3);
32951           if (t2) {
32952             let n3 = t2[0], s2 = Je(n3, t2[3] || "", this.rules);
32953             return { type: "code", raw: n3, lang: t2[2] ? t2[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t2[2], text: s2 };
32954           }
32955         }
32956         heading(e3) {
32957           let t2 = this.rules.block.heading.exec(e3);
32958           if (t2) {
32959             let n3 = t2[2].trim();
32960             if (this.rules.other.endingHash.test(n3)) {
32961               let s2 = A(n3, "#");
32962               (this.options.pedantic || !s2 || this.rules.other.endingSpaceChar.test(s2)) && (n3 = s2.trim());
32963             }
32964             return { type: "heading", raw: t2[0], depth: t2[1].length, text: n3, tokens: this.lexer.inline(n3) };
32965           }
32966         }
32967         hr(e3) {
32968           let t2 = this.rules.block.hr.exec(e3);
32969           if (t2) return { type: "hr", raw: A(t2[0], `
32970 `) };
32971         }
32972         blockquote(e3) {
32973           let t2 = this.rules.block.blockquote.exec(e3);
32974           if (t2) {
32975             let n3 = A(t2[0], `
32976 `).split(`
32977 `), s2 = "", i3 = "", r2 = [];
32978             for (; n3.length > 0; ) {
32979               let o2 = false, l2 = [], c2;
32980               for (c2 = 0; c2 < n3.length; c2++) if (this.rules.other.blockquoteStart.test(n3[c2])) l2.push(n3[c2]), o2 = true;
32981               else if (!o2) l2.push(n3[c2]);
32982               else break;
32983               n3 = n3.slice(c2);
32984               let p2 = l2.join(`
32985 `), u2 = p2.replace(this.rules.other.blockquoteSetextReplace, `
32986     $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
32987               s2 = s2 ? `${s2}
32988 ${p2}` : p2, i3 = i3 ? `${i3}
32989 ${u2}` : u2;
32990               let d2 = this.lexer.state.top;
32991               if (this.lexer.state.top = true, this.lexer.blockTokens(u2, r2, true), this.lexer.state.top = d2, n3.length === 0) break;
32992               let g3 = r2.at(-1);
32993               if ((g3 == null ? void 0 : g3.type) === "code") break;
32994               if ((g3 == null ? void 0 : g3.type) === "blockquote") {
32995                 let x2 = g3, f2 = x2.raw + `
32996 ` + n3.join(`
32997 `), y2 = this.blockquote(f2);
32998                 r2[r2.length - 1] = y2, s2 = s2.substring(0, s2.length - x2.raw.length) + y2.raw, i3 = i3.substring(0, i3.length - x2.text.length) + y2.text;
32999                 break;
33000               } else if ((g3 == null ? void 0 : g3.type) === "list") {
33001                 let x2 = g3, f2 = x2.raw + `
33002 ` + n3.join(`
33003 `), y2 = this.list(f2);
33004                 r2[r2.length - 1] = y2, s2 = s2.substring(0, s2.length - g3.raw.length) + y2.raw, i3 = i3.substring(0, i3.length - x2.raw.length) + y2.raw, n3 = f2.substring(r2.at(-1).raw.length).split(`
33005 `);
33006                 continue;
33007               }
33008             }
33009             return { type: "blockquote", raw: s2, tokens: r2, text: i3 };
33010           }
33011         }
33012         list(e3) {
33013           let t2 = this.rules.block.list.exec(e3);
33014           if (t2) {
33015             let n3 = t2[1].trim(), s2 = n3.length > 1, i3 = { type: "list", raw: "", ordered: s2, start: s2 ? +n3.slice(0, -1) : "", loose: false, items: [] };
33016             n3 = s2 ? `\\d{1,9}\\${n3.slice(-1)}` : `\\${n3}`, this.options.pedantic && (n3 = s2 ? n3 : "[*+-]");
33017             let r2 = this.rules.other.listItemRegex(n3), o2 = false;
33018             for (; e3; ) {
33019               let c2 = false, p2 = "", u2 = "";
33020               if (!(t2 = r2.exec(e3)) || this.rules.block.hr.test(e3)) break;
33021               p2 = t2[0], e3 = e3.substring(p2.length);
33022               let d2 = t2[2].split(`
33023 `, 1)[0].replace(this.rules.other.listReplaceTabs, (Z3) => " ".repeat(3 * Z3.length)), g3 = e3.split(`
33024 `, 1)[0], x2 = !d2.trim(), f2 = 0;
33025               if (this.options.pedantic ? (f2 = 2, u2 = d2.trimStart()) : x2 ? f2 = t2[1].length + 1 : (f2 = t2[2].search(this.rules.other.nonSpaceChar), f2 = f2 > 4 ? 1 : f2, u2 = d2.slice(f2), f2 += t2[1].length), x2 && this.rules.other.blankLine.test(g3) && (p2 += g3 + `
33026 `, e3 = e3.substring(g3.length + 1), c2 = true), !c2) {
33027                 let Z3 = this.rules.other.nextBulletRegex(f2), ee2 = this.rules.other.hrRegex(f2), te2 = this.rules.other.fencesBeginRegex(f2), ne2 = this.rules.other.headingBeginRegex(f2), me2 = this.rules.other.htmlBeginRegex(f2);
33028                 for (; e3; ) {
33029                   let G2 = e3.split(`
33030 `, 1)[0], E2;
33031                   if (g3 = G2, this.options.pedantic ? (g3 = g3.replace(this.rules.other.listReplaceNesting, "  "), E2 = g3) : E2 = g3.replace(this.rules.other.tabCharGlobal, "    "), te2.test(g3) || ne2.test(g3) || me2.test(g3) || Z3.test(g3) || ee2.test(g3)) break;
33032                   if (E2.search(this.rules.other.nonSpaceChar) >= f2 || !g3.trim()) u2 += `
33033 ` + E2.slice(f2);
33034                   else {
33035                     if (x2 || d2.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || te2.test(d2) || ne2.test(d2) || ee2.test(d2)) break;
33036                     u2 += `
33037 ` + g3;
33038                   }
33039                   !x2 && !g3.trim() && (x2 = true), p2 += G2 + `
33040 `, e3 = e3.substring(G2.length + 1), d2 = E2.slice(f2);
33041                 }
33042               }
33043               i3.loose || (o2 ? i3.loose = true : this.rules.other.doubleBlankLine.test(p2) && (o2 = true));
33044               let y2 = null, Y4;
33045               this.options.gfm && (y2 = this.rules.other.listIsTask.exec(u2), y2 && (Y4 = y2[0] !== "[ ] ", u2 = u2.replace(this.rules.other.listReplaceTask, ""))), i3.items.push({ type: "list_item", raw: p2, task: !!y2, checked: Y4, loose: false, text: u2, tokens: [] }), i3.raw += p2;
33046             }
33047             let l2 = i3.items.at(-1);
33048             if (l2) l2.raw = l2.raw.trimEnd(), l2.text = l2.text.trimEnd();
33049             else return;
33050             i3.raw = i3.raw.trimEnd();
33051             for (let c2 = 0; c2 < i3.items.length; c2++) if (this.lexer.state.top = false, i3.items[c2].tokens = this.lexer.blockTokens(i3.items[c2].text, []), !i3.loose) {
33052               let p2 = i3.items[c2].tokens.filter((d2) => d2.type === "space"), u2 = p2.length > 0 && p2.some((d2) => this.rules.other.anyLine.test(d2.raw));
33053               i3.loose = u2;
33054             }
33055             if (i3.loose) for (let c2 = 0; c2 < i3.items.length; c2++) i3.items[c2].loose = true;
33056             return i3;
33057           }
33058         }
33059         html(e3) {
33060           let t2 = this.rules.block.html.exec(e3);
33061           if (t2) return { type: "html", block: true, raw: t2[0], pre: t2[1] === "pre" || t2[1] === "script" || t2[1] === "style", text: t2[0] };
33062         }
33063         def(e3) {
33064           let t2 = this.rules.block.def.exec(e3);
33065           if (t2) {
33066             let n3 = t2[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s2 = t2[2] ? t2[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i3 = t2[3] ? t2[3].substring(1, t2[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t2[3];
33067             return { type: "def", tag: n3, raw: t2[0], href: s2, title: i3 };
33068           }
33069         }
33070         table(e3) {
33071           var _a4;
33072           let t2 = this.rules.block.table.exec(e3);
33073           if (!t2 || !this.rules.other.tableDelimiter.test(t2[2])) return;
33074           let n3 = V(t2[1]), s2 = t2[2].replace(this.rules.other.tableAlignChars, "").split("|"), i3 = ((_a4 = t2[3]) == null ? void 0 : _a4.trim()) ? t2[3].replace(this.rules.other.tableRowBlankLine, "").split(`
33075 `) : [], r2 = { type: "table", raw: t2[0], header: [], align: [], rows: [] };
33076           if (n3.length === s2.length) {
33077             for (let o2 of s2) this.rules.other.tableAlignRight.test(o2) ? r2.align.push("right") : this.rules.other.tableAlignCenter.test(o2) ? r2.align.push("center") : this.rules.other.tableAlignLeft.test(o2) ? r2.align.push("left") : r2.align.push(null);
33078             for (let o2 = 0; o2 < n3.length; o2++) r2.header.push({ text: n3[o2], tokens: this.lexer.inline(n3[o2]), header: true, align: r2.align[o2] });
33079             for (let o2 of i3) r2.rows.push(V(o2, r2.header.length).map((l2, c2) => ({ text: l2, tokens: this.lexer.inline(l2), header: false, align: r2.align[c2] })));
33080             return r2;
33081           }
33082         }
33083         lheading(e3) {
33084           let t2 = this.rules.block.lheading.exec(e3);
33085           if (t2) return { type: "heading", raw: t2[0], depth: t2[2].charAt(0) === "=" ? 1 : 2, text: t2[1], tokens: this.lexer.inline(t2[1]) };
33086         }
33087         paragraph(e3) {
33088           let t2 = this.rules.block.paragraph.exec(e3);
33089           if (t2) {
33090             let n3 = t2[1].charAt(t2[1].length - 1) === `
33091 ` ? t2[1].slice(0, -1) : t2[1];
33092             return { type: "paragraph", raw: t2[0], text: n3, tokens: this.lexer.inline(n3) };
33093           }
33094         }
33095         text(e3) {
33096           let t2 = this.rules.block.text.exec(e3);
33097           if (t2) return { type: "text", raw: t2[0], text: t2[0], tokens: this.lexer.inline(t2[0]) };
33098         }
33099         escape(e3) {
33100           let t2 = this.rules.inline.escape.exec(e3);
33101           if (t2) return { type: "escape", raw: t2[0], text: t2[1] };
33102         }
33103         tag(e3) {
33104           let t2 = this.rules.inline.tag.exec(e3);
33105           if (t2) return !this.lexer.state.inLink && this.rules.other.startATag.test(t2[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t2[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t2[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t2[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t2[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t2[0] };
33106         }
33107         link(e3) {
33108           let t2 = this.rules.inline.link.exec(e3);
33109           if (t2) {
33110             let n3 = t2[2].trim();
33111             if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n3)) {
33112               if (!this.rules.other.endAngleBracket.test(n3)) return;
33113               let r2 = A(n3.slice(0, -1), "\\");
33114               if ((n3.length - r2.length) % 2 === 0) return;
33115             } else {
33116               let r2 = fe(t2[2], "()");
33117               if (r2 === -2) return;
33118               if (r2 > -1) {
33119                 let l2 = (t2[0].indexOf("!") === 0 ? 5 : 4) + t2[1].length + r2;
33120                 t2[2] = t2[2].substring(0, r2), t2[0] = t2[0].substring(0, l2).trim(), t2[3] = "";
33121               }
33122             }
33123             let s2 = t2[2], i3 = "";
33124             if (this.options.pedantic) {
33125               let r2 = this.rules.other.pedanticHrefTitle.exec(s2);
33126               r2 && (s2 = r2[1], i3 = r2[3]);
33127             } else i3 = t2[3] ? t2[3].slice(1, -1) : "";
33128             return s2 = s2.trim(), this.rules.other.startAngleBracket.test(s2) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n3) ? s2 = s2.slice(1) : s2 = s2.slice(1, -1)), de(t2, { href: s2 && s2.replace(this.rules.inline.anyPunctuation, "$1"), title: i3 && i3.replace(this.rules.inline.anyPunctuation, "$1") }, t2[0], this.lexer, this.rules);
33129           }
33130         }
33131         reflink(e3, t2) {
33132           let n3;
33133           if ((n3 = this.rules.inline.reflink.exec(e3)) || (n3 = this.rules.inline.nolink.exec(e3))) {
33134             let s2 = (n3[2] || n3[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i3 = t2[s2.toLowerCase()];
33135             if (!i3) {
33136               let r2 = n3[0].charAt(0);
33137               return { type: "text", raw: r2, text: r2 };
33138             }
33139             return de(n3, i3, n3[0], this.lexer, this.rules);
33140           }
33141         }
33142         emStrong(e3, t2, n3 = "") {
33143           let s2 = this.rules.inline.emStrongLDelim.exec(e3);
33144           if (!s2 || s2[3] && n3.match(this.rules.other.unicodeAlphaNumeric)) return;
33145           if (!(s2[1] || s2[2] || "") || !n3 || this.rules.inline.punctuation.exec(n3)) {
33146             let r2 = [...s2[0]].length - 1, o2, l2, c2 = r2, p2 = 0, u2 = s2[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
33147             for (u2.lastIndex = 0, t2 = t2.slice(-1 * e3.length + r2); (s2 = u2.exec(t2)) != null; ) {
33148               if (o2 = s2[1] || s2[2] || s2[3] || s2[4] || s2[5] || s2[6], !o2) continue;
33149               if (l2 = [...o2].length, s2[3] || s2[4]) {
33150                 c2 += l2;
33151                 continue;
33152               } else if ((s2[5] || s2[6]) && r2 % 3 && !((r2 + l2) % 3)) {
33153                 p2 += l2;
33154                 continue;
33155               }
33156               if (c2 -= l2, c2 > 0) continue;
33157               l2 = Math.min(l2, l2 + c2 + p2);
33158               let d2 = [...s2[0]][0].length, g3 = e3.slice(0, r2 + s2.index + d2 + l2);
33159               if (Math.min(r2, l2) % 2) {
33160                 let f2 = g3.slice(1, -1);
33161                 return { type: "em", raw: g3, text: f2, tokens: this.lexer.inlineTokens(f2) };
33162               }
33163               let x2 = g3.slice(2, -2);
33164               return { type: "strong", raw: g3, text: x2, tokens: this.lexer.inlineTokens(x2) };
33165             }
33166           }
33167         }
33168         codespan(e3) {
33169           let t2 = this.rules.inline.code.exec(e3);
33170           if (t2) {
33171             let n3 = t2[2].replace(this.rules.other.newLineCharGlobal, " "), s2 = this.rules.other.nonSpaceChar.test(n3), i3 = this.rules.other.startingSpaceChar.test(n3) && this.rules.other.endingSpaceChar.test(n3);
33172             return s2 && i3 && (n3 = n3.substring(1, n3.length - 1)), { type: "codespan", raw: t2[0], text: n3 };
33173           }
33174         }
33175         br(e3) {
33176           let t2 = this.rules.inline.br.exec(e3);
33177           if (t2) return { type: "br", raw: t2[0] };
33178         }
33179         del(e3) {
33180           let t2 = this.rules.inline.del.exec(e3);
33181           if (t2) return { type: "del", raw: t2[0], text: t2[2], tokens: this.lexer.inlineTokens(t2[2]) };
33182         }
33183         autolink(e3) {
33184           let t2 = this.rules.inline.autolink.exec(e3);
33185           if (t2) {
33186             let n3, s2;
33187             return t2[2] === "@" ? (n3 = t2[1], s2 = "mailto:" + n3) : (n3 = t2[1], s2 = n3), { type: "link", raw: t2[0], text: n3, href: s2, tokens: [{ type: "text", raw: n3, text: n3 }] };
33188           }
33189         }
33190         url(e3) {
33191           var _a4, _b2;
33192           let t2;
33193           if (t2 = this.rules.inline.url.exec(e3)) {
33194             let n3, s2;
33195             if (t2[2] === "@") n3 = t2[0], s2 = "mailto:" + n3;
33196             else {
33197               let i3;
33198               do
33199                 i3 = t2[0], t2[0] = (_b2 = (_a4 = this.rules.inline._backpedal.exec(t2[0])) == null ? void 0 : _a4[0]) != null ? _b2 : "";
33200               while (i3 !== t2[0]);
33201               n3 = t2[0], t2[1] === "www." ? s2 = "http://" + t2[0] : s2 = t2[0];
33202             }
33203             return { type: "link", raw: t2[0], text: n3, href: s2, tokens: [{ type: "text", raw: n3, text: n3 }] };
33204           }
33205         }
33206         inlineText(e3) {
33207           let t2 = this.rules.inline.text.exec(e3);
33208           if (t2) {
33209             let n3 = this.lexer.state.inRawBlock;
33210             return { type: "text", raw: t2[0], text: t2[0], escaped: n3 };
33211           }
33212         }
33213       };
33214       b = class a {
33215         constructor(e3) {
33216           __publicField(this, "tokens");
33217           __publicField(this, "options");
33218           __publicField(this, "state");
33219           __publicField(this, "tokenizer");
33220           __publicField(this, "inlineQueue");
33221           this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e3 || w, this.options.tokenizer = this.options.tokenizer || new S(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
33222           let t2 = { other: m, block: O.normal, inline: P.normal };
33223           this.options.pedantic ? (t2.block = O.pedantic, t2.inline = P.pedantic) : this.options.gfm && (t2.block = O.gfm, this.options.breaks ? t2.inline = P.breaks : t2.inline = P.gfm), this.tokenizer.rules = t2;
33224         }
33225         static get rules() {
33226           return { block: O, inline: P };
33227         }
33228         static lex(e3, t2) {
33229           return new a(t2).lex(e3);
33230         }
33231         static lexInline(e3, t2) {
33232           return new a(t2).inlineTokens(e3);
33233         }
33234         lex(e3) {
33235           e3 = e3.replace(m.carriageReturn, `
33236 `), this.blockTokens(e3, this.tokens);
33237           for (let t2 = 0; t2 < this.inlineQueue.length; t2++) {
33238             let n3 = this.inlineQueue[t2];
33239             this.inlineTokens(n3.src, n3.tokens);
33240           }
33241           return this.inlineQueue = [], this.tokens;
33242         }
33243         blockTokens(e3, t2 = [], n3 = false) {
33244           var _a4, _b2, _c;
33245           for (this.options.pedantic && (e3 = e3.replace(m.tabCharGlobal, "    ").replace(m.spaceLine, "")); e3; ) {
33246             let s2;
33247             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.block) == null ? void 0 : _b2.some((r2) => (s2 = r2.call({ lexer: this }, e3, t2)) ? (e3 = e3.substring(s2.raw.length), t2.push(s2), true) : false)) continue;
33248             if (s2 = this.tokenizer.space(e3)) {
33249               e3 = e3.substring(s2.raw.length);
33250               let r2 = t2.at(-1);
33251               s2.raw.length === 1 && r2 !== void 0 ? r2.raw += `
33252 ` : t2.push(s2);
33253               continue;
33254             }
33255             if (s2 = this.tokenizer.code(e3)) {
33256               e3 = e3.substring(s2.raw.length);
33257               let r2 = t2.at(-1);
33258               (r2 == null ? void 0 : r2.type) === "paragraph" || (r2 == null ? void 0 : r2.type) === "text" ? (r2.raw += `
33259 ` + s2.raw, r2.text += `
33260 ` + s2.text, this.inlineQueue.at(-1).src = r2.text) : t2.push(s2);
33261               continue;
33262             }
33263             if (s2 = this.tokenizer.fences(e3)) {
33264               e3 = e3.substring(s2.raw.length), t2.push(s2);
33265               continue;
33266             }
33267             if (s2 = this.tokenizer.heading(e3)) {
33268               e3 = e3.substring(s2.raw.length), t2.push(s2);
33269               continue;
33270             }
33271             if (s2 = this.tokenizer.hr(e3)) {
33272               e3 = e3.substring(s2.raw.length), t2.push(s2);
33273               continue;
33274             }
33275             if (s2 = this.tokenizer.blockquote(e3)) {
33276               e3 = e3.substring(s2.raw.length), t2.push(s2);
33277               continue;
33278             }
33279             if (s2 = this.tokenizer.list(e3)) {
33280               e3 = e3.substring(s2.raw.length), t2.push(s2);
33281               continue;
33282             }
33283             if (s2 = this.tokenizer.html(e3)) {
33284               e3 = e3.substring(s2.raw.length), t2.push(s2);
33285               continue;
33286             }
33287             if (s2 = this.tokenizer.def(e3)) {
33288               e3 = e3.substring(s2.raw.length);
33289               let r2 = t2.at(-1);
33290               (r2 == null ? void 0 : r2.type) === "paragraph" || (r2 == null ? void 0 : r2.type) === "text" ? (r2.raw += `
33291 ` + s2.raw, r2.text += `
33292 ` + s2.raw, this.inlineQueue.at(-1).src = r2.text) : this.tokens.links[s2.tag] || (this.tokens.links[s2.tag] = { href: s2.href, title: s2.title });
33293               continue;
33294             }
33295             if (s2 = this.tokenizer.table(e3)) {
33296               e3 = e3.substring(s2.raw.length), t2.push(s2);
33297               continue;
33298             }
33299             if (s2 = this.tokenizer.lheading(e3)) {
33300               e3 = e3.substring(s2.raw.length), t2.push(s2);
33301               continue;
33302             }
33303             let i3 = e3;
33304             if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
33305               let r2 = 1 / 0, o2 = e3.slice(1), l2;
33306               this.options.extensions.startBlock.forEach((c2) => {
33307                 l2 = c2.call({ lexer: this }, o2), typeof l2 == "number" && l2 >= 0 && (r2 = Math.min(r2, l2));
33308               }), r2 < 1 / 0 && r2 >= 0 && (i3 = e3.substring(0, r2 + 1));
33309             }
33310             if (this.state.top && (s2 = this.tokenizer.paragraph(i3))) {
33311               let r2 = t2.at(-1);
33312               n3 && (r2 == null ? void 0 : r2.type) === "paragraph" ? (r2.raw += `
33313 ` + s2.raw, r2.text += `
33314 ` + s2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r2.text) : t2.push(s2), n3 = i3.length !== e3.length, e3 = e3.substring(s2.raw.length);
33315               continue;
33316             }
33317             if (s2 = this.tokenizer.text(e3)) {
33318               e3 = e3.substring(s2.raw.length);
33319               let r2 = t2.at(-1);
33320               (r2 == null ? void 0 : r2.type) === "text" ? (r2.raw += `
33321 ` + s2.raw, r2.text += `
33322 ` + s2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r2.text) : t2.push(s2);
33323               continue;
33324             }
33325             if (e3) {
33326               let r2 = "Infinite loop on byte: " + e3.charCodeAt(0);
33327               if (this.options.silent) {
33328                 console.error(r2);
33329                 break;
33330               } else throw new Error(r2);
33331             }
33332           }
33333           return this.state.top = true, t2;
33334         }
33335         inline(e3, t2 = []) {
33336           return this.inlineQueue.push({ src: e3, tokens: t2 }), t2;
33337         }
33338         inlineTokens(e3, t2 = []) {
33339           var _a4, _b2, _c;
33340           let n3 = e3, s2 = null;
33341           if (this.tokens.links) {
33342             let o2 = Object.keys(this.tokens.links);
33343             if (o2.length > 0) for (; (s2 = this.tokenizer.rules.inline.reflinkSearch.exec(n3)) != null; ) o2.includes(s2[0].slice(s2[0].lastIndexOf("[") + 1, -1)) && (n3 = n3.slice(0, s2.index) + "[" + "a".repeat(s2[0].length - 2) + "]" + n3.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
33344           }
33345           for (; (s2 = this.tokenizer.rules.inline.anyPunctuation.exec(n3)) != null; ) n3 = n3.slice(0, s2.index) + "++" + n3.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
33346           for (; (s2 = this.tokenizer.rules.inline.blockSkip.exec(n3)) != null; ) n3 = n3.slice(0, s2.index) + "[" + "a".repeat(s2[0].length - 2) + "]" + n3.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
33347           let i3 = false, r2 = "";
33348           for (; e3; ) {
33349             i3 || (r2 = ""), i3 = false;
33350             let o2;
33351             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.inline) == null ? void 0 : _b2.some((c2) => (o2 = c2.call({ lexer: this }, e3, t2)) ? (e3 = e3.substring(o2.raw.length), t2.push(o2), true) : false)) continue;
33352             if (o2 = this.tokenizer.escape(e3)) {
33353               e3 = e3.substring(o2.raw.length), t2.push(o2);
33354               continue;
33355             }
33356             if (o2 = this.tokenizer.tag(e3)) {
33357               e3 = e3.substring(o2.raw.length), t2.push(o2);
33358               continue;
33359             }
33360             if (o2 = this.tokenizer.link(e3)) {
33361               e3 = e3.substring(o2.raw.length), t2.push(o2);
33362               continue;
33363             }
33364             if (o2 = this.tokenizer.reflink(e3, this.tokens.links)) {
33365               e3 = e3.substring(o2.raw.length);
33366               let c2 = t2.at(-1);
33367               o2.type === "text" && (c2 == null ? void 0 : c2.type) === "text" ? (c2.raw += o2.raw, c2.text += o2.text) : t2.push(o2);
33368               continue;
33369             }
33370             if (o2 = this.tokenizer.emStrong(e3, n3, r2)) {
33371               e3 = e3.substring(o2.raw.length), t2.push(o2);
33372               continue;
33373             }
33374             if (o2 = this.tokenizer.codespan(e3)) {
33375               e3 = e3.substring(o2.raw.length), t2.push(o2);
33376               continue;
33377             }
33378             if (o2 = this.tokenizer.br(e3)) {
33379               e3 = e3.substring(o2.raw.length), t2.push(o2);
33380               continue;
33381             }
33382             if (o2 = this.tokenizer.del(e3)) {
33383               e3 = e3.substring(o2.raw.length), t2.push(o2);
33384               continue;
33385             }
33386             if (o2 = this.tokenizer.autolink(e3)) {
33387               e3 = e3.substring(o2.raw.length), t2.push(o2);
33388               continue;
33389             }
33390             if (!this.state.inLink && (o2 = this.tokenizer.url(e3))) {
33391               e3 = e3.substring(o2.raw.length), t2.push(o2);
33392               continue;
33393             }
33394             let l2 = e3;
33395             if ((_c = this.options.extensions) == null ? void 0 : _c.startInline) {
33396               let c2 = 1 / 0, p2 = e3.slice(1), u2;
33397               this.options.extensions.startInline.forEach((d2) => {
33398                 u2 = d2.call({ lexer: this }, p2), typeof u2 == "number" && u2 >= 0 && (c2 = Math.min(c2, u2));
33399               }), c2 < 1 / 0 && c2 >= 0 && (l2 = e3.substring(0, c2 + 1));
33400             }
33401             if (o2 = this.tokenizer.inlineText(l2)) {
33402               e3 = e3.substring(o2.raw.length), o2.raw.slice(-1) !== "_" && (r2 = o2.raw.slice(-1)), i3 = true;
33403               let c2 = t2.at(-1);
33404               (c2 == null ? void 0 : c2.type) === "text" ? (c2.raw += o2.raw, c2.text += o2.text) : t2.push(o2);
33405               continue;
33406             }
33407             if (e3) {
33408               let c2 = "Infinite loop on byte: " + e3.charCodeAt(0);
33409               if (this.options.silent) {
33410                 console.error(c2);
33411                 break;
33412               } else throw new Error(c2);
33413             }
33414           }
33415           return t2;
33416         }
33417       };
33418       $ = class {
33419         constructor(e3) {
33420           __publicField(this, "options");
33421           __publicField(this, "parser");
33422           this.options = e3 || w;
33423         }
33424         space(e3) {
33425           return "";
33426         }
33427         code({ text: e3, lang: t2, escaped: n3 }) {
33428           var _a4;
33429           let s2 = (_a4 = (t2 || "").match(m.notSpaceStart)) == null ? void 0 : _a4[0], i3 = e3.replace(m.endingNewline, "") + `
33430 `;
33431           return s2 ? '<pre><code class="language-' + R(s2) + '">' + (n3 ? i3 : R(i3, true)) + `</code></pre>
33432 ` : "<pre><code>" + (n3 ? i3 : R(i3, true)) + `</code></pre>
33433 `;
33434         }
33435         blockquote({ tokens: e3 }) {
33436           return `<blockquote>
33437 ${this.parser.parse(e3)}</blockquote>
33438 `;
33439         }
33440         html({ text: e3 }) {
33441           return e3;
33442         }
33443         heading({ tokens: e3, depth: t2 }) {
33444           return `<h${t2}>${this.parser.parseInline(e3)}</h${t2}>
33445 `;
33446         }
33447         hr(e3) {
33448           return `<hr>
33449 `;
33450         }
33451         list(e3) {
33452           let t2 = e3.ordered, n3 = e3.start, s2 = "";
33453           for (let o2 = 0; o2 < e3.items.length; o2++) {
33454             let l2 = e3.items[o2];
33455             s2 += this.listitem(l2);
33456           }
33457           let i3 = t2 ? "ol" : "ul", r2 = t2 && n3 !== 1 ? ' start="' + n3 + '"' : "";
33458           return "<" + i3 + r2 + `>
33459 ` + s2 + "</" + i3 + `>
33460 `;
33461         }
33462         listitem(e3) {
33463           var _a4;
33464           let t2 = "";
33465           if (e3.task) {
33466             let n3 = this.checkbox({ checked: !!e3.checked });
33467             e3.loose ? ((_a4 = e3.tokens[0]) == null ? void 0 : _a4.type) === "paragraph" ? (e3.tokens[0].text = n3 + " " + e3.tokens[0].text, e3.tokens[0].tokens && e3.tokens[0].tokens.length > 0 && e3.tokens[0].tokens[0].type === "text" && (e3.tokens[0].tokens[0].text = n3 + " " + R(e3.tokens[0].tokens[0].text), e3.tokens[0].tokens[0].escaped = true)) : e3.tokens.unshift({ type: "text", raw: n3 + " ", text: n3 + " ", escaped: true }) : t2 += n3 + " ";
33468           }
33469           return t2 += this.parser.parse(e3.tokens, !!e3.loose), `<li>${t2}</li>
33470 `;
33471         }
33472         checkbox({ checked: e3 }) {
33473           return "<input " + (e3 ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
33474         }
33475         paragraph({ tokens: e3 }) {
33476           return `<p>${this.parser.parseInline(e3)}</p>
33477 `;
33478         }
33479         table(e3) {
33480           let t2 = "", n3 = "";
33481           for (let i3 = 0; i3 < e3.header.length; i3++) n3 += this.tablecell(e3.header[i3]);
33482           t2 += this.tablerow({ text: n3 });
33483           let s2 = "";
33484           for (let i3 = 0; i3 < e3.rows.length; i3++) {
33485             let r2 = e3.rows[i3];
33486             n3 = "";
33487             for (let o2 = 0; o2 < r2.length; o2++) n3 += this.tablecell(r2[o2]);
33488             s2 += this.tablerow({ text: n3 });
33489           }
33490           return s2 && (s2 = `<tbody>${s2}</tbody>`), `<table>
33491 <thead>
33492 ` + t2 + `</thead>
33493 ` + s2 + `</table>
33494 `;
33495         }
33496         tablerow({ text: e3 }) {
33497           return `<tr>
33498 ${e3}</tr>
33499 `;
33500         }
33501         tablecell(e3) {
33502           let t2 = this.parser.parseInline(e3.tokens), n3 = e3.header ? "th" : "td";
33503           return (e3.align ? `<${n3} align="${e3.align}">` : `<${n3}>`) + t2 + `</${n3}>
33504 `;
33505         }
33506         strong({ tokens: e3 }) {
33507           return `<strong>${this.parser.parseInline(e3)}</strong>`;
33508         }
33509         em({ tokens: e3 }) {
33510           return `<em>${this.parser.parseInline(e3)}</em>`;
33511         }
33512         codespan({ text: e3 }) {
33513           return `<code>${R(e3, true)}</code>`;
33514         }
33515         br(e3) {
33516           return "<br>";
33517         }
33518         del({ tokens: e3 }) {
33519           return `<del>${this.parser.parseInline(e3)}</del>`;
33520         }
33521         link({ href: e3, title: t2, tokens: n3 }) {
33522           let s2 = this.parser.parseInline(n3), i3 = J(e3);
33523           if (i3 === null) return s2;
33524           e3 = i3;
33525           let r2 = '<a href="' + e3 + '"';
33526           return t2 && (r2 += ' title="' + R(t2) + '"'), r2 += ">" + s2 + "</a>", r2;
33527         }
33528         image({ href: e3, title: t2, text: n3, tokens: s2 }) {
33529           s2 && (n3 = this.parser.parseInline(s2, this.parser.textRenderer));
33530           let i3 = J(e3);
33531           if (i3 === null) return R(n3);
33532           e3 = i3;
33533           let r2 = `<img src="${e3}" alt="${n3}"`;
33534           return t2 && (r2 += ` title="${R(t2)}"`), r2 += ">", r2;
33535         }
33536         text(e3) {
33537           return "tokens" in e3 && e3.tokens ? this.parser.parseInline(e3.tokens) : "escaped" in e3 && e3.escaped ? e3.text : R(e3.text);
33538         }
33539       };
33540       _ = class {
33541         strong({ text: e3 }) {
33542           return e3;
33543         }
33544         em({ text: e3 }) {
33545           return e3;
33546         }
33547         codespan({ text: e3 }) {
33548           return e3;
33549         }
33550         del({ text: e3 }) {
33551           return e3;
33552         }
33553         html({ text: e3 }) {
33554           return e3;
33555         }
33556         text({ text: e3 }) {
33557           return e3;
33558         }
33559         link({ text: e3 }) {
33560           return "" + e3;
33561         }
33562         image({ text: e3 }) {
33563           return "" + e3;
33564         }
33565         br() {
33566           return "";
33567         }
33568       };
33569       T = class a2 {
33570         constructor(e3) {
33571           __publicField(this, "options");
33572           __publicField(this, "renderer");
33573           __publicField(this, "textRenderer");
33574           this.options = e3 || w, this.options.renderer = this.options.renderer || new $(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new _();
33575         }
33576         static parse(e3, t2) {
33577           return new a2(t2).parse(e3);
33578         }
33579         static parseInline(e3, t2) {
33580           return new a2(t2).parseInline(e3);
33581         }
33582         parse(e3, t2 = true) {
33583           var _a4, _b2;
33584           let n3 = "";
33585           for (let s2 = 0; s2 < e3.length; s2++) {
33586             let i3 = e3[s2];
33587             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.renderers) == null ? void 0 : _b2[i3.type]) {
33588               let o2 = i3, l2 = this.options.extensions.renderers[o2.type].call({ parser: this }, o2);
33589               if (l2 !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(o2.type)) {
33590                 n3 += l2 || "";
33591                 continue;
33592               }
33593             }
33594             let r2 = i3;
33595             switch (r2.type) {
33596               case "space": {
33597                 n3 += this.renderer.space(r2);
33598                 continue;
33599               }
33600               case "hr": {
33601                 n3 += this.renderer.hr(r2);
33602                 continue;
33603               }
33604               case "heading": {
33605                 n3 += this.renderer.heading(r2);
33606                 continue;
33607               }
33608               case "code": {
33609                 n3 += this.renderer.code(r2);
33610                 continue;
33611               }
33612               case "table": {
33613                 n3 += this.renderer.table(r2);
33614                 continue;
33615               }
33616               case "blockquote": {
33617                 n3 += this.renderer.blockquote(r2);
33618                 continue;
33619               }
33620               case "list": {
33621                 n3 += this.renderer.list(r2);
33622                 continue;
33623               }
33624               case "html": {
33625                 n3 += this.renderer.html(r2);
33626                 continue;
33627               }
33628               case "paragraph": {
33629                 n3 += this.renderer.paragraph(r2);
33630                 continue;
33631               }
33632               case "text": {
33633                 let o2 = r2, l2 = this.renderer.text(o2);
33634                 for (; s2 + 1 < e3.length && e3[s2 + 1].type === "text"; ) o2 = e3[++s2], l2 += `
33635 ` + this.renderer.text(o2);
33636                 t2 ? n3 += this.renderer.paragraph({ type: "paragraph", raw: l2, text: l2, tokens: [{ type: "text", raw: l2, text: l2, escaped: true }] }) : n3 += l2;
33637                 continue;
33638               }
33639               default: {
33640                 let o2 = 'Token with "' + r2.type + '" type was not found.';
33641                 if (this.options.silent) return console.error(o2), "";
33642                 throw new Error(o2);
33643               }
33644             }
33645           }
33646           return n3;
33647         }
33648         parseInline(e3, t2 = this.renderer) {
33649           var _a4, _b2;
33650           let n3 = "";
33651           for (let s2 = 0; s2 < e3.length; s2++) {
33652             let i3 = e3[s2];
33653             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.renderers) == null ? void 0 : _b2[i3.type]) {
33654               let o2 = this.options.extensions.renderers[i3.type].call({ parser: this }, i3);
33655               if (o2 !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i3.type)) {
33656                 n3 += o2 || "";
33657                 continue;
33658               }
33659             }
33660             let r2 = i3;
33661             switch (r2.type) {
33662               case "escape": {
33663                 n3 += t2.text(r2);
33664                 break;
33665               }
33666               case "html": {
33667                 n3 += t2.html(r2);
33668                 break;
33669               }
33670               case "link": {
33671                 n3 += t2.link(r2);
33672                 break;
33673               }
33674               case "image": {
33675                 n3 += t2.image(r2);
33676                 break;
33677               }
33678               case "strong": {
33679                 n3 += t2.strong(r2);
33680                 break;
33681               }
33682               case "em": {
33683                 n3 += t2.em(r2);
33684                 break;
33685               }
33686               case "codespan": {
33687                 n3 += t2.codespan(r2);
33688                 break;
33689               }
33690               case "br": {
33691                 n3 += t2.br(r2);
33692                 break;
33693               }
33694               case "del": {
33695                 n3 += t2.del(r2);
33696                 break;
33697               }
33698               case "text": {
33699                 n3 += t2.text(r2);
33700                 break;
33701               }
33702               default: {
33703                 let o2 = 'Token with "' + r2.type + '" type was not found.';
33704                 if (this.options.silent) return console.error(o2), "";
33705                 throw new Error(o2);
33706               }
33707             }
33708           }
33709           return n3;
33710         }
33711       };
33712       L = (_a2 = class {
33713         constructor(e3) {
33714           __publicField(this, "options");
33715           __publicField(this, "block");
33716           this.options = e3 || w;
33717         }
33718         preprocess(e3) {
33719           return e3;
33720         }
33721         postprocess(e3) {
33722           return e3;
33723         }
33724         processAllTokens(e3) {
33725           return e3;
33726         }
33727         provideLexer() {
33728           return this.block ? b.lex : b.lexInline;
33729         }
33730         provideParser() {
33731           return this.block ? T.parse : T.parseInline;
33732         }
33733       }, __publicField(_a2, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a2);
33734       B = class {
33735         constructor(...e3) {
33736           __publicField(this, "defaults", M());
33737           __publicField(this, "options", this.setOptions);
33738           __publicField(this, "parse", this.parseMarkdown(true));
33739           __publicField(this, "parseInline", this.parseMarkdown(false));
33740           __publicField(this, "Parser", T);
33741           __publicField(this, "Renderer", $);
33742           __publicField(this, "TextRenderer", _);
33743           __publicField(this, "Lexer", b);
33744           __publicField(this, "Tokenizer", S);
33745           __publicField(this, "Hooks", L);
33746           this.use(...e3);
33747         }
33748         walkTokens(e3, t2) {
33749           var _a4, _b2;
33750           let n3 = [];
33751           for (let s2 of e3) switch (n3 = n3.concat(t2.call(this, s2)), s2.type) {
33752             case "table": {
33753               let i3 = s2;
33754               for (let r2 of i3.header) n3 = n3.concat(this.walkTokens(r2.tokens, t2));
33755               for (let r2 of i3.rows) for (let o2 of r2) n3 = n3.concat(this.walkTokens(o2.tokens, t2));
33756               break;
33757             }
33758             case "list": {
33759               let i3 = s2;
33760               n3 = n3.concat(this.walkTokens(i3.items, t2));
33761               break;
33762             }
33763             default: {
33764               let i3 = s2;
33765               ((_b2 = (_a4 = this.defaults.extensions) == null ? void 0 : _a4.childTokens) == null ? void 0 : _b2[i3.type]) ? this.defaults.extensions.childTokens[i3.type].forEach((r2) => {
33766                 let o2 = i3[r2].flat(1 / 0);
33767                 n3 = n3.concat(this.walkTokens(o2, t2));
33768               }) : i3.tokens && (n3 = n3.concat(this.walkTokens(i3.tokens, t2)));
33769             }
33770           }
33771           return n3;
33772         }
33773         use(...e3) {
33774           let t2 = this.defaults.extensions || { renderers: {}, childTokens: {} };
33775           return e3.forEach((n3) => {
33776             let s2 = { ...n3 };
33777             if (s2.async = this.defaults.async || s2.async || false, n3.extensions && (n3.extensions.forEach((i3) => {
33778               if (!i3.name) throw new Error("extension name required");
33779               if ("renderer" in i3) {
33780                 let r2 = t2.renderers[i3.name];
33781                 r2 ? t2.renderers[i3.name] = function(...o2) {
33782                   let l2 = i3.renderer.apply(this, o2);
33783                   return l2 === false && (l2 = r2.apply(this, o2)), l2;
33784                 } : t2.renderers[i3.name] = i3.renderer;
33785               }
33786               if ("tokenizer" in i3) {
33787                 if (!i3.level || i3.level !== "block" && i3.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
33788                 let r2 = t2[i3.level];
33789                 r2 ? r2.unshift(i3.tokenizer) : t2[i3.level] = [i3.tokenizer], i3.start && (i3.level === "block" ? t2.startBlock ? t2.startBlock.push(i3.start) : t2.startBlock = [i3.start] : i3.level === "inline" && (t2.startInline ? t2.startInline.push(i3.start) : t2.startInline = [i3.start]));
33790               }
33791               "childTokens" in i3 && i3.childTokens && (t2.childTokens[i3.name] = i3.childTokens);
33792             }), s2.extensions = t2), n3.renderer) {
33793               let i3 = this.defaults.renderer || new $(this.defaults);
33794               for (let r2 in n3.renderer) {
33795                 if (!(r2 in i3)) throw new Error(`renderer '${r2}' does not exist`);
33796                 if (["options", "parser"].includes(r2)) continue;
33797                 let o2 = r2, l2 = n3.renderer[o2], c2 = i3[o2];
33798                 i3[o2] = (...p2) => {
33799                   let u2 = l2.apply(i3, p2);
33800                   return u2 === false && (u2 = c2.apply(i3, p2)), u2 || "";
33801                 };
33802               }
33803               s2.renderer = i3;
33804             }
33805             if (n3.tokenizer) {
33806               let i3 = this.defaults.tokenizer || new S(this.defaults);
33807               for (let r2 in n3.tokenizer) {
33808                 if (!(r2 in i3)) throw new Error(`tokenizer '${r2}' does not exist`);
33809                 if (["options", "rules", "lexer"].includes(r2)) continue;
33810                 let o2 = r2, l2 = n3.tokenizer[o2], c2 = i3[o2];
33811                 i3[o2] = (...p2) => {
33812                   let u2 = l2.apply(i3, p2);
33813                   return u2 === false && (u2 = c2.apply(i3, p2)), u2;
33814                 };
33815               }
33816               s2.tokenizer = i3;
33817             }
33818             if (n3.hooks) {
33819               let i3 = this.defaults.hooks || new L();
33820               for (let r2 in n3.hooks) {
33821                 if (!(r2 in i3)) throw new Error(`hook '${r2}' does not exist`);
33822                 if (["options", "block"].includes(r2)) continue;
33823                 let o2 = r2, l2 = n3.hooks[o2], c2 = i3[o2];
33824                 L.passThroughHooks.has(r2) ? i3[o2] = (p2) => {
33825                   if (this.defaults.async) return Promise.resolve(l2.call(i3, p2)).then((d2) => c2.call(i3, d2));
33826                   let u2 = l2.call(i3, p2);
33827                   return c2.call(i3, u2);
33828                 } : i3[o2] = (...p2) => {
33829                   let u2 = l2.apply(i3, p2);
33830                   return u2 === false && (u2 = c2.apply(i3, p2)), u2;
33831                 };
33832               }
33833               s2.hooks = i3;
33834             }
33835             if (n3.walkTokens) {
33836               let i3 = this.defaults.walkTokens, r2 = n3.walkTokens;
33837               s2.walkTokens = function(o2) {
33838                 let l2 = [];
33839                 return l2.push(r2.call(this, o2)), i3 && (l2 = l2.concat(i3.call(this, o2))), l2;
33840               };
33841             }
33842             this.defaults = { ...this.defaults, ...s2 };
33843           }), this;
33844         }
33845         setOptions(e3) {
33846           return this.defaults = { ...this.defaults, ...e3 }, this;
33847         }
33848         lexer(e3, t2) {
33849           return b.lex(e3, t2 != null ? t2 : this.defaults);
33850         }
33851         parser(e3, t2) {
33852           return T.parse(e3, t2 != null ? t2 : this.defaults);
33853         }
33854         parseMarkdown(e3) {
33855           return (n3, s2) => {
33856             let i3 = { ...s2 }, r2 = { ...this.defaults, ...i3 }, o2 = this.onError(!!r2.silent, !!r2.async);
33857             if (this.defaults.async === true && i3.async === false) return o2(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."));
33858             if (typeof n3 > "u" || n3 === null) return o2(new Error("marked(): input parameter is undefined or null"));
33859             if (typeof n3 != "string") return o2(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n3) + ", string expected"));
33860             r2.hooks && (r2.hooks.options = r2, r2.hooks.block = e3);
33861             let l2 = r2.hooks ? r2.hooks.provideLexer() : e3 ? b.lex : b.lexInline, c2 = r2.hooks ? r2.hooks.provideParser() : e3 ? T.parse : T.parseInline;
33862             if (r2.async) return Promise.resolve(r2.hooks ? r2.hooks.preprocess(n3) : n3).then((p2) => l2(p2, r2)).then((p2) => r2.hooks ? r2.hooks.processAllTokens(p2) : p2).then((p2) => r2.walkTokens ? Promise.all(this.walkTokens(p2, r2.walkTokens)).then(() => p2) : p2).then((p2) => c2(p2, r2)).then((p2) => r2.hooks ? r2.hooks.postprocess(p2) : p2).catch(o2);
33863             try {
33864               r2.hooks && (n3 = r2.hooks.preprocess(n3));
33865               let p2 = l2(n3, r2);
33866               r2.hooks && (p2 = r2.hooks.processAllTokens(p2)), r2.walkTokens && this.walkTokens(p2, r2.walkTokens);
33867               let u2 = c2(p2, r2);
33868               return r2.hooks && (u2 = r2.hooks.postprocess(u2)), u2;
33869             } catch (p2) {
33870               return o2(p2);
33871             }
33872           };
33873         }
33874         onError(e3, t2) {
33875           return (n3) => {
33876             if (n3.message += `
33877 Please report this to https://github.com/markedjs/marked.`, e3) {
33878               let s2 = "<p>An error occurred:</p><pre>" + R(n3.message + "", true) + "</pre>";
33879               return t2 ? Promise.resolve(s2) : s2;
33880             }
33881             if (t2) return Promise.reject(n3);
33882             throw n3;
33883           };
33884         }
33885       };
33886       z = new B();
33887       k.options = k.setOptions = function(a4) {
33888         return z.setOptions(a4), k.defaults = z.defaults, H(k.defaults), k;
33889       };
33890       k.getDefaults = M;
33891       k.defaults = w;
33892       k.use = function(...a4) {
33893         return z.use(...a4), k.defaults = z.defaults, H(k.defaults), k;
33894       };
33895       k.walkTokens = function(a4, e3) {
33896         return z.walkTokens(a4, e3);
33897       };
33898       k.parseInline = z.parseInline;
33899       k.Parser = T;
33900       k.parser = T.parse;
33901       k.Renderer = $;
33902       k.TextRenderer = _;
33903       k.Lexer = b;
33904       k.lexer = b.lex;
33905       k.Tokenizer = S;
33906       k.Hooks = L;
33907       k.parse = k;
33908       Dt = k.options;
33909       Zt = k.setOptions;
33910       Gt = k.use;
33911       Ht = k.walkTokens;
33912       Nt = k.parseInline;
33913       Ft = T.parse;
33914       Qt = b.lex;
33915     }
33916   });
33917
33918   // modules/services/osmose.js
33919   var osmose_exports = {};
33920   __export(osmose_exports, {
33921     default: () => osmose_default
33922   });
33923   function abortRequest2(controller) {
33924     if (controller) {
33925       controller.abort();
33926     }
33927   }
33928   function abortUnwantedRequests2(cache, tiles) {
33929     Object.keys(cache.inflightTile).forEach((k3) => {
33930       let wanted = tiles.find((tile) => k3 === tile.id);
33931       if (!wanted) {
33932         abortRequest2(cache.inflightTile[k3]);
33933         delete cache.inflightTile[k3];
33934       }
33935     });
33936   }
33937   function encodeIssueRtree2(d2) {
33938     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
33939   }
33940   function updateRtree2(item, replace) {
33941     _cache2.rtree.remove(item, (a4, b3) => a4.data.id === b3.data.id);
33942     if (replace) {
33943       _cache2.rtree.insert(item);
33944     }
33945   }
33946   function preventCoincident(loc) {
33947     let coincident = false;
33948     do {
33949       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
33950       loc = geoVecAdd(loc, delta);
33951       let bbox2 = geoExtent(loc).bbox();
33952       coincident = _cache2.rtree.search(bbox2).length;
33953     } while (coincident);
33954     return loc;
33955   }
33956   var tiler2, dispatch3, _tileZoom2, _osmoseUrlRoot, _osmoseData, _cache2, osmose_default;
33957   var init_osmose = __esm({
33958     "modules/services/osmose.js"() {
33959       "use strict";
33960       init_rbush();
33961       init_src4();
33962       init_src18();
33963       init_marked_esm();
33964       init_file_fetcher();
33965       init_localizer();
33966       init_geo2();
33967       init_osm();
33968       init_util();
33969       tiler2 = utilTiler();
33970       dispatch3 = dispatch_default("loaded");
33971       _tileZoom2 = 14;
33972       _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
33973       _osmoseData = { icons: {}, items: [] };
33974       osmose_default = {
33975         title: "osmose",
33976         init() {
33977           _mainFileFetcher.get("qa_data").then((d2) => {
33978             _osmoseData = d2.osmose;
33979             _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
33980           });
33981           if (!_cache2) {
33982             this.reset();
33983           }
33984           this.event = utilRebind(this, dispatch3, "on");
33985         },
33986         reset() {
33987           let _strings = {};
33988           let _colors = {};
33989           if (_cache2) {
33990             Object.values(_cache2.inflightTile).forEach(abortRequest2);
33991             _strings = _cache2.strings;
33992             _colors = _cache2.colors;
33993           }
33994           _cache2 = {
33995             data: {},
33996             loadedTile: {},
33997             inflightTile: {},
33998             inflightPost: {},
33999             closed: {},
34000             rtree: new RBush(),
34001             strings: _strings,
34002             colors: _colors
34003           };
34004         },
34005         loadIssues(projection2) {
34006           let params = {
34007             // Tiles return a maximum # of issues
34008             // So we want to filter our request for only types iD supports
34009             item: _osmoseData.items
34010           };
34011           let tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
34012           abortUnwantedRequests2(_cache2, tiles);
34013           tiles.forEach((tile) => {
34014             if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id]) return;
34015             let [x2, y2, z3] = tile.xyz;
34016             let url = `${_osmoseUrlRoot}/issues/${z3}/${x2}/${y2}.geojson?` + utilQsString(params);
34017             let controller = new AbortController();
34018             _cache2.inflightTile[tile.id] = controller;
34019             json_default(url, { signal: controller.signal }).then((data) => {
34020               delete _cache2.inflightTile[tile.id];
34021               _cache2.loadedTile[tile.id] = true;
34022               if (data.features) {
34023                 data.features.forEach((issue) => {
34024                   const { item, class: cl, uuid: id2 } = issue.properties;
34025                   const itemType = `${item}-${cl}`;
34026                   if (itemType in _osmoseData.icons) {
34027                     let loc = issue.geometry.coordinates;
34028                     loc = preventCoincident(loc);
34029                     let d2 = new QAItem(loc, this, itemType, id2, { item });
34030                     if (item === 8300 || item === 8360) {
34031                       d2.elems = [];
34032                     }
34033                     _cache2.data[d2.id] = d2;
34034                     _cache2.rtree.insert(encodeIssueRtree2(d2));
34035                   }
34036                 });
34037               }
34038               dispatch3.call("loaded");
34039             }).catch(() => {
34040               delete _cache2.inflightTile[tile.id];
34041               _cache2.loadedTile[tile.id] = true;
34042             });
34043           });
34044         },
34045         loadIssueDetail(issue) {
34046           if (issue.elems !== void 0) {
34047             return Promise.resolve(issue);
34048           }
34049           const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
34050           const cacheDetails = (data) => {
34051             issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
34052             issue.detail = data.subtitle ? k(data.subtitle.auto) : "";
34053             this.replaceItem(issue);
34054           };
34055           return json_default(url).then(cacheDetails).then(() => issue);
34056         },
34057         loadStrings(locale3 = _mainLocalizer.localeCode()) {
34058           const items = Object.keys(_osmoseData.icons);
34059           if (locale3 in _cache2.strings && Object.keys(_cache2.strings[locale3]).length === items.length) {
34060             return Promise.resolve(_cache2.strings[locale3]);
34061           }
34062           if (!(locale3 in _cache2.strings)) {
34063             _cache2.strings[locale3] = {};
34064           }
34065           const allRequests = items.map((itemType) => {
34066             if (itemType in _cache2.strings[locale3]) return null;
34067             const cacheData = (data) => {
34068               const [cat = { items: [] }] = data.categories;
34069               const [item2 = { class: [] }] = cat.items;
34070               const [cl2 = null] = item2.class;
34071               if (!cl2) {
34072                 console.log(`Osmose strings request (${itemType}) had unexpected data`);
34073                 return;
34074               }
34075               const { item: itemInt, color: color2 } = item2;
34076               if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
34077                 _cache2.colors[itemInt] = color2;
34078               }
34079               const { title, detail, fix, trap } = cl2;
34080               let issueStrings = {};
34081               if (title) issueStrings.title = title.auto;
34082               if (detail) issueStrings.detail = k(detail.auto);
34083               if (trap) issueStrings.trap = k(trap.auto);
34084               if (fix) issueStrings.fix = k(fix.auto);
34085               _cache2.strings[locale3][itemType] = issueStrings;
34086             };
34087             const [item, cl] = itemType.split("-");
34088             const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale3}`;
34089             return json_default(url).then(cacheData);
34090           }).filter(Boolean);
34091           return Promise.all(allRequests).then(() => _cache2.strings[locale3]);
34092         },
34093         getStrings(itemType, locale3 = _mainLocalizer.localeCode()) {
34094           return locale3 in _cache2.strings ? _cache2.strings[locale3][itemType] : {};
34095         },
34096         getColor(itemType) {
34097           return itemType in _cache2.colors ? _cache2.colors[itemType] : "#FFFFFF";
34098         },
34099         postUpdate(issue, callback) {
34100           if (_cache2.inflightPost[issue.id]) {
34101             return callback({ message: "Issue update already inflight", status: -2 }, issue);
34102           }
34103           const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
34104           const controller = new AbortController();
34105           const after = () => {
34106             delete _cache2.inflightPost[issue.id];
34107             this.removeItem(issue);
34108             if (issue.newStatus === "done") {
34109               if (!(issue.item in _cache2.closed)) {
34110                 _cache2.closed[issue.item] = 0;
34111               }
34112               _cache2.closed[issue.item] += 1;
34113             }
34114             if (callback) callback(null, issue);
34115           };
34116           _cache2.inflightPost[issue.id] = controller;
34117           fetch(url, { signal: controller.signal }).then(after).catch((err) => {
34118             delete _cache2.inflightPost[issue.id];
34119             if (callback) callback(err.message);
34120           });
34121         },
34122         // Get all cached QAItems covering the viewport
34123         getItems(projection2) {
34124           const viewport = projection2.clipExtent();
34125           const min3 = [viewport[0][0], viewport[1][1]];
34126           const max3 = [viewport[1][0], viewport[0][1]];
34127           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34128           return _cache2.rtree.search(bbox2).map((d2) => d2.data);
34129         },
34130         // Get a QAItem from cache
34131         // NOTE: Don't change method name until UI v3 is merged
34132         getError(id2) {
34133           return _cache2.data[id2];
34134         },
34135         // get the name of the icon to display for this item
34136         getIcon(itemType) {
34137           return _osmoseData.icons[itemType];
34138         },
34139         // Replace a single QAItem in the cache
34140         replaceItem(item) {
34141           if (!(item instanceof QAItem) || !item.id) return;
34142           _cache2.data[item.id] = item;
34143           updateRtree2(encodeIssueRtree2(item), true);
34144           return item;
34145         },
34146         // Remove a single QAItem from the cache
34147         removeItem(item) {
34148           if (!(item instanceof QAItem) || !item.id) return;
34149           delete _cache2.data[item.id];
34150           updateRtree2(encodeIssueRtree2(item), false);
34151         },
34152         // Used to populate `closed:osmose:*` changeset tags
34153         getClosedCounts() {
34154           return _cache2.closed;
34155         },
34156         itemURL(item) {
34157           return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
34158         }
34159       };
34160     }
34161   });
34162
34163   // node_modules/pbf/index.js
34164   function readVarintRemainder(l2, s2, p2) {
34165     const buf = p2.buf;
34166     let h3, b3;
34167     b3 = buf[p2.pos++];
34168     h3 = (b3 & 112) >> 4;
34169     if (b3 < 128) return toNum(l2, h3, s2);
34170     b3 = buf[p2.pos++];
34171     h3 |= (b3 & 127) << 3;
34172     if (b3 < 128) return toNum(l2, h3, s2);
34173     b3 = buf[p2.pos++];
34174     h3 |= (b3 & 127) << 10;
34175     if (b3 < 128) return toNum(l2, h3, s2);
34176     b3 = buf[p2.pos++];
34177     h3 |= (b3 & 127) << 17;
34178     if (b3 < 128) return toNum(l2, h3, s2);
34179     b3 = buf[p2.pos++];
34180     h3 |= (b3 & 127) << 24;
34181     if (b3 < 128) return toNum(l2, h3, s2);
34182     b3 = buf[p2.pos++];
34183     h3 |= (b3 & 1) << 31;
34184     if (b3 < 128) return toNum(l2, h3, s2);
34185     throw new Error("Expected varint not more than 10 bytes");
34186   }
34187   function toNum(low, high, isSigned) {
34188     return isSigned ? high * 4294967296 + (low >>> 0) : (high >>> 0) * 4294967296 + (low >>> 0);
34189   }
34190   function writeBigVarint(val, pbf) {
34191     let low, high;
34192     if (val >= 0) {
34193       low = val % 4294967296 | 0;
34194       high = val / 4294967296 | 0;
34195     } else {
34196       low = ~(-val % 4294967296);
34197       high = ~(-val / 4294967296);
34198       if (low ^ 4294967295) {
34199         low = low + 1 | 0;
34200       } else {
34201         low = 0;
34202         high = high + 1 | 0;
34203       }
34204     }
34205     if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
34206       throw new Error("Given varint doesn't fit into 10 bytes");
34207     }
34208     pbf.realloc(10);
34209     writeBigVarintLow(low, high, pbf);
34210     writeBigVarintHigh(high, pbf);
34211   }
34212   function writeBigVarintLow(low, high, pbf) {
34213     pbf.buf[pbf.pos++] = low & 127 | 128;
34214     low >>>= 7;
34215     pbf.buf[pbf.pos++] = low & 127 | 128;
34216     low >>>= 7;
34217     pbf.buf[pbf.pos++] = low & 127 | 128;
34218     low >>>= 7;
34219     pbf.buf[pbf.pos++] = low & 127 | 128;
34220     low >>>= 7;
34221     pbf.buf[pbf.pos] = low & 127;
34222   }
34223   function writeBigVarintHigh(high, pbf) {
34224     const lsb = (high & 7) << 4;
34225     pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
34226     if (!high) return;
34227     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34228     if (!high) return;
34229     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34230     if (!high) return;
34231     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34232     if (!high) return;
34233     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34234     if (!high) return;
34235     pbf.buf[pbf.pos++] = high & 127;
34236   }
34237   function makeRoomForExtraLength(startPos, len, pbf) {
34238     const extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
34239     pbf.realloc(extraLen);
34240     for (let i3 = pbf.pos - 1; i3 >= startPos; i3--) pbf.buf[i3 + extraLen] = pbf.buf[i3];
34241   }
34242   function writePackedVarint(arr, pbf) {
34243     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeVarint(arr[i3]);
34244   }
34245   function writePackedSVarint(arr, pbf) {
34246     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSVarint(arr[i3]);
34247   }
34248   function writePackedFloat(arr, pbf) {
34249     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFloat(arr[i3]);
34250   }
34251   function writePackedDouble(arr, pbf) {
34252     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeDouble(arr[i3]);
34253   }
34254   function writePackedBoolean(arr, pbf) {
34255     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeBoolean(arr[i3]);
34256   }
34257   function writePackedFixed32(arr, pbf) {
34258     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed32(arr[i3]);
34259   }
34260   function writePackedSFixed32(arr, pbf) {
34261     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed32(arr[i3]);
34262   }
34263   function writePackedFixed64(arr, pbf) {
34264     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed64(arr[i3]);
34265   }
34266   function writePackedSFixed64(arr, pbf) {
34267     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed64(arr[i3]);
34268   }
34269   function readUtf8(buf, pos, end) {
34270     let str = "";
34271     let i3 = pos;
34272     while (i3 < end) {
34273       const b0 = buf[i3];
34274       let c2 = null;
34275       let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
34276       if (i3 + bytesPerSequence > end) break;
34277       let b1, b22, b3;
34278       if (bytesPerSequence === 1) {
34279         if (b0 < 128) {
34280           c2 = b0;
34281         }
34282       } else if (bytesPerSequence === 2) {
34283         b1 = buf[i3 + 1];
34284         if ((b1 & 192) === 128) {
34285           c2 = (b0 & 31) << 6 | b1 & 63;
34286           if (c2 <= 127) {
34287             c2 = null;
34288           }
34289         }
34290       } else if (bytesPerSequence === 3) {
34291         b1 = buf[i3 + 1];
34292         b22 = buf[i3 + 2];
34293         if ((b1 & 192) === 128 && (b22 & 192) === 128) {
34294           c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b22 & 63;
34295           if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
34296             c2 = null;
34297           }
34298         }
34299       } else if (bytesPerSequence === 4) {
34300         b1 = buf[i3 + 1];
34301         b22 = buf[i3 + 2];
34302         b3 = buf[i3 + 3];
34303         if ((b1 & 192) === 128 && (b22 & 192) === 128 && (b3 & 192) === 128) {
34304           c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b22 & 63) << 6 | b3 & 63;
34305           if (c2 <= 65535 || c2 >= 1114112) {
34306             c2 = null;
34307           }
34308         }
34309       }
34310       if (c2 === null) {
34311         c2 = 65533;
34312         bytesPerSequence = 1;
34313       } else if (c2 > 65535) {
34314         c2 -= 65536;
34315         str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
34316         c2 = 56320 | c2 & 1023;
34317       }
34318       str += String.fromCharCode(c2);
34319       i3 += bytesPerSequence;
34320     }
34321     return str;
34322   }
34323   function writeUtf8(buf, str, pos) {
34324     for (let i3 = 0, c2, lead; i3 < str.length; i3++) {
34325       c2 = str.charCodeAt(i3);
34326       if (c2 > 55295 && c2 < 57344) {
34327         if (lead) {
34328           if (c2 < 56320) {
34329             buf[pos++] = 239;
34330             buf[pos++] = 191;
34331             buf[pos++] = 189;
34332             lead = c2;
34333             continue;
34334           } else {
34335             c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
34336             lead = null;
34337           }
34338         } else {
34339           if (c2 > 56319 || i3 + 1 === str.length) {
34340             buf[pos++] = 239;
34341             buf[pos++] = 191;
34342             buf[pos++] = 189;
34343           } else {
34344             lead = c2;
34345           }
34346           continue;
34347         }
34348       } else if (lead) {
34349         buf[pos++] = 239;
34350         buf[pos++] = 191;
34351         buf[pos++] = 189;
34352         lead = null;
34353       }
34354       if (c2 < 128) {
34355         buf[pos++] = c2;
34356       } else {
34357         if (c2 < 2048) {
34358           buf[pos++] = c2 >> 6 | 192;
34359         } else {
34360           if (c2 < 65536) {
34361             buf[pos++] = c2 >> 12 | 224;
34362           } else {
34363             buf[pos++] = c2 >> 18 | 240;
34364             buf[pos++] = c2 >> 12 & 63 | 128;
34365           }
34366           buf[pos++] = c2 >> 6 & 63 | 128;
34367         }
34368         buf[pos++] = c2 & 63 | 128;
34369       }
34370     }
34371     return pos;
34372   }
34373   var SHIFT_LEFT_32, SHIFT_RIGHT_32, TEXT_DECODER_MIN_LENGTH, utf8TextDecoder, PBF_VARINT, PBF_FIXED64, PBF_BYTES, PBF_FIXED32, Pbf;
34374   var init_pbf = __esm({
34375     "node_modules/pbf/index.js"() {
34376       SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
34377       SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
34378       TEXT_DECODER_MIN_LENGTH = 12;
34379       utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
34380       PBF_VARINT = 0;
34381       PBF_FIXED64 = 1;
34382       PBF_BYTES = 2;
34383       PBF_FIXED32 = 5;
34384       Pbf = class {
34385         /**
34386          * @param {Uint8Array | ArrayBuffer} [buf]
34387          */
34388         constructor(buf = new Uint8Array(16)) {
34389           this.buf = ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf);
34390           this.dataView = new DataView(this.buf.buffer);
34391           this.pos = 0;
34392           this.type = 0;
34393           this.length = this.buf.length;
34394         }
34395         // === READING =================================================================
34396         /**
34397          * @template T
34398          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
34399          * @param {T} result
34400          * @param {number} [end]
34401          */
34402         readFields(readField, result, end = this.length) {
34403           while (this.pos < end) {
34404             const val = this.readVarint(), tag = val >> 3, startPos = this.pos;
34405             this.type = val & 7;
34406             readField(tag, result, this);
34407             if (this.pos === startPos) this.skip(val);
34408           }
34409           return result;
34410         }
34411         /**
34412          * @template T
34413          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
34414          * @param {T} result
34415          */
34416         readMessage(readField, result) {
34417           return this.readFields(readField, result, this.readVarint() + this.pos);
34418         }
34419         readFixed32() {
34420           const val = this.dataView.getUint32(this.pos, true);
34421           this.pos += 4;
34422           return val;
34423         }
34424         readSFixed32() {
34425           const val = this.dataView.getInt32(this.pos, true);
34426           this.pos += 4;
34427           return val;
34428         }
34429         // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
34430         readFixed64() {
34431           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * SHIFT_LEFT_32;
34432           this.pos += 8;
34433           return val;
34434         }
34435         readSFixed64() {
34436           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * SHIFT_LEFT_32;
34437           this.pos += 8;
34438           return val;
34439         }
34440         readFloat() {
34441           const val = this.dataView.getFloat32(this.pos, true);
34442           this.pos += 4;
34443           return val;
34444         }
34445         readDouble() {
34446           const val = this.dataView.getFloat64(this.pos, true);
34447           this.pos += 8;
34448           return val;
34449         }
34450         /**
34451          * @param {boolean} [isSigned]
34452          */
34453         readVarint(isSigned) {
34454           const buf = this.buf;
34455           let val, b3;
34456           b3 = buf[this.pos++];
34457           val = b3 & 127;
34458           if (b3 < 128) return val;
34459           b3 = buf[this.pos++];
34460           val |= (b3 & 127) << 7;
34461           if (b3 < 128) return val;
34462           b3 = buf[this.pos++];
34463           val |= (b3 & 127) << 14;
34464           if (b3 < 128) return val;
34465           b3 = buf[this.pos++];
34466           val |= (b3 & 127) << 21;
34467           if (b3 < 128) return val;
34468           b3 = buf[this.pos];
34469           val |= (b3 & 15) << 28;
34470           return readVarintRemainder(val, isSigned, this);
34471         }
34472         readVarint64() {
34473           return this.readVarint(true);
34474         }
34475         readSVarint() {
34476           const num = this.readVarint();
34477           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
34478         }
34479         readBoolean() {
34480           return Boolean(this.readVarint());
34481         }
34482         readString() {
34483           const end = this.readVarint() + this.pos;
34484           const pos = this.pos;
34485           this.pos = end;
34486           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
34487             return utf8TextDecoder.decode(this.buf.subarray(pos, end));
34488           }
34489           return readUtf8(this.buf, pos, end);
34490         }
34491         readBytes() {
34492           const end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
34493           this.pos = end;
34494           return buffer;
34495         }
34496         // verbose for performance reasons; doesn't affect gzipped size
34497         /**
34498          * @param {number[]} [arr]
34499          * @param {boolean} [isSigned]
34500          */
34501         readPackedVarint(arr = [], isSigned) {
34502           const end = this.readPackedEnd();
34503           while (this.pos < end) arr.push(this.readVarint(isSigned));
34504           return arr;
34505         }
34506         /** @param {number[]} [arr] */
34507         readPackedSVarint(arr = []) {
34508           const end = this.readPackedEnd();
34509           while (this.pos < end) arr.push(this.readSVarint());
34510           return arr;
34511         }
34512         /** @param {boolean[]} [arr] */
34513         readPackedBoolean(arr = []) {
34514           const end = this.readPackedEnd();
34515           while (this.pos < end) arr.push(this.readBoolean());
34516           return arr;
34517         }
34518         /** @param {number[]} [arr] */
34519         readPackedFloat(arr = []) {
34520           const end = this.readPackedEnd();
34521           while (this.pos < end) arr.push(this.readFloat());
34522           return arr;
34523         }
34524         /** @param {number[]} [arr] */
34525         readPackedDouble(arr = []) {
34526           const end = this.readPackedEnd();
34527           while (this.pos < end) arr.push(this.readDouble());
34528           return arr;
34529         }
34530         /** @param {number[]} [arr] */
34531         readPackedFixed32(arr = []) {
34532           const end = this.readPackedEnd();
34533           while (this.pos < end) arr.push(this.readFixed32());
34534           return arr;
34535         }
34536         /** @param {number[]} [arr] */
34537         readPackedSFixed32(arr = []) {
34538           const end = this.readPackedEnd();
34539           while (this.pos < end) arr.push(this.readSFixed32());
34540           return arr;
34541         }
34542         /** @param {number[]} [arr] */
34543         readPackedFixed64(arr = []) {
34544           const end = this.readPackedEnd();
34545           while (this.pos < end) arr.push(this.readFixed64());
34546           return arr;
34547         }
34548         /** @param {number[]} [arr] */
34549         readPackedSFixed64(arr = []) {
34550           const end = this.readPackedEnd();
34551           while (this.pos < end) arr.push(this.readSFixed64());
34552           return arr;
34553         }
34554         readPackedEnd() {
34555           return this.type === PBF_BYTES ? this.readVarint() + this.pos : this.pos + 1;
34556         }
34557         /** @param {number} val */
34558         skip(val) {
34559           const type2 = val & 7;
34560           if (type2 === PBF_VARINT) while (this.buf[this.pos++] > 127) {
34561           }
34562           else if (type2 === PBF_BYTES) this.pos = this.readVarint() + this.pos;
34563           else if (type2 === PBF_FIXED32) this.pos += 4;
34564           else if (type2 === PBF_FIXED64) this.pos += 8;
34565           else throw new Error(`Unimplemented type: ${type2}`);
34566         }
34567         // === WRITING =================================================================
34568         /**
34569          * @param {number} tag
34570          * @param {number} type
34571          */
34572         writeTag(tag, type2) {
34573           this.writeVarint(tag << 3 | type2);
34574         }
34575         /** @param {number} min */
34576         realloc(min3) {
34577           let length2 = this.length || 16;
34578           while (length2 < this.pos + min3) length2 *= 2;
34579           if (length2 !== this.length) {
34580             const buf = new Uint8Array(length2);
34581             buf.set(this.buf);
34582             this.buf = buf;
34583             this.dataView = new DataView(buf.buffer);
34584             this.length = length2;
34585           }
34586         }
34587         finish() {
34588           this.length = this.pos;
34589           this.pos = 0;
34590           return this.buf.subarray(0, this.length);
34591         }
34592         /** @param {number} val */
34593         writeFixed32(val) {
34594           this.realloc(4);
34595           this.dataView.setInt32(this.pos, val, true);
34596           this.pos += 4;
34597         }
34598         /** @param {number} val */
34599         writeSFixed32(val) {
34600           this.realloc(4);
34601           this.dataView.setInt32(this.pos, val, true);
34602           this.pos += 4;
34603         }
34604         /** @param {number} val */
34605         writeFixed64(val) {
34606           this.realloc(8);
34607           this.dataView.setInt32(this.pos, val & -1, true);
34608           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
34609           this.pos += 8;
34610         }
34611         /** @param {number} val */
34612         writeSFixed64(val) {
34613           this.realloc(8);
34614           this.dataView.setInt32(this.pos, val & -1, true);
34615           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
34616           this.pos += 8;
34617         }
34618         /** @param {number} val */
34619         writeVarint(val) {
34620           val = +val || 0;
34621           if (val > 268435455 || val < 0) {
34622             writeBigVarint(val, this);
34623             return;
34624           }
34625           this.realloc(4);
34626           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
34627           if (val <= 127) return;
34628           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
34629           if (val <= 127) return;
34630           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
34631           if (val <= 127) return;
34632           this.buf[this.pos++] = val >>> 7 & 127;
34633         }
34634         /** @param {number} val */
34635         writeSVarint(val) {
34636           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
34637         }
34638         /** @param {boolean} val */
34639         writeBoolean(val) {
34640           this.writeVarint(+val);
34641         }
34642         /** @param {string} str */
34643         writeString(str) {
34644           str = String(str);
34645           this.realloc(str.length * 4);
34646           this.pos++;
34647           const startPos = this.pos;
34648           this.pos = writeUtf8(this.buf, str, this.pos);
34649           const len = this.pos - startPos;
34650           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
34651           this.pos = startPos - 1;
34652           this.writeVarint(len);
34653           this.pos += len;
34654         }
34655         /** @param {number} val */
34656         writeFloat(val) {
34657           this.realloc(4);
34658           this.dataView.setFloat32(this.pos, val, true);
34659           this.pos += 4;
34660         }
34661         /** @param {number} val */
34662         writeDouble(val) {
34663           this.realloc(8);
34664           this.dataView.setFloat64(this.pos, val, true);
34665           this.pos += 8;
34666         }
34667         /** @param {Uint8Array} buffer */
34668         writeBytes(buffer) {
34669           const len = buffer.length;
34670           this.writeVarint(len);
34671           this.realloc(len);
34672           for (let i3 = 0; i3 < len; i3++) this.buf[this.pos++] = buffer[i3];
34673         }
34674         /**
34675          * @template T
34676          * @param {(obj: T, pbf: Pbf) => void} fn
34677          * @param {T} obj
34678          */
34679         writeRawMessage(fn, obj) {
34680           this.pos++;
34681           const startPos = this.pos;
34682           fn(obj, this);
34683           const len = this.pos - startPos;
34684           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
34685           this.pos = startPos - 1;
34686           this.writeVarint(len);
34687           this.pos += len;
34688         }
34689         /**
34690          * @template T
34691          * @param {number} tag
34692          * @param {(obj: T, pbf: Pbf) => void} fn
34693          * @param {T} obj
34694          */
34695         writeMessage(tag, fn, obj) {
34696           this.writeTag(tag, PBF_BYTES);
34697           this.writeRawMessage(fn, obj);
34698         }
34699         /**
34700          * @param {number} tag
34701          * @param {number[]} arr
34702          */
34703         writePackedVarint(tag, arr) {
34704           if (arr.length) this.writeMessage(tag, writePackedVarint, arr);
34705         }
34706         /**
34707          * @param {number} tag
34708          * @param {number[]} arr
34709          */
34710         writePackedSVarint(tag, arr) {
34711           if (arr.length) this.writeMessage(tag, writePackedSVarint, arr);
34712         }
34713         /**
34714          * @param {number} tag
34715          * @param {boolean[]} arr
34716          */
34717         writePackedBoolean(tag, arr) {
34718           if (arr.length) this.writeMessage(tag, writePackedBoolean, arr);
34719         }
34720         /**
34721          * @param {number} tag
34722          * @param {number[]} arr
34723          */
34724         writePackedFloat(tag, arr) {
34725           if (arr.length) this.writeMessage(tag, writePackedFloat, arr);
34726         }
34727         /**
34728          * @param {number} tag
34729          * @param {number[]} arr
34730          */
34731         writePackedDouble(tag, arr) {
34732           if (arr.length) this.writeMessage(tag, writePackedDouble, arr);
34733         }
34734         /**
34735          * @param {number} tag
34736          * @param {number[]} arr
34737          */
34738         writePackedFixed32(tag, arr) {
34739           if (arr.length) this.writeMessage(tag, writePackedFixed32, arr);
34740         }
34741         /**
34742          * @param {number} tag
34743          * @param {number[]} arr
34744          */
34745         writePackedSFixed32(tag, arr) {
34746           if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr);
34747         }
34748         /**
34749          * @param {number} tag
34750          * @param {number[]} arr
34751          */
34752         writePackedFixed64(tag, arr) {
34753           if (arr.length) this.writeMessage(tag, writePackedFixed64, arr);
34754         }
34755         /**
34756          * @param {number} tag
34757          * @param {number[]} arr
34758          */
34759         writePackedSFixed64(tag, arr) {
34760           if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr);
34761         }
34762         /**
34763          * @param {number} tag
34764          * @param {Uint8Array} buffer
34765          */
34766         writeBytesField(tag, buffer) {
34767           this.writeTag(tag, PBF_BYTES);
34768           this.writeBytes(buffer);
34769         }
34770         /**
34771          * @param {number} tag
34772          * @param {number} val
34773          */
34774         writeFixed32Field(tag, val) {
34775           this.writeTag(tag, PBF_FIXED32);
34776           this.writeFixed32(val);
34777         }
34778         /**
34779          * @param {number} tag
34780          * @param {number} val
34781          */
34782         writeSFixed32Field(tag, val) {
34783           this.writeTag(tag, PBF_FIXED32);
34784           this.writeSFixed32(val);
34785         }
34786         /**
34787          * @param {number} tag
34788          * @param {number} val
34789          */
34790         writeFixed64Field(tag, val) {
34791           this.writeTag(tag, PBF_FIXED64);
34792           this.writeFixed64(val);
34793         }
34794         /**
34795          * @param {number} tag
34796          * @param {number} val
34797          */
34798         writeSFixed64Field(tag, val) {
34799           this.writeTag(tag, PBF_FIXED64);
34800           this.writeSFixed64(val);
34801         }
34802         /**
34803          * @param {number} tag
34804          * @param {number} val
34805          */
34806         writeVarintField(tag, val) {
34807           this.writeTag(tag, PBF_VARINT);
34808           this.writeVarint(val);
34809         }
34810         /**
34811          * @param {number} tag
34812          * @param {number} val
34813          */
34814         writeSVarintField(tag, val) {
34815           this.writeTag(tag, PBF_VARINT);
34816           this.writeSVarint(val);
34817         }
34818         /**
34819          * @param {number} tag
34820          * @param {string} str
34821          */
34822         writeStringField(tag, str) {
34823           this.writeTag(tag, PBF_BYTES);
34824           this.writeString(str);
34825         }
34826         /**
34827          * @param {number} tag
34828          * @param {number} val
34829          */
34830         writeFloatField(tag, val) {
34831           this.writeTag(tag, PBF_FIXED32);
34832           this.writeFloat(val);
34833         }
34834         /**
34835          * @param {number} tag
34836          * @param {number} val
34837          */
34838         writeDoubleField(tag, val) {
34839           this.writeTag(tag, PBF_FIXED64);
34840           this.writeDouble(val);
34841         }
34842         /**
34843          * @param {number} tag
34844          * @param {boolean} val
34845          */
34846         writeBooleanField(tag, val) {
34847           this.writeVarintField(tag, +val);
34848         }
34849       };
34850     }
34851   });
34852
34853   // node_modules/@mapbox/point-geometry/index.js
34854   function Point(x2, y2) {
34855     this.x = x2;
34856     this.y = y2;
34857   }
34858   var init_point_geometry = __esm({
34859     "node_modules/@mapbox/point-geometry/index.js"() {
34860       Point.prototype = {
34861         /**
34862          * Clone this point, returning a new point that can be modified
34863          * without affecting the old one.
34864          * @return {Point} the clone
34865          */
34866         clone() {
34867           return new Point(this.x, this.y);
34868         },
34869         /**
34870          * Add this point's x & y coordinates to another point,
34871          * yielding a new point.
34872          * @param {Point} p the other point
34873          * @return {Point} output point
34874          */
34875         add(p2) {
34876           return this.clone()._add(p2);
34877         },
34878         /**
34879          * Subtract this point's x & y coordinates to from point,
34880          * yielding a new point.
34881          * @param {Point} p the other point
34882          * @return {Point} output point
34883          */
34884         sub(p2) {
34885           return this.clone()._sub(p2);
34886         },
34887         /**
34888          * Multiply this point's x & y coordinates by point,
34889          * yielding a new point.
34890          * @param {Point} p the other point
34891          * @return {Point} output point
34892          */
34893         multByPoint(p2) {
34894           return this.clone()._multByPoint(p2);
34895         },
34896         /**
34897          * Divide this point's x & y coordinates by point,
34898          * yielding a new point.
34899          * @param {Point} p the other point
34900          * @return {Point} output point
34901          */
34902         divByPoint(p2) {
34903           return this.clone()._divByPoint(p2);
34904         },
34905         /**
34906          * Multiply this point's x & y coordinates by a factor,
34907          * yielding a new point.
34908          * @param {number} k factor
34909          * @return {Point} output point
34910          */
34911         mult(k3) {
34912           return this.clone()._mult(k3);
34913         },
34914         /**
34915          * Divide this point's x & y coordinates by a factor,
34916          * yielding a new point.
34917          * @param {number} k factor
34918          * @return {Point} output point
34919          */
34920         div(k3) {
34921           return this.clone()._div(k3);
34922         },
34923         /**
34924          * Rotate this point around the 0, 0 origin by an angle a,
34925          * given in radians
34926          * @param {number} a angle to rotate around, in radians
34927          * @return {Point} output point
34928          */
34929         rotate(a4) {
34930           return this.clone()._rotate(a4);
34931         },
34932         /**
34933          * Rotate this point around p point by an angle a,
34934          * given in radians
34935          * @param {number} a angle to rotate around, in radians
34936          * @param {Point} p Point to rotate around
34937          * @return {Point} output point
34938          */
34939         rotateAround(a4, p2) {
34940           return this.clone()._rotateAround(a4, p2);
34941         },
34942         /**
34943          * Multiply this point by a 4x1 transformation matrix
34944          * @param {[number, number, number, number]} m transformation matrix
34945          * @return {Point} output point
34946          */
34947         matMult(m3) {
34948           return this.clone()._matMult(m3);
34949         },
34950         /**
34951          * Calculate this point but as a unit vector from 0, 0, meaning
34952          * that the distance from the resulting point to the 0, 0
34953          * coordinate will be equal to 1 and the angle from the resulting
34954          * point to the 0, 0 coordinate will be the same as before.
34955          * @return {Point} unit vector point
34956          */
34957         unit() {
34958           return this.clone()._unit();
34959         },
34960         /**
34961          * Compute a perpendicular point, where the new y coordinate
34962          * is the old x coordinate and the new x coordinate is the old y
34963          * coordinate multiplied by -1
34964          * @return {Point} perpendicular point
34965          */
34966         perp() {
34967           return this.clone()._perp();
34968         },
34969         /**
34970          * Return a version of this point with the x & y coordinates
34971          * rounded to integers.
34972          * @return {Point} rounded point
34973          */
34974         round() {
34975           return this.clone()._round();
34976         },
34977         /**
34978          * Return the magnitude of this point: this is the Euclidean
34979          * distance from the 0, 0 coordinate to this point's x and y
34980          * coordinates.
34981          * @return {number} magnitude
34982          */
34983         mag() {
34984           return Math.sqrt(this.x * this.x + this.y * this.y);
34985         },
34986         /**
34987          * Judge whether this point is equal to another point, returning
34988          * true or false.
34989          * @param {Point} other the other point
34990          * @return {boolean} whether the points are equal
34991          */
34992         equals(other) {
34993           return this.x === other.x && this.y === other.y;
34994         },
34995         /**
34996          * Calculate the distance from this point to another point
34997          * @param {Point} p the other point
34998          * @return {number} distance
34999          */
35000         dist(p2) {
35001           return Math.sqrt(this.distSqr(p2));
35002         },
35003         /**
35004          * Calculate the distance from this point to another point,
35005          * without the square root step. Useful if you're comparing
35006          * relative distances.
35007          * @param {Point} p the other point
35008          * @return {number} distance
35009          */
35010         distSqr(p2) {
35011           const dx = p2.x - this.x, dy = p2.y - this.y;
35012           return dx * dx + dy * dy;
35013         },
35014         /**
35015          * Get the angle from the 0, 0 coordinate to this point, in radians
35016          * coordinates.
35017          * @return {number} angle
35018          */
35019         angle() {
35020           return Math.atan2(this.y, this.x);
35021         },
35022         /**
35023          * Get the angle from this point to another point, in radians
35024          * @param {Point} b the other point
35025          * @return {number} angle
35026          */
35027         angleTo(b3) {
35028           return Math.atan2(this.y - b3.y, this.x - b3.x);
35029         },
35030         /**
35031          * Get the angle between this point and another point, in radians
35032          * @param {Point} b the other point
35033          * @return {number} angle
35034          */
35035         angleWith(b3) {
35036           return this.angleWithSep(b3.x, b3.y);
35037         },
35038         /**
35039          * Find the angle of the two vectors, solving the formula for
35040          * the cross product a x b = |a||b|sin(θ) for θ.
35041          * @param {number} x the x-coordinate
35042          * @param {number} y the y-coordinate
35043          * @return {number} the angle in radians
35044          */
35045         angleWithSep(x2, y2) {
35046           return Math.atan2(
35047             this.x * y2 - this.y * x2,
35048             this.x * x2 + this.y * y2
35049           );
35050         },
35051         /** @param {[number, number, number, number]} m */
35052         _matMult(m3) {
35053           const x2 = m3[0] * this.x + m3[1] * this.y, y2 = m3[2] * this.x + m3[3] * this.y;
35054           this.x = x2;
35055           this.y = y2;
35056           return this;
35057         },
35058         /** @param {Point} p */
35059         _add(p2) {
35060           this.x += p2.x;
35061           this.y += p2.y;
35062           return this;
35063         },
35064         /** @param {Point} p */
35065         _sub(p2) {
35066           this.x -= p2.x;
35067           this.y -= p2.y;
35068           return this;
35069         },
35070         /** @param {number} k */
35071         _mult(k3) {
35072           this.x *= k3;
35073           this.y *= k3;
35074           return this;
35075         },
35076         /** @param {number} k */
35077         _div(k3) {
35078           this.x /= k3;
35079           this.y /= k3;
35080           return this;
35081         },
35082         /** @param {Point} p */
35083         _multByPoint(p2) {
35084           this.x *= p2.x;
35085           this.y *= p2.y;
35086           return this;
35087         },
35088         /** @param {Point} p */
35089         _divByPoint(p2) {
35090           this.x /= p2.x;
35091           this.y /= p2.y;
35092           return this;
35093         },
35094         _unit() {
35095           this._div(this.mag());
35096           return this;
35097         },
35098         _perp() {
35099           const y2 = this.y;
35100           this.y = this.x;
35101           this.x = -y2;
35102           return this;
35103         },
35104         /** @param {number} angle */
35105         _rotate(angle2) {
35106           const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
35107           this.x = x2;
35108           this.y = y2;
35109           return this;
35110         },
35111         /**
35112          * @param {number} angle
35113          * @param {Point} p
35114          */
35115         _rotateAround(angle2, p2) {
35116           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);
35117           this.x = x2;
35118           this.y = y2;
35119           return this;
35120         },
35121         _round() {
35122           this.x = Math.round(this.x);
35123           this.y = Math.round(this.y);
35124           return this;
35125         },
35126         constructor: Point
35127       };
35128       Point.convert = function(p2) {
35129         if (p2 instanceof Point) {
35130           return (
35131             /** @type {Point} */
35132             p2
35133           );
35134         }
35135         if (Array.isArray(p2)) {
35136           return new Point(+p2[0], +p2[1]);
35137         }
35138         if (p2.x !== void 0 && p2.y !== void 0) {
35139           return new Point(+p2.x, +p2.y);
35140         }
35141         throw new Error("Expected [x, y] or {x, y} point format");
35142       };
35143     }
35144   });
35145
35146   // node_modules/@mapbox/vector-tile/index.js
35147   function readFeature(tag, feature3, pbf) {
35148     if (tag === 1) feature3.id = pbf.readVarint();
35149     else if (tag === 2) readTag(pbf, feature3);
35150     else if (tag === 3) feature3.type = /** @type {0 | 1 | 2 | 3} */
35151     pbf.readVarint();
35152     else if (tag === 4) feature3._geometry = pbf.pos;
35153   }
35154   function readTag(pbf, feature3) {
35155     const end = pbf.readVarint() + pbf.pos;
35156     while (pbf.pos < end) {
35157       const key = feature3._keys[pbf.readVarint()];
35158       const value = feature3._values[pbf.readVarint()];
35159       feature3.properties[key] = value;
35160     }
35161   }
35162   function classifyRings(rings) {
35163     const len = rings.length;
35164     if (len <= 1) return [rings];
35165     const polygons = [];
35166     let polygon2, ccw;
35167     for (let i3 = 0; i3 < len; i3++) {
35168       const area = signedArea(rings[i3]);
35169       if (area === 0) continue;
35170       if (ccw === void 0) ccw = area < 0;
35171       if (ccw === area < 0) {
35172         if (polygon2) polygons.push(polygon2);
35173         polygon2 = [rings[i3]];
35174       } else if (polygon2) {
35175         polygon2.push(rings[i3]);
35176       }
35177     }
35178     if (polygon2) polygons.push(polygon2);
35179     return polygons;
35180   }
35181   function signedArea(ring) {
35182     let sum = 0;
35183     for (let i3 = 0, len = ring.length, j3 = len - 1, p1, p2; i3 < len; j3 = i3++) {
35184       p1 = ring[i3];
35185       p2 = ring[j3];
35186       sum += (p2.x - p1.x) * (p1.y + p2.y);
35187     }
35188     return sum;
35189   }
35190   function readLayer(tag, layer, pbf) {
35191     if (tag === 15) layer.version = pbf.readVarint();
35192     else if (tag === 1) layer.name = pbf.readString();
35193     else if (tag === 5) layer.extent = pbf.readVarint();
35194     else if (tag === 2) layer._features.push(pbf.pos);
35195     else if (tag === 3) layer._keys.push(pbf.readString());
35196     else if (tag === 4) layer._values.push(readValueMessage(pbf));
35197   }
35198   function readValueMessage(pbf) {
35199     let value = null;
35200     const end = pbf.readVarint() + pbf.pos;
35201     while (pbf.pos < end) {
35202       const tag = pbf.readVarint() >> 3;
35203       value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
35204     }
35205     if (value == null) {
35206       throw new Error("unknown feature value");
35207     }
35208     return value;
35209   }
35210   function readTile(tag, layers, pbf) {
35211     if (tag === 3) {
35212       const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
35213       if (layer.length) layers[layer.name] = layer;
35214     }
35215   }
35216   var VectorTileFeature, VectorTileLayer, VectorTile;
35217   var init_vector_tile = __esm({
35218     "node_modules/@mapbox/vector-tile/index.js"() {
35219       init_point_geometry();
35220       VectorTileFeature = class {
35221         /**
35222          * @param {Pbf} pbf
35223          * @param {number} end
35224          * @param {number} extent
35225          * @param {string[]} keys
35226          * @param {(number | string | boolean)[]} values
35227          */
35228         constructor(pbf, end, extent, keys2, values) {
35229           this.properties = {};
35230           this.extent = extent;
35231           this.type = 0;
35232           this.id = void 0;
35233           this._pbf = pbf;
35234           this._geometry = -1;
35235           this._keys = keys2;
35236           this._values = values;
35237           pbf.readFields(readFeature, this, end);
35238         }
35239         loadGeometry() {
35240           const pbf = this._pbf;
35241           pbf.pos = this._geometry;
35242           const end = pbf.readVarint() + pbf.pos;
35243           const lines = [];
35244           let line;
35245           let cmd = 1;
35246           let length2 = 0;
35247           let x2 = 0;
35248           let y2 = 0;
35249           while (pbf.pos < end) {
35250             if (length2 <= 0) {
35251               const cmdLen = pbf.readVarint();
35252               cmd = cmdLen & 7;
35253               length2 = cmdLen >> 3;
35254             }
35255             length2--;
35256             if (cmd === 1 || cmd === 2) {
35257               x2 += pbf.readSVarint();
35258               y2 += pbf.readSVarint();
35259               if (cmd === 1) {
35260                 if (line) lines.push(line);
35261                 line = [];
35262               }
35263               if (line) line.push(new Point(x2, y2));
35264             } else if (cmd === 7) {
35265               if (line) {
35266                 line.push(line[0].clone());
35267               }
35268             } else {
35269               throw new Error(`unknown command ${cmd}`);
35270             }
35271           }
35272           if (line) lines.push(line);
35273           return lines;
35274         }
35275         bbox() {
35276           const pbf = this._pbf;
35277           pbf.pos = this._geometry;
35278           const end = pbf.readVarint() + pbf.pos;
35279           let cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
35280           while (pbf.pos < end) {
35281             if (length2 <= 0) {
35282               const cmdLen = pbf.readVarint();
35283               cmd = cmdLen & 7;
35284               length2 = cmdLen >> 3;
35285             }
35286             length2--;
35287             if (cmd === 1 || cmd === 2) {
35288               x2 += pbf.readSVarint();
35289               y2 += pbf.readSVarint();
35290               if (x2 < x12) x12 = x2;
35291               if (x2 > x22) x22 = x2;
35292               if (y2 < y12) y12 = y2;
35293               if (y2 > y22) y22 = y2;
35294             } else if (cmd !== 7) {
35295               throw new Error(`unknown command ${cmd}`);
35296             }
35297           }
35298           return [x12, y12, x22, y22];
35299         }
35300         /**
35301          * @param {number} x
35302          * @param {number} y
35303          * @param {number} z
35304          * @return {Feature}
35305          */
35306         toGeoJSON(x2, y2, z3) {
35307           const size = this.extent * Math.pow(2, z3), x05 = this.extent * x2, y05 = this.extent * y2, vtCoords = this.loadGeometry();
35308           function projectPoint(p2) {
35309             return [
35310               (p2.x + x05) * 360 / size - 180,
35311               360 / Math.PI * Math.atan(Math.exp((1 - (p2.y + y05) * 2 / size) * Math.PI)) - 90
35312             ];
35313           }
35314           function projectLine(line) {
35315             return line.map(projectPoint);
35316           }
35317           let geometry;
35318           if (this.type === 1) {
35319             const points = [];
35320             for (const line of vtCoords) {
35321               points.push(line[0]);
35322             }
35323             const coordinates = projectLine(points);
35324             geometry = points.length === 1 ? { type: "Point", coordinates: coordinates[0] } : { type: "MultiPoint", coordinates };
35325           } else if (this.type === 2) {
35326             const coordinates = vtCoords.map(projectLine);
35327             geometry = coordinates.length === 1 ? { type: "LineString", coordinates: coordinates[0] } : { type: "MultiLineString", coordinates };
35328           } else if (this.type === 3) {
35329             const polygons = classifyRings(vtCoords);
35330             const coordinates = [];
35331             for (const polygon2 of polygons) {
35332               coordinates.push(polygon2.map(projectLine));
35333             }
35334             geometry = coordinates.length === 1 ? { type: "Polygon", coordinates: coordinates[0] } : { type: "MultiPolygon", coordinates };
35335           } else {
35336             throw new Error("unknown feature type");
35337           }
35338           const result = {
35339             type: "Feature",
35340             geometry,
35341             properties: this.properties
35342           };
35343           if (this.id != null) {
35344             result.id = this.id;
35345           }
35346           return result;
35347         }
35348       };
35349       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
35350       VectorTileLayer = class {
35351         /**
35352          * @param {Pbf} pbf
35353          * @param {number} [end]
35354          */
35355         constructor(pbf, end) {
35356           this.version = 1;
35357           this.name = "";
35358           this.extent = 4096;
35359           this.length = 0;
35360           this._pbf = pbf;
35361           this._keys = [];
35362           this._values = [];
35363           this._features = [];
35364           pbf.readFields(readLayer, this, end);
35365           this.length = this._features.length;
35366         }
35367         /** return feature `i` from this layer as a `VectorTileFeature`
35368          * @param {number} i
35369          */
35370         feature(i3) {
35371           if (i3 < 0 || i3 >= this._features.length) throw new Error("feature index out of bounds");
35372           this._pbf.pos = this._features[i3];
35373           const end = this._pbf.readVarint() + this._pbf.pos;
35374           return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
35375         }
35376       };
35377       VectorTile = class {
35378         /**
35379          * @param {Pbf} pbf
35380          * @param {number} [end]
35381          */
35382         constructor(pbf, end) {
35383           this.layers = pbf.readFields(readTile, {}, end);
35384         }
35385       };
35386     }
35387   });
35388
35389   // modules/services/mapillary.js
35390   var mapillary_exports = {};
35391   __export(mapillary_exports, {
35392     default: () => mapillary_default
35393   });
35394   function loadTiles(which, url, maxZoom2, projection2) {
35395     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
35396     const tiles = tiler8.getTiles(projection2);
35397     tiles.forEach(function(tile) {
35398       loadTile(which, url, tile);
35399     });
35400   }
35401   function loadTile(which, url, tile) {
35402     const cache = _mlyCache.requests;
35403     const tileId = `${tile.id}-${which}`;
35404     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
35405     const controller = new AbortController();
35406     cache.inflight[tileId] = controller;
35407     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
35408     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
35409       if (!response.ok) {
35410         throw new Error(response.status + " " + response.statusText);
35411       }
35412       cache.loaded[tileId] = true;
35413       delete cache.inflight[tileId];
35414       return response.arrayBuffer();
35415     }).then(function(data) {
35416       if (!data) {
35417         throw new Error("No Data");
35418       }
35419       loadTileDataToCache(data, tile, which);
35420       if (which === "images") {
35421         dispatch4.call("loadedImages");
35422       } else if (which === "signs") {
35423         dispatch4.call("loadedSigns");
35424       } else if (which === "points") {
35425         dispatch4.call("loadedMapFeatures");
35426       }
35427     }).catch(function() {
35428       cache.loaded[tileId] = true;
35429       delete cache.inflight[tileId];
35430     });
35431   }
35432   function loadTileDataToCache(data, tile, which) {
35433     const vectorTile = new VectorTile(new Pbf(data));
35434     let features, cache, layer, i3, feature3, loc, d2;
35435     if (vectorTile.layers.hasOwnProperty("image")) {
35436       features = [];
35437       cache = _mlyCache.images;
35438       layer = vectorTile.layers.image;
35439       for (i3 = 0; i3 < layer.length; i3++) {
35440         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35441         loc = feature3.geometry.coordinates;
35442         d2 = {
35443           service: "photo",
35444           loc,
35445           captured_at: feature3.properties.captured_at,
35446           ca: feature3.properties.compass_angle,
35447           id: feature3.properties.id,
35448           is_pano: feature3.properties.is_pano,
35449           sequence_id: feature3.properties.sequence_id
35450         };
35451         cache.forImageId[d2.id] = d2;
35452         features.push({
35453           minX: loc[0],
35454           minY: loc[1],
35455           maxX: loc[0],
35456           maxY: loc[1],
35457           data: d2
35458         });
35459       }
35460       if (cache.rtree) {
35461         cache.rtree.load(features);
35462       }
35463     }
35464     if (vectorTile.layers.hasOwnProperty("sequence")) {
35465       features = [];
35466       cache = _mlyCache.sequences;
35467       layer = vectorTile.layers.sequence;
35468       for (i3 = 0; i3 < layer.length; i3++) {
35469         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35470         if (cache.lineString[feature3.properties.id]) {
35471           cache.lineString[feature3.properties.id].push(feature3);
35472         } else {
35473           cache.lineString[feature3.properties.id] = [feature3];
35474         }
35475       }
35476     }
35477     if (vectorTile.layers.hasOwnProperty("point")) {
35478       features = [];
35479       cache = _mlyCache[which];
35480       layer = vectorTile.layers.point;
35481       for (i3 = 0; i3 < layer.length; i3++) {
35482         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35483         loc = feature3.geometry.coordinates;
35484         d2 = {
35485           service: "photo",
35486           loc,
35487           id: feature3.properties.id,
35488           first_seen_at: feature3.properties.first_seen_at,
35489           last_seen_at: feature3.properties.last_seen_at,
35490           value: feature3.properties.value
35491         };
35492         features.push({
35493           minX: loc[0],
35494           minY: loc[1],
35495           maxX: loc[0],
35496           maxY: loc[1],
35497           data: d2
35498         });
35499       }
35500       if (cache.rtree) {
35501         cache.rtree.load(features);
35502       }
35503     }
35504     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
35505       features = [];
35506       cache = _mlyCache[which];
35507       layer = vectorTile.layers.traffic_sign;
35508       for (i3 = 0; i3 < layer.length; i3++) {
35509         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35510         loc = feature3.geometry.coordinates;
35511         d2 = {
35512           service: "photo",
35513           loc,
35514           id: feature3.properties.id,
35515           first_seen_at: feature3.properties.first_seen_at,
35516           last_seen_at: feature3.properties.last_seen_at,
35517           value: feature3.properties.value
35518         };
35519         features.push({
35520           minX: loc[0],
35521           minY: loc[1],
35522           maxX: loc[0],
35523           maxY: loc[1],
35524           data: d2
35525         });
35526       }
35527       if (cache.rtree) {
35528         cache.rtree.load(features);
35529       }
35530     }
35531   }
35532   function loadData(url) {
35533     return fetch(url).then(function(response) {
35534       if (!response.ok) {
35535         throw new Error(response.status + " " + response.statusText);
35536       }
35537       return response.json();
35538     }).then(function(result) {
35539       if (!result) {
35540         return [];
35541       }
35542       return result.data || [];
35543     });
35544   }
35545   function partitionViewport(projection2) {
35546     const z3 = geoScaleToZoom(projection2.scale());
35547     const z22 = Math.ceil(z3 * 2) / 2 + 2.5;
35548     const tiler8 = utilTiler().zoomExtent([z22, z22]);
35549     return tiler8.getTiles(projection2).map(function(tile) {
35550       return tile.extent;
35551     });
35552   }
35553   function searchLimited(limit, projection2, rtree) {
35554     limit = limit || 5;
35555     return partitionViewport(projection2).reduce(function(result, extent) {
35556       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
35557         return d2.data;
35558       });
35559       return found.length ? result.concat(found) : result;
35560     }, []);
35561   }
35562   var accessToken, apiUrl, baseTileUrl, mapFeatureTileUrl, tileUrl, trafficSignTileUrl, viewercss, viewerjs, minZoom, dispatch4, _loadViewerPromise, _mlyActiveImage, _mlyCache, _mlyFallback, _mlyHighlightedDetection, _mlyShowFeatureDetections, _mlyShowSignDetections, _mlyViewer, _mlyViewerFilter, _isViewerOpen, mapillary_default;
35563   var init_mapillary = __esm({
35564     "modules/services/mapillary.js"() {
35565       "use strict";
35566       init_src4();
35567       init_src5();
35568       init_pbf();
35569       init_rbush();
35570       init_vector_tile();
35571       init_geo2();
35572       init_util();
35573       init_services();
35574       accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
35575       apiUrl = "https://graph.mapillary.com/";
35576       baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
35577       mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
35578       tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
35579       trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
35580       viewercss = "mapillary-js/mapillary.css";
35581       viewerjs = "mapillary-js/mapillary.js";
35582       minZoom = 14;
35583       dispatch4 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
35584       _mlyFallback = false;
35585       _mlyShowFeatureDetections = false;
35586       _mlyShowSignDetections = false;
35587       _mlyViewerFilter = ["all"];
35588       _isViewerOpen = false;
35589       mapillary_default = {
35590         // Initialize Mapillary
35591         init: function() {
35592           if (!_mlyCache) {
35593             this.reset();
35594           }
35595           this.event = utilRebind(this, dispatch4, "on");
35596         },
35597         // Reset cache and state
35598         reset: function() {
35599           if (_mlyCache) {
35600             Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
35601               request3.abort();
35602             });
35603           }
35604           _mlyCache = {
35605             images: { rtree: new RBush(), forImageId: {} },
35606             image_detections: { forImageId: {} },
35607             signs: { rtree: new RBush() },
35608             points: { rtree: new RBush() },
35609             sequences: { rtree: new RBush(), lineString: {} },
35610             requests: { loaded: {}, inflight: {} }
35611           };
35612           _mlyActiveImage = null;
35613         },
35614         // Get visible images
35615         images: function(projection2) {
35616           const limit = 5;
35617           return searchLimited(limit, projection2, _mlyCache.images.rtree);
35618         },
35619         // Get visible traffic signs
35620         signs: function(projection2) {
35621           const limit = 5;
35622           return searchLimited(limit, projection2, _mlyCache.signs.rtree);
35623         },
35624         // Get visible map (point) features
35625         mapFeatures: function(projection2) {
35626           const limit = 5;
35627           return searchLimited(limit, projection2, _mlyCache.points.rtree);
35628         },
35629         // Get cached image by id
35630         cachedImage: function(imageId) {
35631           return _mlyCache.images.forImageId[imageId];
35632         },
35633         // Get visible sequences
35634         sequences: function(projection2) {
35635           const viewport = projection2.clipExtent();
35636           const min3 = [viewport[0][0], viewport[1][1]];
35637           const max3 = [viewport[1][0], viewport[0][1]];
35638           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
35639           const sequenceIds = {};
35640           let lineStrings = [];
35641           _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
35642             if (d2.data.sequence_id) {
35643               sequenceIds[d2.data.sequence_id] = true;
35644             }
35645           });
35646           Object.keys(sequenceIds).forEach(function(sequenceId) {
35647             if (_mlyCache.sequences.lineString[sequenceId]) {
35648               lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
35649             }
35650           });
35651           return lineStrings;
35652         },
35653         // Load images in the visible area
35654         loadImages: function(projection2) {
35655           loadTiles("images", tileUrl, 14, projection2);
35656         },
35657         // Load traffic signs in the visible area
35658         loadSigns: function(projection2) {
35659           loadTiles("signs", trafficSignTileUrl, 14, projection2);
35660         },
35661         // Load map (point) features in the visible area
35662         loadMapFeatures: function(projection2) {
35663           loadTiles("points", mapFeatureTileUrl, 14, projection2);
35664         },
35665         // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
35666         ensureViewerLoaded: function(context) {
35667           if (_loadViewerPromise) return _loadViewerPromise;
35668           const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
35669           wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
35670           const that = this;
35671           _loadViewerPromise = new Promise((resolve, reject) => {
35672             let loadedCount = 0;
35673             function loaded() {
35674               loadedCount += 1;
35675               if (loadedCount === 2) resolve();
35676             }
35677             const head = select_default2("head");
35678             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() {
35679               reject();
35680             });
35681             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() {
35682               reject();
35683             });
35684           }).catch(function() {
35685             _loadViewerPromise = null;
35686           }).then(function() {
35687             that.initViewer(context);
35688           });
35689           return _loadViewerPromise;
35690         },
35691         // Load traffic sign image sprites
35692         loadSignResources: function(context) {
35693           context.ui().svgDefs.addSprites(
35694             ["mapillary-sprite"],
35695             false
35696             /* don't override colors */
35697           );
35698           return this;
35699         },
35700         // Load map (point) feature image sprites
35701         loadObjectResources: function(context) {
35702           context.ui().svgDefs.addSprites(
35703             ["mapillary-object-sprite"],
35704             false
35705             /* don't override colors */
35706           );
35707           return this;
35708         },
35709         // Remove previous detections in image viewer
35710         resetTags: function() {
35711           if (_mlyViewer && !_mlyFallback) {
35712             _mlyViewer.getComponent("tag").removeAll();
35713           }
35714         },
35715         // Show map feature detections in image viewer
35716         showFeatureDetections: function(value) {
35717           _mlyShowFeatureDetections = value;
35718           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
35719             this.resetTags();
35720           }
35721         },
35722         // Show traffic sign detections in image viewer
35723         showSignDetections: function(value) {
35724           _mlyShowSignDetections = value;
35725           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
35726             this.resetTags();
35727           }
35728         },
35729         // Apply filter to image viewer
35730         filterViewer: function(context) {
35731           const showsPano = context.photos().showsPanoramic();
35732           const showsFlat = context.photos().showsFlat();
35733           const fromDate = context.photos().fromDate();
35734           const toDate = context.photos().toDate();
35735           const filter2 = ["all"];
35736           if (!showsPano) filter2.push(["!=", "cameraType", "spherical"]);
35737           if (!showsFlat && showsPano) filter2.push(["==", "pano", true]);
35738           if (fromDate) {
35739             filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
35740           }
35741           if (toDate) {
35742             filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
35743           }
35744           if (_mlyViewer) {
35745             _mlyViewer.setFilter(filter2);
35746           }
35747           _mlyViewerFilter = filter2;
35748           return filter2;
35749         },
35750         // Make the image viewer visible
35751         showViewer: function(context) {
35752           const wrap2 = context.container().select(".photoviewer");
35753           const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
35754           if (isHidden && _mlyViewer) {
35755             for (const service of Object.values(services)) {
35756               if (service === this) continue;
35757               if (typeof service.hideViewer === "function") {
35758                 service.hideViewer(context);
35759               }
35760             }
35761             wrap2.classed("hide", false).selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
35762             _mlyViewer.resize();
35763           }
35764           _isViewerOpen = true;
35765           return this;
35766         },
35767         // Hide the image viewer and resets map markers
35768         hideViewer: function(context) {
35769           _mlyActiveImage = null;
35770           if (!_mlyFallback && _mlyViewer) {
35771             _mlyViewer.getComponent("sequence").stop();
35772           }
35773           const viewer = context.container().select(".photoviewer");
35774           if (!viewer.empty()) viewer.datum(null);
35775           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
35776           this.updateUrlImage(null);
35777           dispatch4.call("imageChanged");
35778           dispatch4.call("loadedMapFeatures");
35779           dispatch4.call("loadedSigns");
35780           _isViewerOpen = false;
35781           return this.setStyles(context, null);
35782         },
35783         // Get viewer status
35784         isViewerOpen: function() {
35785           return _isViewerOpen;
35786         },
35787         // Update the URL with current image id
35788         updateUrlImage: function(imageId) {
35789           const hash2 = utilStringQs(window.location.hash);
35790           if (imageId) {
35791             hash2.photo = "mapillary/" + imageId;
35792           } else {
35793             delete hash2.photo;
35794           }
35795           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
35796         },
35797         // Highlight the detection in the viewer that is related to the clicked map feature
35798         highlightDetection: function(detection) {
35799           if (detection) {
35800             _mlyHighlightedDetection = detection.id;
35801           }
35802           return this;
35803         },
35804         // Initialize image viewer (Mapillar JS)
35805         initViewer: function(context) {
35806           if (!window.mapillary) return;
35807           const opts = {
35808             accessToken,
35809             component: {
35810               cover: false,
35811               keyboard: false,
35812               tag: true
35813             },
35814             container: "ideditor-mly"
35815           };
35816           if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
35817             _mlyFallback = true;
35818             opts.component = {
35819               cover: false,
35820               direction: false,
35821               imagePlane: false,
35822               keyboard: false,
35823               mouse: false,
35824               sequence: false,
35825               tag: false,
35826               image: true,
35827               // fallback
35828               navigation: true
35829               // fallback
35830             };
35831           }
35832           _mlyViewer = new mapillary.Viewer(opts);
35833           _mlyViewer.on("image", imageChanged.bind(this));
35834           _mlyViewer.on("bearing", bearingChanged);
35835           if (_mlyViewerFilter) {
35836             _mlyViewer.setFilter(_mlyViewerFilter);
35837           }
35838           context.ui().photoviewer.on("resize.mapillary", function() {
35839             if (_mlyViewer) _mlyViewer.resize();
35840           });
35841           function imageChanged(photo) {
35842             this.resetTags();
35843             const image = photo.image;
35844             this.setActiveImage(image);
35845             this.setStyles(context, null);
35846             const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
35847             context.map().centerEase(loc);
35848             this.updateUrlImage(image.id);
35849             if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
35850               this.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
35851             }
35852             dispatch4.call("imageChanged");
35853           }
35854           function bearingChanged(e3) {
35855             dispatch4.call("bearingChanged", void 0, e3);
35856           }
35857         },
35858         // Move to an image
35859         selectImage: function(context, imageId) {
35860           if (_mlyViewer && imageId) {
35861             _mlyViewer.moveTo(imageId).then((image) => this.setActiveImage(image)).catch(function(e3) {
35862               console.error("mly3", e3);
35863             });
35864           }
35865           return this;
35866         },
35867         // Return the currently displayed image
35868         getActiveImage: function() {
35869           return _mlyActiveImage;
35870         },
35871         // Return a list of detection objects for the given id
35872         getDetections: function(id2) {
35873           return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
35874         },
35875         // Set the currently visible image
35876         setActiveImage: function(image) {
35877           if (image) {
35878             _mlyActiveImage = {
35879               ca: image.originalCompassAngle,
35880               id: image.id,
35881               loc: [image.originalLngLat.lng, image.originalLngLat.lat],
35882               is_pano: image.cameraType === "spherical",
35883               sequence_id: image.sequenceId
35884             };
35885           } else {
35886             _mlyActiveImage = null;
35887           }
35888         },
35889         // Update the currently highlighted sequence and selected bubble.
35890         setStyles: function(context, hovered) {
35891           const hoveredImageId = hovered && hovered.id;
35892           const hoveredSequenceId = hovered && hovered.sequence_id;
35893           const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
35894           context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
35895             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
35896           }).classed("hovered", function(d2) {
35897             return d2.id === hoveredImageId;
35898           });
35899           context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
35900             return d2.properties.id === hoveredSequenceId;
35901           }).classed("currentView", function(d2) {
35902             return d2.properties.id === selectedSequenceId;
35903           });
35904           return this;
35905         },
35906         // Get detections for the current image and shows them in the image viewer
35907         updateDetections: function(imageId, url) {
35908           if (!_mlyViewer || _mlyFallback) return;
35909           if (!imageId) return;
35910           const cache = _mlyCache.image_detections;
35911           if (cache.forImageId[imageId]) {
35912             showDetections(_mlyCache.image_detections.forImageId[imageId]);
35913           } else {
35914             loadData(url).then((detections) => {
35915               detections.forEach(function(detection) {
35916                 if (!cache.forImageId[imageId]) {
35917                   cache.forImageId[imageId] = [];
35918                 }
35919                 cache.forImageId[imageId].push({
35920                   geometry: detection.geometry,
35921                   id: detection.id,
35922                   image_id: imageId,
35923                   value: detection.value
35924                 });
35925               });
35926               showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
35927             });
35928           }
35929           function showDetections(detections) {
35930             const tagComponent = _mlyViewer.getComponent("tag");
35931             detections.forEach(function(data) {
35932               const tag = makeTag(data);
35933               if (tag) {
35934                 tagComponent.add([tag]);
35935               }
35936             });
35937           }
35938           function makeTag(data) {
35939             const valueParts = data.value.split("--");
35940             if (!valueParts.length) return;
35941             let tag;
35942             let text;
35943             let color2 = 16777215;
35944             if (_mlyHighlightedDetection === data.id) {
35945               color2 = 16776960;
35946               text = valueParts[1];
35947               if (text === "flat" || text === "discrete" || text === "sign") {
35948                 text = valueParts[2];
35949               }
35950               text = text.replace(/-/g, " ");
35951               text = text.charAt(0).toUpperCase() + text.slice(1);
35952               _mlyHighlightedDetection = null;
35953             }
35954             var decodedGeometry = window.atob(data.geometry);
35955             var uintArray = new Uint8Array(decodedGeometry.length);
35956             for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
35957               uintArray[i3] = decodedGeometry.charCodeAt(i3);
35958             }
35959             const tile = new VectorTile(new Pbf(uintArray.buffer));
35960             const layer = tile.layers["mpy-or"];
35961             const geometries = layer.feature(0).loadGeometry();
35962             const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
35963             tag = new mapillary.OutlineTag(
35964               data.id,
35965               new mapillary.PolygonGeometry(polygon2[0]),
35966               {
35967                 text,
35968                 textColor: color2,
35969                 lineColor: color2,
35970                 lineWidth: 2,
35971                 fillColor: color2,
35972                 fillOpacity: 0.3
35973               }
35974             );
35975             return tag;
35976           }
35977         },
35978         // Return the current cache
35979         cache: function() {
35980           return _mlyCache;
35981         }
35982       };
35983     }
35984   });
35985
35986   // modules/services/maprules.js
35987   var maprules_exports = {};
35988   __export(maprules_exports, {
35989     default: () => maprules_default
35990   });
35991   var buildRuleChecks, buildLineKeys, maprules_default;
35992   var init_maprules = __esm({
35993     "modules/services/maprules.js"() {
35994       "use strict";
35995       init_tags();
35996       init_util();
35997       init_validation();
35998       buildRuleChecks = function() {
35999         return {
36000           equals: function(equals) {
36001             return function(tags) {
36002               return Object.keys(equals).every(function(k3) {
36003                 return equals[k3] === tags[k3];
36004               });
36005             };
36006           },
36007           notEquals: function(notEquals) {
36008             return function(tags) {
36009               return Object.keys(notEquals).some(function(k3) {
36010                 return notEquals[k3] !== tags[k3];
36011               });
36012             };
36013           },
36014           absence: function(absence) {
36015             return function(tags) {
36016               return Object.keys(tags).indexOf(absence) === -1;
36017             };
36018           },
36019           presence: function(presence) {
36020             return function(tags) {
36021               return Object.keys(tags).indexOf(presence) > -1;
36022             };
36023           },
36024           greaterThan: function(greaterThan) {
36025             var key = Object.keys(greaterThan)[0];
36026             var value = greaterThan[key];
36027             return function(tags) {
36028               return tags[key] > value;
36029             };
36030           },
36031           greaterThanEqual: function(greaterThanEqual) {
36032             var key = Object.keys(greaterThanEqual)[0];
36033             var value = greaterThanEqual[key];
36034             return function(tags) {
36035               return tags[key] >= value;
36036             };
36037           },
36038           lessThan: function(lessThan) {
36039             var key = Object.keys(lessThan)[0];
36040             var value = lessThan[key];
36041             return function(tags) {
36042               return tags[key] < value;
36043             };
36044           },
36045           lessThanEqual: function(lessThanEqual) {
36046             var key = Object.keys(lessThanEqual)[0];
36047             var value = lessThanEqual[key];
36048             return function(tags) {
36049               return tags[key] <= value;
36050             };
36051           },
36052           positiveRegex: function(positiveRegex) {
36053             var tagKey = Object.keys(positiveRegex)[0];
36054             var expression = positiveRegex[tagKey].join("|");
36055             var regex = new RegExp(expression);
36056             return function(tags) {
36057               return regex.test(tags[tagKey]);
36058             };
36059           },
36060           negativeRegex: function(negativeRegex) {
36061             var tagKey = Object.keys(negativeRegex)[0];
36062             var expression = negativeRegex[tagKey].join("|");
36063             var regex = new RegExp(expression);
36064             return function(tags) {
36065               return !regex.test(tags[tagKey]);
36066             };
36067           }
36068         };
36069       };
36070       buildLineKeys = function() {
36071         return {
36072           highway: {
36073             rest_area: true,
36074             services: true
36075           },
36076           railway: {
36077             roundhouse: true,
36078             station: true,
36079             traverser: true,
36080             turntable: true,
36081             wash: true
36082           }
36083         };
36084       };
36085       maprules_default = {
36086         init: function() {
36087           this._ruleChecks = buildRuleChecks();
36088           this._validationRules = [];
36089           this._areaKeys = osmAreaKeys;
36090           this._lineKeys = buildLineKeys();
36091         },
36092         // list of rules only relevant to tag checks...
36093         filterRuleChecks: function(selector) {
36094           var _ruleChecks = this._ruleChecks;
36095           return Object.keys(selector).reduce(function(rules, key) {
36096             if (["geometry", "error", "warning"].indexOf(key) === -1) {
36097               rules.push(_ruleChecks[key](selector[key]));
36098             }
36099             return rules;
36100           }, []);
36101         },
36102         // builds tagMap from mapcss-parse selector object...
36103         buildTagMap: function(selector) {
36104           var getRegexValues = function(regexes) {
36105             return regexes.map(function(regex) {
36106               return regex.replace(/\$|\^/g, "");
36107             });
36108           };
36109           var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
36110             var values;
36111             var isRegex = /regex/gi.test(key);
36112             var isEqual2 = /equals/gi.test(key);
36113             if (isRegex || isEqual2) {
36114               Object.keys(selector[key]).forEach(function(selectorKey) {
36115                 values = isEqual2 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
36116                 if (expectedTags.hasOwnProperty(selectorKey)) {
36117                   values = values.concat(expectedTags[selectorKey]);
36118                 }
36119                 expectedTags[selectorKey] = values;
36120               });
36121             } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
36122               var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
36123               values = [selector[key][tagKey]];
36124               if (expectedTags.hasOwnProperty(tagKey)) {
36125                 values = values.concat(expectedTags[tagKey]);
36126               }
36127               expectedTags[tagKey] = values;
36128             }
36129             return expectedTags;
36130           }, {});
36131           return tagMap;
36132         },
36133         // inspired by osmWay#isArea()
36134         inferGeometry: function(tagMap) {
36135           var _lineKeys = this._lineKeys;
36136           var _areaKeys = this._areaKeys;
36137           var keyValueDoesNotImplyArea = function(key2) {
36138             return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
36139           };
36140           var keyValueImpliesLine = function(key2) {
36141             return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
36142           };
36143           if (tagMap.hasOwnProperty("area")) {
36144             if (tagMap.area.indexOf("yes") > -1) {
36145               return "area";
36146             }
36147             if (tagMap.area.indexOf("no") > -1) {
36148               return "line";
36149             }
36150           }
36151           for (var key in tagMap) {
36152             if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
36153               return "area";
36154             }
36155             if (key in _lineKeys && keyValueImpliesLine(key)) {
36156               return "area";
36157             }
36158           }
36159           return "line";
36160         },
36161         // adds from mapcss-parse selector check...
36162         addRule: function(selector) {
36163           var rule = {
36164             // checks relevant to mapcss-selector
36165             checks: this.filterRuleChecks(selector),
36166             // true if all conditions for a tag error are true..
36167             matches: function(entity) {
36168               return this.checks.every(function(check) {
36169                 return check(entity.tags);
36170               });
36171             },
36172             // borrowed from Way#isArea()
36173             inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
36174             geometryMatches: function(entity, graph) {
36175               if (entity.type === "node" || entity.type === "relation") {
36176                 return selector.geometry === entity.type;
36177               } else if (entity.type === "way") {
36178                 return this.inferredGeometry === entity.geometry(graph);
36179               }
36180             },
36181             // when geometries match and tag matches are present, return a warning...
36182             findIssues: function(entity, graph, issues) {
36183               if (this.geometryMatches(entity, graph) && this.matches(entity)) {
36184                 var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
36185                 var message = selector[severity];
36186                 issues.push(new validationIssue({
36187                   type: "maprules",
36188                   severity,
36189                   message: function() {
36190                     return message;
36191                   },
36192                   entityIds: [entity.id]
36193                 }));
36194               }
36195             }
36196           };
36197           this._validationRules.push(rule);
36198         },
36199         clearRules: function() {
36200           this._validationRules = [];
36201         },
36202         // returns validationRules...
36203         validationRules: function() {
36204           return this._validationRules;
36205         },
36206         // returns ruleChecks
36207         ruleChecks: function() {
36208           return this._ruleChecks;
36209         }
36210       };
36211     }
36212   });
36213
36214   // modules/services/nominatim.js
36215   var nominatim_exports = {};
36216   __export(nominatim_exports, {
36217     default: () => nominatim_default
36218   });
36219   var apibase, _inflight, _nominatimCache, nominatim_default;
36220   var init_nominatim = __esm({
36221     "modules/services/nominatim.js"() {
36222       "use strict";
36223       init_src18();
36224       init_rbush();
36225       init_geo2();
36226       init_util();
36227       init_core();
36228       init_id();
36229       apibase = nominatimApiUrl;
36230       _inflight = {};
36231       nominatim_default = {
36232         init: function() {
36233           _inflight = {};
36234           _nominatimCache = new RBush();
36235         },
36236         reset: function() {
36237           Object.values(_inflight).forEach(function(controller) {
36238             controller.abort();
36239           });
36240           _inflight = {};
36241           _nominatimCache = new RBush();
36242         },
36243         countryCode: function(location, callback) {
36244           this.reverse(location, function(err, result) {
36245             if (err) {
36246               return callback(err);
36247             } else if (result.address) {
36248               return callback(null, result.address.country_code);
36249             } else {
36250               return callback("Unable to geocode", null);
36251             }
36252           });
36253         },
36254         reverse: function(loc, callback) {
36255           var cached = _nominatimCache.search(
36256             { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
36257           );
36258           if (cached.length > 0) {
36259             if (callback) callback(null, cached[0].data);
36260             return;
36261           }
36262           var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
36263           var url = apibase + "reverse?" + utilQsString(params);
36264           if (_inflight[url]) return;
36265           var controller = new AbortController();
36266           _inflight[url] = controller;
36267           json_default(url, {
36268             signal: controller.signal,
36269             headers: {
36270               "Accept-Language": _mainLocalizer.localeCodes().join(",")
36271             }
36272           }).then(function(result) {
36273             delete _inflight[url];
36274             if (result && result.error) {
36275               throw new Error(result.error);
36276             }
36277             var extent = geoExtent(loc).padByMeters(200);
36278             _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
36279             if (callback) callback(null, result);
36280           }).catch(function(err) {
36281             delete _inflight[url];
36282             if (err.name === "AbortError") return;
36283             if (callback) callback(err.message);
36284           });
36285         },
36286         search: function(val, callback) {
36287           const params = {
36288             q: val,
36289             limit: 10,
36290             format: "json"
36291           };
36292           var url = apibase + "search?" + utilQsString(params);
36293           if (_inflight[url]) return;
36294           var controller = new AbortController();
36295           _inflight[url] = controller;
36296           json_default(url, {
36297             signal: controller.signal,
36298             headers: {
36299               "Accept-Language": _mainLocalizer.localeCodes().join(",")
36300             }
36301           }).then(function(result) {
36302             delete _inflight[url];
36303             if (result && result.error) {
36304               throw new Error(result.error);
36305             }
36306             if (callback) callback(null, result);
36307           }).catch(function(err) {
36308             delete _inflight[url];
36309             if (err.name === "AbortError") return;
36310             if (callback) callback(err.message);
36311           });
36312         }
36313       };
36314     }
36315   });
36316
36317   // node_modules/name-suggestion-index/lib/simplify.js
36318   function simplify(str) {
36319     if (typeof str !== "string") return "";
36320     return import_diacritics.default.remove(
36321       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()
36322     );
36323   }
36324   var import_diacritics;
36325   var init_simplify = __esm({
36326     "node_modules/name-suggestion-index/lib/simplify.js"() {
36327       import_diacritics = __toESM(require_diacritics(), 1);
36328     }
36329   });
36330
36331   // node_modules/name-suggestion-index/config/matchGroups.json
36332   var matchGroups_default;
36333   var init_matchGroups = __esm({
36334     "node_modules/name-suggestion-index/config/matchGroups.json"() {
36335       matchGroups_default = {
36336         matchGroups: {
36337           adult_gaming_centre: [
36338             "amenity/casino",
36339             "amenity/gambling",
36340             "leisure/adult_gaming_centre"
36341           ],
36342           bar: [
36343             "amenity/bar",
36344             "amenity/pub",
36345             "amenity/restaurant"
36346           ],
36347           beauty: [
36348             "shop/beauty",
36349             "shop/hairdresser_supply"
36350           ],
36351           bed: [
36352             "shop/bed",
36353             "shop/furniture"
36354           ],
36355           beverages: [
36356             "shop/alcohol",
36357             "shop/beer",
36358             "shop/beverages",
36359             "shop/kiosk",
36360             "shop/wine"
36361           ],
36362           camping: [
36363             "tourism/camp_site",
36364             "tourism/caravan_site"
36365           ],
36366           car_parts: [
36367             "shop/car_parts",
36368             "shop/car_repair",
36369             "shop/tires",
36370             "shop/tyres"
36371           ],
36372           clinic: [
36373             "amenity/clinic",
36374             "amenity/doctors",
36375             "healthcare/clinic",
36376             "healthcare/laboratory",
36377             "healthcare/physiotherapist",
36378             "healthcare/sample_collection",
36379             "healthcare/dialysis"
36380           ],
36381           convenience: [
36382             "shop/beauty",
36383             "shop/chemist",
36384             "shop/convenience",
36385             "shop/cosmetics",
36386             "shop/grocery",
36387             "shop/kiosk",
36388             "shop/newsagent",
36389             "shop/perfumery"
36390           ],
36391           coworking: [
36392             "amenity/coworking_space",
36393             "office/coworking",
36394             "office/coworking_space"
36395           ],
36396           dentist: [
36397             "amenity/dentist",
36398             "amenity/doctors",
36399             "healthcare/dentist"
36400           ],
36401           electronics: [
36402             "office/telecommunication",
36403             "shop/appliance",
36404             "shop/computer",
36405             "shop/electronics",
36406             "shop/hifi",
36407             "shop/kiosk",
36408             "shop/mobile",
36409             "shop/mobile_phone",
36410             "shop/telecommunication",
36411             "shop/video_games"
36412           ],
36413           estate_agents: [
36414             "office/estate_agent",
36415             "shop/estate_agent",
36416             "office/mortgage",
36417             "office/financial"
36418           ],
36419           fabric: [
36420             "shop/fabric",
36421             "shop/haberdashery",
36422             "shop/sewing"
36423           ],
36424           fashion: [
36425             "shop/accessories",
36426             "shop/bag",
36427             "shop/boutique",
36428             "shop/clothes",
36429             "shop/department_store",
36430             "shop/fashion",
36431             "shop/fashion_accessories",
36432             "shop/sports",
36433             "shop/shoes"
36434           ],
36435           financial: [
36436             "amenity/bank",
36437             "office/accountant",
36438             "office/financial",
36439             "office/financial_advisor",
36440             "office/tax_advisor",
36441             "shop/tax"
36442           ],
36443           fitness: [
36444             "leisure/fitness_centre",
36445             "leisure/fitness_center",
36446             "leisure/sports_centre",
36447             "leisure/sports_center"
36448           ],
36449           food: [
36450             "amenity/cafe",
36451             "amenity/fast_food",
36452             "amenity/ice_cream",
36453             "amenity/restaurant",
36454             "shop/bakery",
36455             "shop/candy",
36456             "shop/chocolate",
36457             "shop/coffee",
36458             "shop/confectionary",
36459             "shop/confectionery",
36460             "shop/deli",
36461             "shop/food",
36462             "shop/kiosk",
36463             "shop/ice_cream",
36464             "shop/pastry",
36465             "shop/tea"
36466           ],
36467           fuel: [
36468             "amenity/fuel",
36469             "shop/gas",
36470             "shop/convenience;gas",
36471             "shop/gas;convenience"
36472           ],
36473           gift: [
36474             "shop/gift",
36475             "shop/card",
36476             "shop/cards",
36477             "shop/kiosk",
36478             "shop/stationery"
36479           ],
36480           glass: [
36481             "craft/window_construction",
36482             "craft/glaziery",
36483             "shop/car_repair"
36484           ],
36485           hardware: [
36486             "shop/bathroom_furnishing",
36487             "shop/carpet",
36488             "shop/diy",
36489             "shop/doityourself",
36490             "shop/doors",
36491             "shop/electrical",
36492             "shop/flooring",
36493             "shop/hardware",
36494             "shop/hardware_store",
36495             "shop/power_tools",
36496             "shop/tool_hire",
36497             "shop/tools",
36498             "shop/trade"
36499           ],
36500           health_food: [
36501             "shop/health",
36502             "shop/health_food",
36503             "shop/herbalist",
36504             "shop/nutrition_supplements"
36505           ],
36506           hobby: [
36507             "shop/electronics",
36508             "shop/hobby",
36509             "shop/books",
36510             "shop/games",
36511             "shop/collector",
36512             "shop/toys",
36513             "shop/model",
36514             "shop/video_games",
36515             "shop/anime"
36516           ],
36517           hospital: [
36518             "amenity/doctors",
36519             "amenity/hospital",
36520             "healthcare/hospital"
36521           ],
36522           houseware: [
36523             "shop/houseware",
36524             "shop/interior_decoration"
36525           ],
36526           water_rescue: [
36527             "amenity/lifeboat_station",
36528             "emergency/lifeboat_station",
36529             "emergency/marine_rescue",
36530             "emergency/water_rescue"
36531           ],
36532           locksmith: [
36533             "craft/key_cutter",
36534             "craft/locksmith",
36535             "shop/locksmith"
36536           ],
36537           lodging: [
36538             "tourism/guest_house",
36539             "tourism/hotel",
36540             "tourism/motel"
36541           ],
36542           money_transfer: [
36543             "amenity/money_transfer",
36544             "shop/money_transfer"
36545           ],
36546           music: ["shop/music", "shop/musical_instrument"],
36547           office_supplies: [
36548             "shop/office_supplies",
36549             "shop/stationary",
36550             "shop/stationery"
36551           ],
36552           outdoor: [
36553             "shop/clothes",
36554             "shop/outdoor",
36555             "shop/sports"
36556           ],
36557           parcel_locker: [
36558             "amenity/parcel_locker",
36559             "amenity/vending_machine"
36560           ],
36561           pharmacy: [
36562             "amenity/doctors",
36563             "amenity/pharmacy",
36564             "healthcare/pharmacy",
36565             "shop/chemist"
36566           ],
36567           playground: [
36568             "amenity/theme_park",
36569             "leisure/amusement_arcade",
36570             "leisure/playground"
36571           ],
36572           rental: [
36573             "amenity/bicycle_rental",
36574             "amenity/boat_rental",
36575             "amenity/car_rental",
36576             "amenity/truck_rental",
36577             "amenity/vehicle_rental",
36578             "shop/kiosk",
36579             "shop/plant_hire",
36580             "shop/rental",
36581             "shop/tool_hire"
36582           ],
36583           school: [
36584             "amenity/childcare",
36585             "amenity/college",
36586             "amenity/kindergarten",
36587             "amenity/language_school",
36588             "amenity/prep_school",
36589             "amenity/school",
36590             "amenity/university"
36591           ],
36592           storage: [
36593             "shop/storage_units",
36594             "shop/storage_rental"
36595           ],
36596           substation: [
36597             "power/station",
36598             "power/substation",
36599             "power/sub_station"
36600           ],
36601           supermarket: [
36602             "shop/food",
36603             "shop/frozen_food",
36604             "shop/greengrocer",
36605             "shop/grocery",
36606             "shop/supermarket",
36607             "shop/wholesale"
36608           ],
36609           thrift: [
36610             "shop/charity",
36611             "shop/clothes",
36612             "shop/second_hand"
36613           ],
36614           tobacco: [
36615             "shop/e-cigarette",
36616             "shop/tobacco"
36617           ],
36618           variety_store: [
36619             "shop/variety_store",
36620             "shop/discount",
36621             "shop/convenience"
36622           ],
36623           vending: [
36624             "amenity/vending_machine",
36625             "shop/kiosk",
36626             "shop/vending_machine"
36627           ],
36628           weight_loss: [
36629             "amenity/clinic",
36630             "amenity/doctors",
36631             "amenity/weight_clinic",
36632             "healthcare/counselling",
36633             "leisure/fitness_centre",
36634             "office/therapist",
36635             "shop/beauty",
36636             "shop/diet",
36637             "shop/food",
36638             "shop/health_food",
36639             "shop/herbalist",
36640             "shop/nutrition",
36641             "shop/nutrition_supplements",
36642             "shop/weight_loss"
36643           ],
36644           wholesale: [
36645             "shop/wholesale",
36646             "shop/supermarket",
36647             "shop/department_store"
36648           ]
36649         }
36650       };
36651     }
36652   });
36653
36654   // node_modules/name-suggestion-index/config/genericWords.json
36655   var genericWords_default;
36656   var init_genericWords = __esm({
36657     "node_modules/name-suggestion-index/config/genericWords.json"() {
36658       genericWords_default = {
36659         genericWords: [
36660           "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
36661           "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
36662           "^(club|green|out|ware)\\s?house$",
36663           "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
36664           "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
36665           "^(hofladen|librairie|magazine?|maison|toko)$",
36666           "^(mobile home|skate)?\\s?park$",
36667           "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
36668           "^\\?+$",
36669           "^private$",
36670           "^tattoo( studio)?$",
36671           "^windmill$",
36672           "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
36673         ]
36674       };
36675     }
36676   });
36677
36678   // node_modules/name-suggestion-index/config/trees.json
36679   var trees_default;
36680   var init_trees = __esm({
36681     "node_modules/name-suggestion-index/config/trees.json"() {
36682       trees_default = {
36683         trees: {
36684           brands: {
36685             emoji: "\u{1F354}",
36686             mainTag: "brand:wikidata",
36687             sourceTags: ["brand", "name"],
36688             nameTags: {
36689               primary: "^(name|name:\\w+)$",
36690               alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
36691             }
36692           },
36693           flags: {
36694             emoji: "\u{1F6A9}",
36695             mainTag: "flag:wikidata",
36696             nameTags: {
36697               primary: "^(flag:name|flag:name:\\w+)$",
36698               alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
36699             }
36700           },
36701           operators: {
36702             emoji: "\u{1F4BC}",
36703             mainTag: "operator:wikidata",
36704             sourceTags: ["operator"],
36705             nameTags: {
36706               primary: "^(name|name:\\w+|operator|operator:\\w+)$",
36707               alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
36708             }
36709           },
36710           transit: {
36711             emoji: "\u{1F687}",
36712             mainTag: "network:wikidata",
36713             sourceTags: ["network"],
36714             nameTags: {
36715               primary: "^network$",
36716               alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
36717             }
36718           }
36719         }
36720       };
36721     }
36722   });
36723
36724   // node_modules/name-suggestion-index/lib/matcher.js
36725   var import_which_polygon3, matchGroups, trees, Matcher;
36726   var init_matcher2 = __esm({
36727     "node_modules/name-suggestion-index/lib/matcher.js"() {
36728       import_which_polygon3 = __toESM(require_which_polygon(), 1);
36729       init_simplify();
36730       init_matchGroups();
36731       init_genericWords();
36732       init_trees();
36733       matchGroups = matchGroups_default.matchGroups;
36734       trees = trees_default.trees;
36735       Matcher = class {
36736         //
36737         // `constructor`
36738         // initialize the genericWords regexes
36739         constructor() {
36740           this.matchIndex = void 0;
36741           this.genericWords = /* @__PURE__ */ new Map();
36742           (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
36743           this.itemLocation = void 0;
36744           this.locationSets = void 0;
36745           this.locationIndex = void 0;
36746           this.warnings = [];
36747         }
36748         //
36749         // `buildMatchIndex()`
36750         // Call this to prepare the matcher for use
36751         //
36752         // `data` needs to be an Object indexed on a 'tree/key/value' path.
36753         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
36754         // {
36755         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
36756         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
36757         //    …
36758         // }
36759         //
36760         buildMatchIndex(data) {
36761           const that = this;
36762           if (that.matchIndex) return;
36763           that.matchIndex = /* @__PURE__ */ new Map();
36764           const seenTree = /* @__PURE__ */ new Map();
36765           Object.keys(data).forEach((tkv) => {
36766             const category = data[tkv];
36767             const parts = tkv.split("/", 3);
36768             const t2 = parts[0];
36769             const k3 = parts[1];
36770             const v3 = parts[2];
36771             const thiskv = `${k3}/${v3}`;
36772             const tree = trees[t2];
36773             let branch = that.matchIndex.get(thiskv);
36774             if (!branch) {
36775               branch = {
36776                 primary: /* @__PURE__ */ new Map(),
36777                 alternate: /* @__PURE__ */ new Map(),
36778                 excludeGeneric: /* @__PURE__ */ new Map(),
36779                 excludeNamed: /* @__PURE__ */ new Map()
36780               };
36781               that.matchIndex.set(thiskv, branch);
36782             }
36783             const properties = category.properties || {};
36784             const exclude = properties.exclude || {};
36785             (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
36786             (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
36787             const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
36788             let items = category.items;
36789             if (!Array.isArray(items) || !items.length) return;
36790             const primaryName = new RegExp(tree.nameTags.primary, "i");
36791             const alternateName = new RegExp(tree.nameTags.alternate, "i");
36792             const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
36793             const skipGenericKV = skipGenericKVMatches(t2, k3, v3);
36794             const genericKV = /* @__PURE__ */ new Set([`${k3}/yes`, `building/yes`]);
36795             const matchGroupKV = /* @__PURE__ */ new Set();
36796             Object.values(matchGroups).forEach((matchGroup) => {
36797               const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
36798               if (!inGroup) return;
36799               matchGroup.forEach((otherkv) => {
36800                 if (otherkv === thiskv) return;
36801                 matchGroupKV.add(otherkv);
36802                 const otherk = otherkv.split("/", 2)[0];
36803                 genericKV.add(`${otherk}/yes`);
36804               });
36805             });
36806             items.forEach((item) => {
36807               if (!item.id) return;
36808               if (Array.isArray(item.matchTags) && item.matchTags.length) {
36809                 item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && matchTag !== thiskv && !genericKV.has(matchTag));
36810                 if (!item.matchTags.length) delete item.matchTags;
36811               }
36812               let kvTags = [`${thiskv}`].concat(item.matchTags || []);
36813               if (!skipGenericKV) {
36814                 kvTags = kvTags.concat(Array.from(genericKV));
36815               }
36816               Object.keys(item.tags).forEach((osmkey) => {
36817                 if (notName.test(osmkey)) return;
36818                 const osmvalue = item.tags[osmkey];
36819                 if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) return;
36820                 if (primaryName.test(osmkey)) {
36821                   kvTags.forEach((kv) => insertName("primary", t2, kv, simplify(osmvalue), item.id));
36822                 } else if (alternateName.test(osmkey)) {
36823                   kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify(osmvalue), item.id));
36824                 }
36825               });
36826               let keepMatchNames = /* @__PURE__ */ new Set();
36827               (item.matchNames || []).forEach((matchName) => {
36828                 const nsimple = simplify(matchName);
36829                 kvTags.forEach((kv) => {
36830                   const branch2 = that.matchIndex.get(kv);
36831                   const primaryLeaf = branch2 && branch2.primary.get(nsimple);
36832                   const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
36833                   const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
36834                   const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
36835                   if (!inPrimary && !inAlternate) {
36836                     insertName("alternate", t2, kv, nsimple, item.id);
36837                     keepMatchNames.add(matchName);
36838                   }
36839                 });
36840               });
36841               if (keepMatchNames.size) {
36842                 item.matchNames = Array.from(keepMatchNames);
36843               } else {
36844                 delete item.matchNames;
36845               }
36846             });
36847           });
36848           function insertName(which, t2, kv, nsimple, itemID) {
36849             if (!nsimple) {
36850               that.warnings.push(`Warning: skipping empty ${which} name for item ${t2}/${kv}: ${itemID}`);
36851               return;
36852             }
36853             let branch = that.matchIndex.get(kv);
36854             if (!branch) {
36855               branch = {
36856                 primary: /* @__PURE__ */ new Map(),
36857                 alternate: /* @__PURE__ */ new Map(),
36858                 excludeGeneric: /* @__PURE__ */ new Map(),
36859                 excludeNamed: /* @__PURE__ */ new Map()
36860               };
36861               that.matchIndex.set(kv, branch);
36862             }
36863             let leaf = branch[which].get(nsimple);
36864             if (!leaf) {
36865               leaf = /* @__PURE__ */ new Set();
36866               branch[which].set(nsimple, leaf);
36867             }
36868             leaf.add(itemID);
36869             if (!/yes$/.test(kv)) {
36870               const kvnsimple = `${kv}/${nsimple}`;
36871               const existing = seenTree.get(kvnsimple);
36872               if (existing && existing !== t2) {
36873                 const items = Array.from(leaf);
36874                 that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t2}" and "${existing}", check items: ${items}`);
36875                 return;
36876               }
36877               seenTree.set(kvnsimple, t2);
36878             }
36879           }
36880           function skipGenericKVMatches(t2, k3, v3) {
36881             return t2 === "flags" || t2 === "transit" || k3 === "landuse" || v3 === "atm" || v3 === "bicycle_parking" || v3 === "car_sharing" || v3 === "caravan_site" || v3 === "charging_station" || v3 === "dog_park" || v3 === "parking" || v3 === "phone" || v3 === "playground" || v3 === "post_box" || v3 === "public_bookcase" || v3 === "recycling" || v3 === "vending_machine";
36882           }
36883         }
36884         //
36885         // `buildLocationIndex()`
36886         // Call this to prepare a which-polygon location index.
36887         // This *resolves* all the locationSets into GeoJSON, which takes some time.
36888         // You can skip this step if you don't care about matching within a location.
36889         //
36890         // `data` needs to be an Object indexed on a 'tree/key/value' path.
36891         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
36892         // {
36893         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
36894         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
36895         //    …
36896         // }
36897         //
36898         buildLocationIndex(data, loco) {
36899           const that = this;
36900           if (that.locationIndex) return;
36901           that.itemLocation = /* @__PURE__ */ new Map();
36902           that.locationSets = /* @__PURE__ */ new Map();
36903           Object.keys(data).forEach((tkv) => {
36904             const items = data[tkv].items;
36905             if (!Array.isArray(items) || !items.length) return;
36906             items.forEach((item) => {
36907               if (that.itemLocation.has(item.id)) return;
36908               let resolved;
36909               try {
36910                 resolved = loco.resolveLocationSet(item.locationSet);
36911               } catch (err) {
36912                 console.warn(`buildLocationIndex: ${err.message}`);
36913               }
36914               if (!resolved || !resolved.id) return;
36915               that.itemLocation.set(item.id, resolved.id);
36916               if (that.locationSets.has(resolved.id)) return;
36917               let feature3 = _cloneDeep2(resolved.feature);
36918               feature3.id = resolved.id;
36919               feature3.properties.id = resolved.id;
36920               if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
36921                 console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
36922                 console.warn(JSON.stringify(feature3));
36923                 return;
36924               }
36925               that.locationSets.set(resolved.id, feature3);
36926             });
36927           });
36928           that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
36929           function _cloneDeep2(obj) {
36930             return JSON.parse(JSON.stringify(obj));
36931           }
36932         }
36933         //
36934         // `match()`
36935         // Pass parts and return an Array of matches.
36936         // `k` - key
36937         // `v` - value
36938         // `n` - namelike
36939         // `loc` - optional - [lon,lat] location to search
36940         //
36941         // 1. If the [k,v,n] tuple matches a canonical item…
36942         // Return an Array of match results.
36943         // Each result will include the area in km² that the item is valid.
36944         //
36945         // Order of results:
36946         // Primary ordering will be on the "match" column:
36947         //   "primary" - where the query matches the `name` tag, followed by
36948         //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
36949         // Secondary ordering will be on the "area" column:
36950         //   "area descending" if no location was provided, (worldwide before local)
36951         //   "area ascending" if location was provided (local before worldwide)
36952         //
36953         // [
36954         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
36955         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
36956         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
36957         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
36958         //   …
36959         // ]
36960         //
36961         // -or-
36962         //
36963         // 2. If the [k,v,n] tuple matches an exclude pattern…
36964         // Return an Array with a single exclude result, either
36965         //
36966         // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
36967         //   or
36968         // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
36969         //
36970         // About results
36971         //   "generic" - a generic word that is probably not really a name.
36972         //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
36973         //   "named" - a real name like "Kebabai" that is just common, but not a brand.
36974         //     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.
36975         //
36976         // -or-
36977         //
36978         // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
36979         //
36980         //
36981         match(k3, v3, n3, loc) {
36982           const that = this;
36983           if (!that.matchIndex) {
36984             throw new Error("match:  matchIndex not built.");
36985           }
36986           let matchLocations;
36987           if (Array.isArray(loc) && that.locationIndex) {
36988             matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
36989           }
36990           const nsimple = simplify(n3);
36991           let seen = /* @__PURE__ */ new Set();
36992           let results = [];
36993           gatherResults("primary");
36994           gatherResults("alternate");
36995           if (results.length) return results;
36996           gatherResults("exclude");
36997           return results.length ? results : null;
36998           function gatherResults(which) {
36999             const kv = `${k3}/${v3}`;
37000             let didMatch = tryMatch(which, kv);
37001             if (didMatch) return;
37002             for (let mg in matchGroups) {
37003               const matchGroup = matchGroups[mg];
37004               const inGroup = matchGroup.some((otherkv) => otherkv === kv);
37005               if (!inGroup) continue;
37006               for (let i3 = 0; i3 < matchGroup.length; i3++) {
37007                 const otherkv = matchGroup[i3];
37008                 if (otherkv === kv) continue;
37009                 didMatch = tryMatch(which, otherkv);
37010                 if (didMatch) return;
37011               }
37012             }
37013             if (which === "exclude") {
37014               const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
37015               if (regex) {
37016                 results.push({ match: "excludeGeneric", pattern: String(regex) });
37017                 return;
37018               }
37019             }
37020           }
37021           function tryMatch(which, kv) {
37022             const branch = that.matchIndex.get(kv);
37023             if (!branch) return;
37024             if (which === "exclude") {
37025               let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
37026               if (regex) {
37027                 results.push({ match: "excludeNamed", pattern: String(regex), kv });
37028                 return;
37029               }
37030               regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
37031               if (regex) {
37032                 results.push({ match: "excludeGeneric", pattern: String(regex), kv });
37033                 return;
37034               }
37035               return;
37036             }
37037             const leaf = branch[which].get(nsimple);
37038             if (!leaf || !leaf.size) return;
37039             let hits = Array.from(leaf).map((itemID) => {
37040               let area = Infinity;
37041               if (that.itemLocation && that.locationSets) {
37042                 const location = that.locationSets.get(that.itemLocation.get(itemID));
37043                 area = location && location.properties.area || Infinity;
37044               }
37045               return { match: which, itemID, area, kv, nsimple };
37046             });
37047             let sortFn = byAreaDescending;
37048             if (matchLocations) {
37049               hits = hits.filter(isValidLocation);
37050               sortFn = byAreaAscending;
37051             }
37052             if (!hits.length) return;
37053             hits.sort(sortFn).forEach((hit) => {
37054               if (seen.has(hit.itemID)) return;
37055               seen.add(hit.itemID);
37056               results.push(hit);
37057             });
37058             return true;
37059             function isValidLocation(hit) {
37060               if (!that.itemLocation) return true;
37061               return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
37062             }
37063             function byAreaAscending(hitA, hitB) {
37064               return hitA.area - hitB.area;
37065             }
37066             function byAreaDescending(hitA, hitB) {
37067               return hitB.area - hitA.area;
37068             }
37069           }
37070         }
37071         //
37072         // `getWarnings()`
37073         // Return any warnings discovered when buiding the index.
37074         // (currently this does nothing)
37075         //
37076         getWarnings() {
37077           return this.warnings;
37078         }
37079       };
37080     }
37081   });
37082
37083   // node_modules/name-suggestion-index/lib/stemmer.js
37084   var init_stemmer = __esm({
37085     "node_modules/name-suggestion-index/lib/stemmer.js"() {
37086       init_simplify();
37087     }
37088   });
37089
37090   // node_modules/name-suggestion-index/index.mjs
37091   var init_name_suggestion_index = __esm({
37092     "node_modules/name-suggestion-index/index.mjs"() {
37093       init_matcher2();
37094       init_simplify();
37095       init_stemmer();
37096     }
37097   });
37098
37099   // modules/services/nsi.js
37100   var nsi_exports = {};
37101   __export(nsi_exports, {
37102     default: () => nsi_default
37103   });
37104   function setNsiSources() {
37105     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
37106     const v3 = (0, import_vparse.default)(nsiVersion);
37107     const vMinor = `${v3.major}.${v3.minor}`;
37108     const cdn = nsiCdnUrl.replace("{version}", vMinor);
37109     const sources = {
37110       "nsi_data": cdn + "dist/nsi.min.json",
37111       "nsi_dissolved": cdn + "dist/dissolved.min.json",
37112       "nsi_features": cdn + "dist/featureCollection.min.json",
37113       "nsi_generics": cdn + "dist/genericWords.min.json",
37114       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
37115       "nsi_replacements": cdn + "dist/replacements.min.json",
37116       "nsi_trees": cdn + "dist/trees.min.json"
37117     };
37118     let fileMap = _mainFileFetcher.fileMap();
37119     for (const k3 in sources) {
37120       if (!fileMap[k3]) fileMap[k3] = sources[k3];
37121     }
37122   }
37123   function loadNsiPresets() {
37124     return Promise.all([
37125       _mainFileFetcher.get("nsi_presets"),
37126       _mainFileFetcher.get("nsi_features")
37127     ]).then((vals) => {
37128       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
37129       Object.values(vals[0].presets).forEach((preset) => {
37130         if (preset.tags["brand:wikidata"]) {
37131           preset.removeTags = { "brand:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
37132         }
37133         if (preset.tags["operator:wikidata"]) {
37134           preset.removeTags = { "operator:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
37135         }
37136         if (preset.tags["network:wikidata"]) {
37137           preset.removeTags = { "network:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
37138         }
37139       });
37140       _mainPresetIndex.merge({
37141         presets: vals[0].presets,
37142         featureCollection: vals[1]
37143       });
37144     });
37145   }
37146   function loadNsiData() {
37147     return Promise.all([
37148       _mainFileFetcher.get("nsi_data"),
37149       _mainFileFetcher.get("nsi_dissolved"),
37150       _mainFileFetcher.get("nsi_replacements"),
37151       _mainFileFetcher.get("nsi_trees")
37152     ]).then((vals) => {
37153       _nsi = {
37154         data: vals[0].nsi,
37155         // the raw name-suggestion-index data
37156         dissolved: vals[1].dissolved,
37157         // list of dissolved items
37158         replacements: vals[2].replacements,
37159         // trivial old->new qid replacements
37160         trees: vals[3].trees,
37161         // metadata about trees, main tags
37162         kvt: /* @__PURE__ */ new Map(),
37163         // Map (k -> Map (v -> t) )
37164         qids: /* @__PURE__ */ new Map(),
37165         // Map (wd/wp tag values -> qids)
37166         ids: /* @__PURE__ */ new Map()
37167         // Map (id -> NSI item)
37168       };
37169       const matcher = _nsi.matcher = new Matcher();
37170       matcher.buildMatchIndex(_nsi.data);
37171       matcher.itemLocation = /* @__PURE__ */ new Map();
37172       matcher.locationSets = /* @__PURE__ */ new Map();
37173       Object.keys(_nsi.data).forEach((tkv) => {
37174         const items = _nsi.data[tkv].items;
37175         if (!Array.isArray(items) || !items.length) return;
37176         items.forEach((item) => {
37177           if (matcher.itemLocation.has(item.id)) return;
37178           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
37179           matcher.itemLocation.set(item.id, locationSetID);
37180           if (matcher.locationSets.has(locationSetID)) return;
37181           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
37182           matcher.locationSets.set(locationSetID, fakeFeature);
37183         });
37184       });
37185       matcher.locationIndex = (bbox2) => {
37186         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
37187         const results = [];
37188         for (const [locationSetID, area] of Object.entries(validHere)) {
37189           const fakeFeature = matcher.locationSets.get(locationSetID);
37190           if (fakeFeature) {
37191             fakeFeature.properties.area = area;
37192             results.push(fakeFeature);
37193           }
37194         }
37195         return results;
37196       };
37197       Object.keys(_nsi.data).forEach((tkv) => {
37198         const category = _nsi.data[tkv];
37199         const parts = tkv.split("/", 3);
37200         const t2 = parts[0];
37201         const k3 = parts[1];
37202         const v3 = parts[2];
37203         let vmap = _nsi.kvt.get(k3);
37204         if (!vmap) {
37205           vmap = /* @__PURE__ */ new Map();
37206           _nsi.kvt.set(k3, vmap);
37207         }
37208         vmap.set(v3, t2);
37209         const tree = _nsi.trees[t2];
37210         const mainTag = tree.mainTag;
37211         const items = category.items || [];
37212         items.forEach((item) => {
37213           item.tkv = tkv;
37214           item.mainTag = mainTag;
37215           _nsi.ids.set(item.id, item);
37216           const wd = item.tags[mainTag];
37217           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
37218           if (wd) _nsi.qids.set(wd, wd);
37219           if (wp && wd) _nsi.qids.set(wp, wd);
37220         });
37221       });
37222     });
37223   }
37224   function gatherKVs(tags) {
37225     let primary = /* @__PURE__ */ new Set();
37226     let alternate = /* @__PURE__ */ new Set();
37227     Object.keys(tags).forEach((osmkey) => {
37228       const osmvalue = tags[osmkey];
37229       if (!osmvalue) return;
37230       if (osmkey === "route_master") osmkey = "route";
37231       const vmap = _nsi.kvt.get(osmkey);
37232       if (!vmap) return;
37233       if (vmap.get(osmvalue)) {
37234         primary.add(`${osmkey}/${osmvalue}`);
37235       } else if (osmvalue === "yes") {
37236         alternate.add(`${osmkey}/${osmvalue}`);
37237       }
37238     });
37239     const preset = _mainPresetIndex.matchTags(tags, "area");
37240     if (buildingPreset[preset.id]) {
37241       alternate.add("building/yes");
37242     }
37243     return { primary, alternate };
37244   }
37245   function identifyTree(tags) {
37246     let unknown;
37247     let t2;
37248     Object.keys(tags).forEach((osmkey) => {
37249       if (t2) return;
37250       const osmvalue = tags[osmkey];
37251       if (!osmvalue) return;
37252       if (osmkey === "route_master") osmkey = "route";
37253       const vmap = _nsi.kvt.get(osmkey);
37254       if (!vmap) return;
37255       if (osmvalue === "yes") {
37256         unknown = "unknown";
37257       } else {
37258         t2 = vmap.get(osmvalue);
37259       }
37260     });
37261     return t2 || unknown || null;
37262   }
37263   function gatherNames(tags) {
37264     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
37265     let primary = /* @__PURE__ */ new Set();
37266     let alternate = /* @__PURE__ */ new Set();
37267     let foundSemi = false;
37268     let testNameFragments = false;
37269     let patterns2;
37270     let t2 = identifyTree(tags);
37271     if (!t2) return empty2;
37272     if (t2 === "transit") {
37273       patterns2 = {
37274         primary: /^network$/i,
37275         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
37276       };
37277     } else if (t2 === "flags") {
37278       patterns2 = {
37279         primary: /^(flag:name|flag:name:\w+)$/i,
37280         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
37281         // note: no `country`, we special-case it below
37282       };
37283     } else if (t2 === "brands") {
37284       testNameFragments = true;
37285       patterns2 = {
37286         primary: /^(name|name:\w+)$/i,
37287         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
37288       };
37289     } else if (t2 === "operators") {
37290       testNameFragments = true;
37291       patterns2 = {
37292         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
37293         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
37294       };
37295     } else {
37296       testNameFragments = true;
37297       patterns2 = {
37298         primary: /^(name|name:\w+)$/i,
37299         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
37300       };
37301     }
37302     if (tags.name && testNameFragments) {
37303       const nameParts = tags.name.split(/[\s\-\/,.]/);
37304       for (let split = nameParts.length; split > 0; split--) {
37305         const name = nameParts.slice(0, split).join(" ");
37306         primary.add(name);
37307       }
37308     }
37309     Object.keys(tags).forEach((osmkey) => {
37310       const osmvalue = tags[osmkey];
37311       if (!osmvalue) return;
37312       if (isNamelike(osmkey, "primary")) {
37313         if (/;/.test(osmvalue)) {
37314           foundSemi = true;
37315         } else {
37316           primary.add(osmvalue);
37317           alternate.delete(osmvalue);
37318         }
37319       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
37320         if (/;/.test(osmvalue)) {
37321           foundSemi = true;
37322         } else {
37323           alternate.add(osmvalue);
37324         }
37325       }
37326     });
37327     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
37328       const osmvalue = tags.country;
37329       if (/;/.test(osmvalue)) {
37330         foundSemi = true;
37331       } else {
37332         alternate.add(osmvalue);
37333       }
37334     }
37335     if (foundSemi) {
37336       return empty2;
37337     } else {
37338       return { primary, alternate };
37339     }
37340     function isNamelike(osmkey, which) {
37341       if (osmkey === "old_name") return false;
37342       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
37343     }
37344   }
37345   function gatherTuples(tryKVs, tryNames) {
37346     let tuples = [];
37347     ["primary", "alternate"].forEach((whichName) => {
37348       const arr = Array.from(tryNames[whichName]).sort((a4, b3) => b3.length - a4.length);
37349       arr.forEach((n3) => {
37350         ["primary", "alternate"].forEach((whichKV) => {
37351           tryKVs[whichKV].forEach((kv) => {
37352             const parts = kv.split("/", 2);
37353             const k3 = parts[0];
37354             const v3 = parts[1];
37355             tuples.push({ k: k3, v: v3, n: n3 });
37356           });
37357         });
37358       });
37359     });
37360     return tuples;
37361   }
37362   function _upgradeTags(tags, loc) {
37363     let newTags = Object.assign({}, tags);
37364     let changed = false;
37365     Object.keys(newTags).forEach((osmkey) => {
37366       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
37367       if (matchTag) {
37368         const prefix = matchTag[1] || "";
37369         const wd = newTags[osmkey];
37370         const replace = _nsi.replacements[wd];
37371         if (replace && replace.wikidata !== void 0) {
37372           changed = true;
37373           if (replace.wikidata) {
37374             newTags[osmkey] = replace.wikidata;
37375           } else {
37376             delete newTags[osmkey];
37377           }
37378         }
37379         if (replace && replace.wikipedia !== void 0) {
37380           changed = true;
37381           const wpkey = `${prefix}wikipedia`;
37382           if (replace.wikipedia) {
37383             newTags[wpkey] = replace.wikipedia;
37384           } else {
37385             delete newTags[wpkey];
37386           }
37387         }
37388       }
37389     });
37390     const isRouteMaster = tags.type === "route_master";
37391     const tryKVs = gatherKVs(tags);
37392     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
37393       return changed ? { newTags, matched: null } : null;
37394     }
37395     const tryNames = gatherNames(tags);
37396     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
37397     if (foundQID) tryNames.primary.add(foundQID);
37398     if (!tryNames.primary.size && !tryNames.alternate.size) {
37399       return changed ? { newTags, matched: null } : null;
37400     }
37401     const tuples = gatherTuples(tryKVs, tryNames);
37402     for (let i3 = 0; i3 < tuples.length; i3++) {
37403       const tuple = tuples[i3];
37404       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
37405       if (!hits || !hits.length) continue;
37406       if (hits[0].match !== "primary" && hits[0].match !== "alternate") break;
37407       let itemID, item;
37408       for (let j3 = 0; j3 < hits.length; j3++) {
37409         const hit = hits[j3];
37410         itemID = hit.itemID;
37411         if (_nsi.dissolved[itemID]) continue;
37412         item = _nsi.ids.get(itemID);
37413         if (!item) continue;
37414         const mainTag = item.mainTag;
37415         const itemQID = item.tags[mainTag];
37416         const notQID = newTags[`not:${mainTag}`];
37417         if (
37418           // Exceptions, skip this hit
37419           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
37420           newTags.office && !item.tags.office
37421         ) {
37422           item = null;
37423           continue;
37424         } else {
37425           break;
37426         }
37427       }
37428       if (!item) continue;
37429       item = JSON.parse(JSON.stringify(item));
37430       const tkv = item.tkv;
37431       const parts = tkv.split("/", 3);
37432       const k3 = parts[1];
37433       const v3 = parts[2];
37434       const category = _nsi.data[tkv];
37435       const properties = category.properties || {};
37436       let preserveTags = item.preserveTags || properties.preserveTags || [];
37437       ["building", "emergency", "internet_access", "opening_hours", "takeaway"].forEach((osmkey) => {
37438         if (k3 !== osmkey) preserveTags.push(`^${osmkey}$`);
37439       });
37440       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
37441       let keepTags = {};
37442       Object.keys(newTags).forEach((osmkey) => {
37443         if (regexes.some((regex) => regex.test(osmkey))) {
37444           keepTags[osmkey] = newTags[osmkey];
37445         }
37446       });
37447       _nsi.kvt.forEach((vmap, k4) => {
37448         if (newTags[k4] === "yes") delete newTags[k4];
37449       });
37450       if (foundQID) {
37451         delete newTags.wikipedia;
37452         delete newTags.wikidata;
37453       }
37454       Object.assign(newTags, item.tags, keepTags);
37455       if (isRouteMaster) {
37456         newTags.route_master = newTags.route;
37457         delete newTags.route;
37458       }
37459       const origName = tags.name;
37460       const newName = newTags.name;
37461       if (newName && origName && newName !== origName && !newTags.branch) {
37462         const newNames = gatherNames(newTags);
37463         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
37464         const isMoved = newSet.has(origName);
37465         if (!isMoved) {
37466           const nameParts = origName.split(/[\s\-\/,.]/);
37467           for (let split = nameParts.length; split > 0; split--) {
37468             const name = nameParts.slice(0, split).join(" ");
37469             const branch = nameParts.slice(split).join(" ");
37470             const nameHits = _nsi.matcher.match(k3, v3, name, loc);
37471             if (!nameHits || !nameHits.length) continue;
37472             if (nameHits.some((hit) => hit.itemID === itemID)) {
37473               if (branch) {
37474                 if (notBranches.test(branch)) {
37475                   newTags.name = origName;
37476                 } else {
37477                   const branchHits = _nsi.matcher.match(k3, v3, branch, loc);
37478                   if (branchHits && branchHits.length) {
37479                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
37480                       return null;
37481                     }
37482                   } else {
37483                     newTags.branch = branch;
37484                   }
37485                 }
37486               }
37487               break;
37488             }
37489           }
37490         }
37491       }
37492       return { newTags, matched: item };
37493     }
37494     return changed ? { newTags, matched: null } : null;
37495   }
37496   function _isGenericName(tags) {
37497     const n3 = tags.name;
37498     if (!n3) return false;
37499     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
37500     const tryKVs = gatherKVs(tags);
37501     if (!tryKVs.primary.size && !tryKVs.alternate.size) return false;
37502     const tuples = gatherTuples(tryKVs, tryNames);
37503     for (let i3 = 0; i3 < tuples.length; i3++) {
37504       const tuple = tuples[i3];
37505       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
37506       if (hits && hits.length && hits[0].match === "excludeGeneric") return true;
37507     }
37508     return false;
37509   }
37510   var import_vparse, _nsiStatus, _nsi, buildingPreset, notNames, notBranches, nsi_default;
37511   var init_nsi = __esm({
37512     "modules/services/nsi.js"() {
37513       "use strict";
37514       init_name_suggestion_index();
37515       import_vparse = __toESM(require_vparse());
37516       init_core();
37517       init_presets();
37518       init_id();
37519       init_package();
37520       _nsiStatus = "loading";
37521       _nsi = {};
37522       buildingPreset = {
37523         "building/commercial": true,
37524         "building/government": true,
37525         "building/hotel": true,
37526         "building/retail": true,
37527         "building/office": true,
37528         "building/supermarket": true,
37529         "building/yes": true
37530       };
37531       notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
37532       notBranches = /(coop|express|wireless|factory|outlet)/i;
37533       nsi_default = {
37534         // `init()`
37535         // On init, start preparing the name-suggestion-index
37536         //
37537         init: () => {
37538           setNsiSources();
37539           _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
37540         },
37541         // `reset()`
37542         // Reset is called when user saves data to OSM (does nothing here)
37543         //
37544         reset: () => {
37545         },
37546         // `status()`
37547         // To let other code know how it's going...
37548         //
37549         // Returns
37550         //   `String`: 'loading', 'ok', 'failed'
37551         //
37552         status: () => _nsiStatus,
37553         // `isGenericName()`
37554         // Is the `name` tag generic?
37555         //
37556         // Arguments
37557         //   `tags`: `Object` containing the feature's OSM tags
37558         // Returns
37559         //   `true` if it is generic, `false` if not
37560         //
37561         isGenericName: (tags) => _isGenericName(tags),
37562         // `upgradeTags()`
37563         // Suggest tag upgrades.
37564         // This function will not modify the input tags, it makes a copy.
37565         //
37566         // Arguments
37567         //   `tags`: `Object` containing the feature's OSM tags
37568         //   `loc`: Location where this feature exists, as a [lon, lat]
37569         // Returns
37570         //   `Object` containing the result, or `null` if no changes needed:
37571         //   {
37572         //     'newTags': `Object` - The tags the the feature should have
37573         //     'matched': `Object` - The matched item
37574         //   }
37575         //
37576         upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
37577         // `cache()`
37578         // Direct access to the NSI cache, useful for testing or breaking things
37579         //
37580         // Returns
37581         //   `Object`: the internal NSI cache
37582         //
37583         cache: () => _nsi
37584       };
37585     }
37586   });
37587
37588   // modules/services/kartaview.js
37589   var kartaview_exports = {};
37590   __export(kartaview_exports, {
37591     default: () => kartaview_default
37592   });
37593   function abortRequest3(controller) {
37594     controller.abort();
37595   }
37596   function maxPageAtZoom(z3) {
37597     if (z3 < 15) return 2;
37598     if (z3 === 15) return 5;
37599     if (z3 === 16) return 10;
37600     if (z3 === 17) return 20;
37601     if (z3 === 18) return 40;
37602     if (z3 > 18) return 80;
37603   }
37604   function loadTiles2(which, url, projection2) {
37605     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
37606     var tiles = tiler3.getTiles(projection2);
37607     var cache = _oscCache[which];
37608     Object.keys(cache.inflight).forEach(function(k3) {
37609       var wanted = tiles.find(function(tile) {
37610         return k3.indexOf(tile.id + ",") === 0;
37611       });
37612       if (!wanted) {
37613         abortRequest3(cache.inflight[k3]);
37614         delete cache.inflight[k3];
37615       }
37616     });
37617     tiles.forEach(function(tile) {
37618       loadNextTilePage(which, currZoom, url, tile);
37619     });
37620   }
37621   function loadNextTilePage(which, currZoom, url, tile) {
37622     var cache = _oscCache[which];
37623     var bbox2 = tile.extent.bbox();
37624     var maxPages = maxPageAtZoom(currZoom);
37625     var nextPage = cache.nextPage[tile.id] || 1;
37626     var params = utilQsString({
37627       ipp: maxResults,
37628       page: nextPage,
37629       // client_id: clientId,
37630       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
37631       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
37632     }, true);
37633     if (nextPage > maxPages) return;
37634     var id2 = tile.id + "," + String(nextPage);
37635     if (cache.loaded[id2] || cache.inflight[id2]) return;
37636     var controller = new AbortController();
37637     cache.inflight[id2] = controller;
37638     var options = {
37639       method: "POST",
37640       signal: controller.signal,
37641       body: params,
37642       headers: { "Content-Type": "application/x-www-form-urlencoded" }
37643     };
37644     json_default(url, options).then(function(data) {
37645       cache.loaded[id2] = true;
37646       delete cache.inflight[id2];
37647       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
37648         throw new Error("No Data");
37649       }
37650       var features = data.currentPageItems.map(function(item) {
37651         var loc = [+item.lng, +item.lat];
37652         var d2;
37653         if (which === "images") {
37654           d2 = {
37655             service: "photo",
37656             loc,
37657             key: item.id,
37658             ca: +item.heading,
37659             captured_at: item.shot_date || item.date_added,
37660             captured_by: item.username,
37661             imagePath: item.name,
37662             sequence_id: item.sequence_id,
37663             sequence_index: +item.sequence_index
37664           };
37665           var seq = _oscCache.sequences[d2.sequence_id];
37666           if (!seq) {
37667             seq = { rotation: 0, images: [] };
37668             _oscCache.sequences[d2.sequence_id] = seq;
37669           }
37670           seq.images[d2.sequence_index] = d2;
37671           _oscCache.images.forImageKey[d2.key] = d2;
37672         }
37673         return {
37674           minX: loc[0],
37675           minY: loc[1],
37676           maxX: loc[0],
37677           maxY: loc[1],
37678           data: d2
37679         };
37680       });
37681       cache.rtree.load(features);
37682       if (data.currentPageItems.length === maxResults) {
37683         cache.nextPage[tile.id] = nextPage + 1;
37684         loadNextTilePage(which, currZoom, url, tile);
37685       } else {
37686         cache.nextPage[tile.id] = Infinity;
37687       }
37688       if (which === "images") {
37689         dispatch5.call("loadedImages");
37690       }
37691     }).catch(function() {
37692       cache.loaded[id2] = true;
37693       delete cache.inflight[id2];
37694     });
37695   }
37696   function partitionViewport2(projection2) {
37697     var z3 = geoScaleToZoom(projection2.scale());
37698     var z22 = Math.ceil(z3 * 2) / 2 + 2.5;
37699     var tiler8 = utilTiler().zoomExtent([z22, z22]);
37700     return tiler8.getTiles(projection2).map(function(tile) {
37701       return tile.extent;
37702     });
37703   }
37704   function searchLimited2(limit, projection2, rtree) {
37705     limit = limit || 5;
37706     return partitionViewport2(projection2).reduce(function(result, extent) {
37707       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
37708         return d2.data;
37709       });
37710       return found.length ? result.concat(found) : result;
37711     }, []);
37712   }
37713   var apibase2, maxResults, tileZoom, tiler3, dispatch5, imgZoom, _oscCache, _oscSelectedImage, _loadViewerPromise2, kartaview_default;
37714   var init_kartaview = __esm({
37715     "modules/services/kartaview.js"() {
37716       "use strict";
37717       init_src4();
37718       init_src18();
37719       init_src12();
37720       init_rbush();
37721       init_localizer();
37722       init_geo2();
37723       init_util();
37724       init_services();
37725       apibase2 = "https://kartaview.org";
37726       maxResults = 1e3;
37727       tileZoom = 14;
37728       tiler3 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
37729       dispatch5 = dispatch_default("loadedImages");
37730       imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
37731       kartaview_default = {
37732         init: function() {
37733           if (!_oscCache) {
37734             this.reset();
37735           }
37736           this.event = utilRebind(this, dispatch5, "on");
37737         },
37738         reset: function() {
37739           if (_oscCache) {
37740             Object.values(_oscCache.images.inflight).forEach(abortRequest3);
37741           }
37742           _oscCache = {
37743             images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), forImageKey: {} },
37744             sequences: {}
37745           };
37746         },
37747         images: function(projection2) {
37748           var limit = 5;
37749           return searchLimited2(limit, projection2, _oscCache.images.rtree);
37750         },
37751         sequences: function(projection2) {
37752           var viewport = projection2.clipExtent();
37753           var min3 = [viewport[0][0], viewport[1][1]];
37754           var max3 = [viewport[1][0], viewport[0][1]];
37755           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37756           var sequenceKeys = {};
37757           _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
37758             sequenceKeys[d2.data.sequence_id] = true;
37759           });
37760           var lineStrings = [];
37761           Object.keys(sequenceKeys).forEach(function(sequenceKey) {
37762             var seq = _oscCache.sequences[sequenceKey];
37763             var images = seq && seq.images;
37764             if (images) {
37765               lineStrings.push({
37766                 type: "LineString",
37767                 coordinates: images.map(function(d2) {
37768                   return d2.loc;
37769                 }).filter(Boolean),
37770                 properties: {
37771                   captured_at: images[0] ? images[0].captured_at : null,
37772                   captured_by: images[0] ? images[0].captured_by : null,
37773                   key: sequenceKey
37774                 }
37775               });
37776             }
37777           });
37778           return lineStrings;
37779         },
37780         cachedImage: function(imageKey) {
37781           return _oscCache.images.forImageKey[imageKey];
37782         },
37783         loadImages: function(projection2) {
37784           var url = apibase2 + "/1.0/list/nearby-photos/";
37785           loadTiles2("images", url, projection2);
37786         },
37787         ensureViewerLoaded: function(context) {
37788           if (_loadViewerPromise2) return _loadViewerPromise2;
37789           var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
37790           var that = this;
37791           var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan2)).on("dblclick.zoom", null);
37792           wrapEnter.append("div").attr("class", "photo-attribution fillD");
37793           var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
37794           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
37795           controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
37796           controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
37797           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
37798           wrapEnter.append("div").attr("class", "kartaview-image-wrap");
37799           context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
37800             imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
37801           });
37802           function zoomPan2(d3_event) {
37803             var t2 = d3_event.transform;
37804             context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
37805           }
37806           function rotate(deg) {
37807             return function() {
37808               if (!_oscSelectedImage) return;
37809               var sequenceKey = _oscSelectedImage.sequence_id;
37810               var sequence = _oscCache.sequences[sequenceKey];
37811               if (!sequence) return;
37812               var r2 = sequence.rotation || 0;
37813               r2 += deg;
37814               if (r2 > 180) r2 -= 360;
37815               if (r2 < -180) r2 += 360;
37816               sequence.rotation = r2;
37817               var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
37818               wrap3.transition().duration(100).call(imgZoom.transform, identity2);
37819               wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
37820             };
37821           }
37822           function step(stepBy) {
37823             return function() {
37824               if (!_oscSelectedImage) return;
37825               var sequenceKey = _oscSelectedImage.sequence_id;
37826               var sequence = _oscCache.sequences[sequenceKey];
37827               if (!sequence) return;
37828               var nextIndex = _oscSelectedImage.sequence_index + stepBy;
37829               var nextImage = sequence.images[nextIndex];
37830               if (!nextImage) return;
37831               context.map().centerEase(nextImage.loc);
37832               that.selectImage(context, nextImage.key);
37833             };
37834           }
37835           _loadViewerPromise2 = Promise.resolve();
37836           return _loadViewerPromise2;
37837         },
37838         showViewer: function(context) {
37839           const wrap2 = context.container().select(".photoviewer");
37840           const isHidden = wrap2.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
37841           if (isHidden) {
37842             for (const service of Object.values(services)) {
37843               if (service === this) continue;
37844               if (typeof service.hideViewer === "function") {
37845                 service.hideViewer(context);
37846               }
37847             }
37848             wrap2.classed("hide", false).selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
37849           }
37850           return this;
37851         },
37852         hideViewer: function(context) {
37853           _oscSelectedImage = null;
37854           this.updateUrlImage(null);
37855           var viewer = context.container().select(".photoviewer");
37856           if (!viewer.empty()) viewer.datum(null);
37857           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
37858           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
37859           return this.setStyles(context, null, true);
37860         },
37861         selectImage: function(context, imageKey) {
37862           var d2 = this.cachedImage(imageKey);
37863           _oscSelectedImage = d2;
37864           this.updateUrlImage(imageKey);
37865           var viewer = context.container().select(".photoviewer");
37866           if (!viewer.empty()) viewer.datum(d2);
37867           this.setStyles(context, null, true);
37868           context.container().selectAll(".icon-sign").classed("currentView", false);
37869           if (!d2) return this;
37870           var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
37871           var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
37872           var attribution = wrap2.selectAll(".photo-attribution").text("");
37873           wrap2.transition().duration(100).call(imgZoom.transform, identity2);
37874           imageWrap.selectAll(".kartaview-image").remove();
37875           if (d2) {
37876             var sequence = _oscCache.sequences[d2.sequence_id];
37877             var r2 = sequence && sequence.rotation || 0;
37878             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)");
37879             if (d2.captured_by) {
37880               attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
37881               attribution.append("span").text("|");
37882             }
37883             if (d2.captured_at) {
37884               attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
37885               attribution.append("span").text("|");
37886             }
37887             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");
37888           }
37889           return this;
37890           function localeDateString2(s2) {
37891             if (!s2) return null;
37892             var options = { day: "numeric", month: "short", year: "numeric" };
37893             var d4 = new Date(s2);
37894             if (isNaN(d4.getTime())) return null;
37895             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options);
37896           }
37897         },
37898         getSelectedImage: function() {
37899           return _oscSelectedImage;
37900         },
37901         getSequenceKeyForImage: function(d2) {
37902           return d2 && d2.sequence_id;
37903         },
37904         // Updates the currently highlighted sequence and selected bubble.
37905         // Reset is only necessary when interacting with the viewport because
37906         // this implicitly changes the currently selected bubble/sequence
37907         setStyles: function(context, hovered, reset) {
37908           if (reset) {
37909             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
37910             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
37911           }
37912           var hoveredImageId = hovered && hovered.key;
37913           var hoveredSequenceId = this.getSequenceKeyForImage(hovered);
37914           var viewer = context.container().select(".photoviewer");
37915           var selected = viewer.empty() ? void 0 : viewer.datum();
37916           var selectedImageId = selected && selected.key;
37917           var selectedSequenceId = this.getSequenceKeyForImage(selected);
37918           context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
37919             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
37920           }).classed("hovered", function(d2) {
37921             return d2.key === hoveredImageId;
37922           }).classed("currentView", function(d2) {
37923             return d2.key === selectedImageId;
37924           });
37925           context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
37926             return d2.properties.key === hoveredSequenceId;
37927           }).classed("currentView", function(d2) {
37928             return d2.properties.key === selectedSequenceId;
37929           });
37930           context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
37931           function viewfieldPath() {
37932             var d2 = this.parentNode.__data__;
37933             if (d2.pano && d2.key !== selectedImageId) {
37934               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
37935             } else {
37936               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
37937             }
37938           }
37939           return this;
37940         },
37941         updateUrlImage: function(imageKey) {
37942           const hash2 = utilStringQs(window.location.hash);
37943           if (imageKey) {
37944             hash2.photo = "kartaview/" + imageKey;
37945           } else {
37946             delete hash2.photo;
37947           }
37948           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
37949         },
37950         cache: function() {
37951           return _oscCache;
37952         }
37953       };
37954     }
37955   });
37956
37957   // modules/services/pannellum_photo.js
37958   var pannellum_photo_exports = {};
37959   __export(pannellum_photo_exports, {
37960     default: () => pannellum_photo_default
37961   });
37962   var pannellumViewerCSS, pannellumViewerJS, dispatch6, _currScenes, _pannellumViewer, _activeSceneKey, pannellum_photo_default;
37963   var init_pannellum_photo = __esm({
37964     "modules/services/pannellum_photo.js"() {
37965       "use strict";
37966       init_src5();
37967       init_src4();
37968       init_util();
37969       pannellumViewerCSS = "pannellum/pannellum.css";
37970       pannellumViewerJS = "pannellum/pannellum.js";
37971       dispatch6 = dispatch_default("viewerChanged");
37972       _currScenes = [];
37973       pannellum_photo_default = {
37974         init: async function(context, selection2) {
37975           selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true).on("mousedown", function(e3) {
37976             e3.stopPropagation();
37977           });
37978           if (!window.pannellum) {
37979             await this.loadPannellum(context);
37980           }
37981           const options = {
37982             "default": { firstScene: "" },
37983             scenes: {},
37984             minHfov: 20,
37985             disableKeyboardCtrl: true,
37986             sceneFadeDuration: 0
37987           };
37988           _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options);
37989           _pannellumViewer.on("mousedown", () => {
37990             select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
37991               dispatch6.call("viewerChanged");
37992             });
37993           }).on("mouseup", () => {
37994             select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
37995           }).on("animatefinished", () => {
37996             dispatch6.call("viewerChanged");
37997           });
37998           context.ui().photoviewer.on("resize.pannellum", () => {
37999             _pannellumViewer.resize();
38000           });
38001           this.event = utilRebind(this, dispatch6, "on");
38002           return this;
38003         },
38004         loadPannellum: function(context) {
38005           const head = select_default2("head");
38006           return Promise.all([
38007             new Promise((resolve, reject) => {
38008               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);
38009             }),
38010             new Promise((resolve, reject) => {
38011               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);
38012             })
38013           ]);
38014         },
38015         /**
38016          * Shows the photo frame if hidden
38017          * @param {*} context the HTML wrap of the frame
38018          */
38019         showPhotoFrame: function(context) {
38020           const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
38021           if (isHidden) {
38022             context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
38023             context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
38024           }
38025           return this;
38026         },
38027         /**
38028          * Hides the photo frame if shown
38029          * @param {*} context the HTML wrap of the frame
38030          */
38031         hidePhotoFrame: function(viewerContext) {
38032           viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
38033           return this;
38034         },
38035         /**
38036          * Renders an image inside the frame
38037          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
38038          * @param {boolean} keepOrientation if true, HFOV, pitch and yaw will be kept between images
38039          */
38040         selectPhoto: function(data, keepOrientation) {
38041           const key = _activeSceneKey = data.image_path;
38042           if (!_currScenes.includes(key)) {
38043             let newSceneOptions = {
38044               showFullscreenCtrl: false,
38045               autoLoad: false,
38046               compass: false,
38047               yaw: 0,
38048               type: "equirectangular",
38049               preview: data.preview_path,
38050               panorama: data.image_path,
38051               northOffset: data.ca
38052             };
38053             _currScenes.push(key);
38054             _pannellumViewer.addScene(key, newSceneOptions);
38055           }
38056           let yaw = 0;
38057           let pitch = 0;
38058           let hfov = 0;
38059           if (keepOrientation) {
38060             yaw = this.getYaw();
38061             pitch = this.getPitch();
38062             hfov = this.getHfov();
38063           }
38064           if (_pannellumViewer.isLoaded() !== false) {
38065             _pannellumViewer.loadScene(key, pitch, yaw, hfov);
38066             dispatch6.call("viewerChanged");
38067           } else {
38068             const retry = setInterval(() => {
38069               if (_pannellumViewer.isLoaded() === false) {
38070                 return;
38071               }
38072               if (_activeSceneKey === key) {
38073                 _pannellumViewer.loadScene(key, pitch, yaw, hfov);
38074                 dispatch6.call("viewerChanged");
38075               }
38076               clearInterval(retry);
38077             }, 100);
38078           }
38079           if (_currScenes.length > 3) {
38080             const old_key = _currScenes.shift();
38081             _pannellumViewer.removeScene(old_key);
38082           }
38083           _pannellumViewer.resize();
38084           return this;
38085         },
38086         getYaw: function() {
38087           return _pannellumViewer.getYaw();
38088         },
38089         getPitch: function() {
38090           return _pannellumViewer.getPitch();
38091         },
38092         getHfov: function() {
38093           return _pannellumViewer.getHfov();
38094         }
38095       };
38096     }
38097   });
38098
38099   // modules/services/plane_photo.js
38100   var plane_photo_exports = {};
38101   __export(plane_photo_exports, {
38102     default: () => plane_photo_default
38103   });
38104   function zoomPan(d3_event) {
38105     let t2 = d3_event.transform;
38106     _imageWrapper.call(utilSetTransform, t2.x, t2.y, t2.k);
38107   }
38108   function loadImage(selection2, path) {
38109     return new Promise((resolve) => {
38110       selection2.attr("src", path);
38111       selection2.on("load", () => {
38112         resolve(selection2);
38113       });
38114     });
38115   }
38116   var dispatch7, _photo, _imageWrapper, _planeWrapper, _imgZoom, plane_photo_default;
38117   var init_plane_photo = __esm({
38118     "modules/services/plane_photo.js"() {
38119       "use strict";
38120       init_src4();
38121       init_src12();
38122       init_util();
38123       dispatch7 = dispatch_default("viewerChanged");
38124       _imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
38125       plane_photo_default = {
38126         init: async function(context, selection2) {
38127           this.event = utilRebind(this, dispatch7, "on");
38128           _planeWrapper = selection2;
38129           _planeWrapper.call(_imgZoom.on("zoom", zoomPan));
38130           _imageWrapper = _planeWrapper.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
38131           _photo = _imageWrapper.append("img").attr("class", "plane-photo");
38132           context.ui().photoviewer.on("resize.plane", function(dimensions) {
38133             _imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
38134           });
38135           await Promise.resolve();
38136           return this;
38137         },
38138         /**
38139          * Shows the photo frame if hidden
38140          * @param {*} context the HTML wrap of the frame
38141          */
38142         showPhotoFrame: function(context) {
38143           const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
38144           if (isHidden) {
38145             context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
38146             context.selectAll(".photo-frame.plane-frame").classed("hide", false);
38147           }
38148           return this;
38149         },
38150         /**
38151          * Hides the photo frame if shown
38152          * @param {*} context the HTML wrap of the frame
38153          */
38154         hidePhotoFrame: function(context) {
38155           context.select("photo-frame.plane-frame").classed("hide", false);
38156           return this;
38157         },
38158         /**
38159          * Renders an image inside the frame
38160          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
38161          */
38162         selectPhoto: function(data) {
38163           dispatch7.call("viewerChanged");
38164           loadImage(_photo, "");
38165           loadImage(_photo, data.image_path).then(() => {
38166             _planeWrapper.call(_imgZoom.transform, identity2);
38167           });
38168           return this;
38169         },
38170         getYaw: function() {
38171           return 0;
38172         }
38173       };
38174     }
38175   });
38176
38177   // modules/services/vegbilder.js
38178   var vegbilder_exports = {};
38179   __export(vegbilder_exports, {
38180     default: () => vegbilder_default
38181   });
38182   async function fetchAvailableLayers() {
38183     var _a4, _b2, _c;
38184     const params = {
38185       service: "WFS",
38186       request: "GetCapabilities",
38187       version: "2.0.0"
38188     };
38189     const urlForRequest = owsEndpoint + utilQsString(params);
38190     const response = await xml_default(urlForRequest);
38191     const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
38192     const availableLayers = [];
38193     for (const node of response.querySelectorAll("FeatureType > Name")) {
38194       const match = (_a4 = node.textContent) == null ? void 0 : _a4.match(regexMatcher);
38195       if (match) {
38196         availableLayers.push({
38197           name: match[0],
38198           is_sphere: !!((_b2 = match.groups) == null ? void 0 : _b2.image_type),
38199           year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
38200         });
38201       }
38202     }
38203     return availableLayers;
38204   }
38205   function filterAvailableLayers(photoContex) {
38206     const fromDateString = photoContex.fromDate();
38207     const toDateString = photoContex.toDate();
38208     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
38209     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
38210     const showsFlat = photoContex.showsFlat();
38211     const showsPano = photoContex.showsPanoramic();
38212     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
38213   }
38214   function loadWFSLayers(projection2, margin, wfslayers) {
38215     const tiles = tiler4.margin(margin).getTiles(projection2);
38216     for (const cache of wfslayers) {
38217       loadWFSLayer(projection2, cache, tiles);
38218     }
38219   }
38220   function loadWFSLayer(projection2, cache, tiles) {
38221     for (const [key, controller] of cache.inflight.entries()) {
38222       const wanted = tiles.some((tile) => key === tile.id);
38223       if (!wanted) {
38224         controller.abort();
38225         cache.inflight.delete(key);
38226       }
38227     }
38228     Promise.all(tiles.map(
38229       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
38230     )).then(() => orderSequences(projection2, cache));
38231   }
38232   async function loadTile2(cache, typename, tile) {
38233     const bbox2 = tile.extent.bbox();
38234     const tileid = tile.id;
38235     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid)) return;
38236     const params = {
38237       service: "WFS",
38238       request: "GetFeature",
38239       version: "2.0.0",
38240       typenames: typename,
38241       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
38242       outputFormat: "json"
38243     };
38244     const controller = new AbortController();
38245     cache.inflight.set(tileid, controller);
38246     const options = {
38247       method: "GET",
38248       signal: controller.signal
38249     };
38250     const urlForRequest = owsEndpoint + utilQsString(params);
38251     let featureCollection;
38252     try {
38253       featureCollection = await json_default(urlForRequest, options);
38254     } catch {
38255       cache.loaded.set(tileid, false);
38256       return;
38257     } finally {
38258       cache.inflight.delete(tileid);
38259     }
38260     cache.loaded.set(tileid, true);
38261     if (featureCollection.features.length === 0) {
38262       return;
38263     }
38264     const features = featureCollection.features.map((feature3) => {
38265       const loc = feature3.geometry.coordinates;
38266       const key = feature3.id;
38267       const properties = feature3.properties;
38268       const {
38269         RETNING: ca,
38270         TIDSPUNKT: captured_at,
38271         URL: image_path,
38272         URLPREVIEW: preview_path,
38273         BILDETYPE: image_type,
38274         METER: metering,
38275         FELTKODE: lane_code
38276       } = properties;
38277       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
38278       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
38279       const data = {
38280         service: "photo",
38281         loc,
38282         key,
38283         ca,
38284         image_path,
38285         preview_path,
38286         road_reference: roadReference(properties),
38287         metering,
38288         lane_code,
38289         direction,
38290         captured_at: new Date(captured_at),
38291         is_sphere: image_type === "360"
38292       };
38293       cache.points.set(key, data);
38294       return {
38295         minX: loc[0],
38296         minY: loc[1],
38297         maxX: loc[0],
38298         maxY: loc[1],
38299         data
38300       };
38301     });
38302     _vegbilderCache.rtree.load(features);
38303     dispatch8.call("loadedImages");
38304   }
38305   function orderSequences(projection2, cache) {
38306     const { points } = cache;
38307     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
38308       const key = image.road_reference;
38309       if (grouped2.has(key)) {
38310         grouped2.get(key).push(image);
38311       } else {
38312         grouped2.set(key, [image]);
38313       }
38314       return grouped2;
38315     }, /* @__PURE__ */ new Map());
38316     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
38317       imageGroup.sort((a4, b3) => {
38318         if (a4.captured_at.valueOf() > b3.captured_at.valueOf()) {
38319           return 1;
38320         } else if (a4.captured_at.valueOf() < b3.captured_at.valueOf()) {
38321           return -1;
38322         } else {
38323           const { direction } = a4;
38324           if (direction === directionEnum.forward) {
38325             return a4.metering - b3.metering;
38326           } else {
38327             return b3.metering - a4.metering;
38328           }
38329         }
38330       });
38331       let imageSequence = [imageGroup[0]];
38332       let angle2 = null;
38333       for (const [lastImage, image] of pairs(imageGroup)) {
38334         if (lastImage.ca === null) {
38335           const b3 = projection2(lastImage.loc);
38336           const a4 = projection2(image.loc);
38337           if (!geoVecEqual(a4, b3)) {
38338             angle2 = geoVecAngle(a4, b3);
38339             angle2 *= 180 / Math.PI;
38340             angle2 -= 90;
38341             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
38342           }
38343           lastImage.ca = angle2;
38344         }
38345         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
38346           imageSequence.push(image);
38347         } else {
38348           imageSequences2.push(imageSequence);
38349           imageSequence = [image];
38350         }
38351       }
38352       imageSequences2.push(imageSequence);
38353       return imageSequences2;
38354     }, []);
38355     cache.sequences = imageSequences.map((images) => {
38356       const sequence = {
38357         images,
38358         key: images[0].key,
38359         geometry: {
38360           type: "LineString",
38361           coordinates: images.map((image) => image.loc)
38362         }
38363       };
38364       for (const image of images) {
38365         _vegbilderCache.image2sequence_map.set(image.key, sequence);
38366       }
38367       return sequence;
38368     });
38369   }
38370   function roadReference(properties) {
38371     const {
38372       FYLKENUMMER: county_number,
38373       VEGKATEGORI: road_class,
38374       VEGSTATUS: road_status,
38375       VEGNUMMER: road_number,
38376       STREKNING: section,
38377       DELSTREKNING: subsection,
38378       HP: parcel,
38379       KRYSSDEL: junction_part,
38380       SIDEANLEGGSDEL: services_part,
38381       ANKERPUNKT: anker_point,
38382       AAR: year
38383     } = properties;
38384     let reference;
38385     if (year >= 2020) {
38386       reference = `${road_class}${road_status}${road_number} S${section}D${subsection}`;
38387       if (junction_part) {
38388         reference = `${reference} M${anker_point} KD${junction_part}`;
38389       } else if (services_part) {
38390         reference = `${reference} M${anker_point} SD${services_part}`;
38391       }
38392     } else {
38393       reference = `${county_number}${road_class}${road_status}${road_number} HP${parcel}`;
38394     }
38395     return reference;
38396   }
38397   function localeTimestamp(date) {
38398     const options = {
38399       day: "2-digit",
38400       month: "2-digit",
38401       year: "numeric",
38402       hour: "numeric",
38403       minute: "numeric",
38404       second: "numeric"
38405     };
38406     return date.toLocaleString(_mainLocalizer.localeCode(), options);
38407   }
38408   function partitionViewport3(projection2) {
38409     const zoom = geoScaleToZoom(projection2.scale());
38410     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
38411     const tiler8 = utilTiler().zoomExtent([roundZoom, roundZoom]);
38412     return tiler8.getTiles(projection2).map((tile) => tile.extent);
38413   }
38414   function searchLimited3(limit, projection2, rtree) {
38415     limit != null ? limit : limit = 5;
38416     return partitionViewport3(projection2).reduce((result, extent) => {
38417       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
38418       return result.concat(found);
38419     }, []);
38420   }
38421   var owsEndpoint, tileZoom2, tiler4, dispatch8, directionEnum, _planeFrame, _pannellumFrame, _currentFrame, _loadViewerPromise3, _vegbilderCache, vegbilder_default;
38422   var init_vegbilder = __esm({
38423     "modules/services/vegbilder.js"() {
38424       "use strict";
38425       init_src18();
38426       init_src4();
38427       init_src();
38428       init_rbush();
38429       init_country_coder();
38430       init_localizer();
38431       init_util();
38432       init_geo2();
38433       init_pannellum_photo();
38434       init_plane_photo();
38435       init_services();
38436       owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
38437       tileZoom2 = 14;
38438       tiler4 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
38439       dispatch8 = dispatch_default("loadedImages", "viewerChanged");
38440       directionEnum = Object.freeze({
38441         forward: Symbol(0),
38442         backward: Symbol(1)
38443       });
38444       vegbilder_default = {
38445         init: function() {
38446           this.event = utilRebind(this, dispatch8, "on");
38447         },
38448         reset: async function() {
38449           if (_vegbilderCache) {
38450             for (const layer of _vegbilderCache.wfslayers.values()) {
38451               for (const controller of layer.inflight.values()) {
38452                 controller.abort();
38453               }
38454             }
38455           }
38456           _vegbilderCache = {
38457             wfslayers: /* @__PURE__ */ new Map(),
38458             rtree: new RBush(),
38459             image2sequence_map: /* @__PURE__ */ new Map()
38460           };
38461           const availableLayers = await fetchAvailableLayers();
38462           const { wfslayers } = _vegbilderCache;
38463           for (const layerInfo of availableLayers) {
38464             const cache = {
38465               layerInfo,
38466               loaded: /* @__PURE__ */ new Map(),
38467               inflight: /* @__PURE__ */ new Map(),
38468               points: /* @__PURE__ */ new Map(),
38469               sequences: []
38470             };
38471             wfslayers.set(layerInfo.name, cache);
38472           }
38473         },
38474         images: function(projection2) {
38475           const limit = 5;
38476           return searchLimited3(limit, projection2, _vegbilderCache.rtree);
38477         },
38478         sequences: function(projection2) {
38479           const viewport = projection2.clipExtent();
38480           const min3 = [viewport[0][0], viewport[1][1]];
38481           const max3 = [viewport[1][0], viewport[0][1]];
38482           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
38483           const seen = /* @__PURE__ */ new Set();
38484           const line_strings = [];
38485           for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
38486             const sequence = _vegbilderCache.image2sequence_map.get(data.key);
38487             if (!sequence) continue;
38488             const { key, geometry, images } = sequence;
38489             if (seen.has(key)) continue;
38490             seen.add(key);
38491             const line = {
38492               type: "LineString",
38493               coordinates: geometry.coordinates,
38494               key,
38495               images
38496             };
38497             line_strings.push(line);
38498           }
38499           return line_strings;
38500         },
38501         cachedImage: function(key) {
38502           for (const { points } of _vegbilderCache.wfslayers.values()) {
38503             if (points.has(key)) return points.get(key);
38504           }
38505         },
38506         getSequenceForImage: function(image) {
38507           return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
38508         },
38509         loadImages: async function(context, margin) {
38510           if (!_vegbilderCache) {
38511             await this.reset();
38512           }
38513           margin != null ? margin : margin = 1;
38514           const wfslayers = filterAvailableLayers(context.photos());
38515           loadWFSLayers(context.projection, margin, wfslayers);
38516         },
38517         photoFrame: function() {
38518           return _currentFrame;
38519         },
38520         ensureViewerLoaded: function(context) {
38521           if (_loadViewerPromise3) return _loadViewerPromise3;
38522           const step = (stepBy) => () => {
38523             const viewer = context.container().select(".photoviewer");
38524             const selected = viewer.empty() ? void 0 : viewer.datum();
38525             if (!selected) return;
38526             const sequence = this.getSequenceForImage(selected);
38527             const nextIndex = sequence.images.indexOf(selected) + stepBy;
38528             const nextImage = sequence.images[nextIndex];
38529             if (!nextImage) return;
38530             context.map().centerEase(nextImage.loc);
38531             this.selectImage(context, nextImage.key, true);
38532           };
38533           const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
38534           const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
38535           wrapEnter.append("div").attr("class", "photo-attribution fillD");
38536           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
38537           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
38538           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
38539           _loadViewerPromise3 = Promise.all([
38540             pannellum_photo_default.init(context, wrapEnter),
38541             plane_photo_default.init(context, wrapEnter)
38542           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
38543             _pannellumFrame = pannellumPhotoFrame;
38544             _pannellumFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
38545             _planeFrame = planePhotoFrame;
38546             _planeFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
38547           });
38548           return _loadViewerPromise3;
38549         },
38550         selectImage: function(context, key, keepOrientation) {
38551           const d2 = this.cachedImage(key);
38552           this.updateUrlImage(key);
38553           const viewer = context.container().select(".photoviewer");
38554           if (!viewer.empty()) {
38555             viewer.datum(d2);
38556           }
38557           this.setStyles(context, null, true);
38558           if (!d2) return this;
38559           const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
38560           const attribution = wrap2.selectAll(".photo-attribution").text("");
38561           if (d2.captured_at) {
38562             attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
38563           }
38564           attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
38565           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"));
38566           _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
38567           _currentFrame.showPhotoFrame(wrap2).selectPhoto(d2, keepOrientation);
38568           return this;
38569         },
38570         showViewer: function(context) {
38571           const viewer = context.container().select(".photoviewer");
38572           const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
38573           if (isHidden) {
38574             for (const service of Object.values(services)) {
38575               if (service === this) continue;
38576               if (typeof service.hideViewer === "function") {
38577                 service.hideViewer(context);
38578               }
38579             }
38580             viewer.classed("hide", false).selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
38581           }
38582           return this;
38583         },
38584         hideViewer: function(context) {
38585           this.updateUrlImage(null);
38586           const viewer = context.container().select(".photoviewer");
38587           if (!viewer.empty()) viewer.datum(null);
38588           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
38589           context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
38590           return this.setStyles(context, null, true);
38591         },
38592         // Updates the currently highlighted sequence and selected bubble.
38593         // Reset is only necessary when interacting with the viewport because
38594         // this implicitly changes the currently selected bubble/sequence
38595         setStyles: function(context, hovered, reset) {
38596           var _a4, _b2;
38597           if (reset) {
38598             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
38599             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
38600           }
38601           const hoveredImageKey = hovered == null ? void 0 : hovered.key;
38602           const hoveredSequence = this.getSequenceForImage(hovered);
38603           const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
38604           const hoveredImageKeys = (_a4 = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a4 : [];
38605           const viewer = context.container().select(".photoviewer");
38606           const selected = viewer.empty() ? void 0 : viewer.datum();
38607           const selectedImageKey = selected == null ? void 0 : selected.key;
38608           const selectedSequence = this.getSequenceForImage(selected);
38609           const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
38610           const selectedImageKeys = (_b2 = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b2 : [];
38611           const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
38612           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);
38613           context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
38614           context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
38615           function viewfieldPath() {
38616             const d2 = this.parentNode.__data__;
38617             if (d2.is_sphere && d2.key !== selectedImageKey) {
38618               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
38619             } else {
38620               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
38621             }
38622           }
38623           return this;
38624         },
38625         updateUrlImage: function(key) {
38626           const hash2 = utilStringQs(window.location.hash);
38627           if (key) {
38628             hash2.photo = "vegbilder/" + key;
38629           } else {
38630             delete hash2.photo;
38631           }
38632           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
38633         },
38634         validHere: function(extent) {
38635           const bbox2 = Object.values(extent.bbox());
38636           return iso1A2Codes(bbox2).includes("NO");
38637         },
38638         cache: function() {
38639           return _vegbilderCache;
38640         }
38641       };
38642     }
38643   });
38644
38645   // node_modules/osm-auth/src/osm-auth.mjs
38646   function osmAuth(o2) {
38647     var oauth2 = {};
38648     var CHANNEL_ID = "osm-api-auth-complete";
38649     var _store = null;
38650     try {
38651       _store = window.localStorage;
38652     } catch (e3) {
38653       var _mock = /* @__PURE__ */ new Map();
38654       _store = {
38655         isMocked: true,
38656         hasItem: (k3) => _mock.has(k3),
38657         getItem: (k3) => _mock.get(k3),
38658         setItem: (k3, v3) => _mock.set(k3, v3),
38659         removeItem: (k3) => _mock.delete(k3),
38660         clear: () => _mock.clear()
38661       };
38662     }
38663     function token(k3, v3) {
38664       var key = o2.url + k3;
38665       if (arguments.length === 1) {
38666         var val = _store.getItem(key) || "";
38667         return val.replace(/"/g, "");
38668       } else if (arguments.length === 2) {
38669         if (v3) {
38670           return _store.setItem(key, v3);
38671         } else {
38672           return _store.removeItem(key);
38673         }
38674       }
38675     }
38676     oauth2.authenticated = function() {
38677       return !!token("oauth2_access_token");
38678     };
38679     oauth2.logout = function() {
38680       token("oauth2_access_token", "");
38681       token("oauth_token", "");
38682       token("oauth_token_secret", "");
38683       token("oauth_request_token_secret", "");
38684       return oauth2;
38685     };
38686     oauth2.authenticate = function(callback, options) {
38687       if (oauth2.authenticated()) {
38688         callback(null, oauth2);
38689         return;
38690       }
38691       oauth2.logout();
38692       _preopenPopup(function(error, popup) {
38693         if (error) {
38694           callback(error);
38695         } else {
38696           _generatePkceChallenge(function(pkce) {
38697             _authenticate(pkce, options, popup, callback);
38698           });
38699         }
38700       });
38701     };
38702     oauth2.authenticateAsync = function(options) {
38703       if (oauth2.authenticated()) {
38704         return Promise.resolve(oauth2);
38705       }
38706       oauth2.logout();
38707       return new Promise((resolve, reject) => {
38708         var errback = (err, result) => {
38709           if (err) {
38710             reject(err);
38711           } else {
38712             resolve(result);
38713           }
38714         };
38715         _preopenPopup((error, popup) => {
38716           if (error) {
38717             errback(error);
38718           } else {
38719             _generatePkceChallenge((pkce) => _authenticate(pkce, options, popup, errback));
38720           }
38721         });
38722       });
38723     };
38724     function _preopenPopup(callback) {
38725       if (o2.singlepage) {
38726         callback(null, void 0);
38727         return;
38728       }
38729       var w3 = 550;
38730       var h3 = 610;
38731       var settings = [
38732         ["width", w3],
38733         ["height", h3],
38734         ["left", window.screen.width / 2 - w3 / 2],
38735         ["top", window.screen.height / 2 - h3 / 2]
38736       ].map(function(x2) {
38737         return x2.join("=");
38738       }).join(",");
38739       var popup = window.open("about:blank", "oauth_window", settings);
38740       if (popup) {
38741         callback(null, popup);
38742       } else {
38743         var error = new Error("Popup was blocked");
38744         error.status = "popup-blocked";
38745         callback(error);
38746       }
38747     }
38748     function _authenticate(pkce, options, popup, callback) {
38749       var state = generateState();
38750       var path = "/oauth2/authorize?" + utilQsString2({
38751         client_id: o2.client_id,
38752         redirect_uri: o2.redirect_uri,
38753         response_type: "code",
38754         scope: o2.scope,
38755         state,
38756         code_challenge: pkce.code_challenge,
38757         code_challenge_method: pkce.code_challenge_method,
38758         locale: o2.locale || ""
38759       });
38760       var url = (options == null ? void 0 : options.switchUser) ? `${o2.url}/logout?referer=${encodeURIComponent(`/login?referer=${encodeURIComponent(path)}`)}` : o2.url + path;
38761       if (o2.singlepage) {
38762         if (_store.isMocked) {
38763           var error = new Error("localStorage unavailable, but required in singlepage mode");
38764           error.status = "pkce-localstorage-unavailable";
38765           callback(error);
38766           return;
38767         }
38768         var params = utilStringQs2(window.location.search.slice(1));
38769         if (params.code) {
38770           oauth2.bootstrapToken(params.code, callback);
38771         } else {
38772           token("oauth2_state", state);
38773           token("oauth2_pkce_code_verifier", pkce.code_verifier);
38774           window.location = url;
38775         }
38776       } else {
38777         oauth2.popupWindow = popup;
38778         popup.location = url;
38779       }
38780       var bc = new BroadcastChannel(CHANNEL_ID);
38781       bc.addEventListener("message", (event) => {
38782         var url2 = event.data;
38783         var params2 = utilStringQs2(url2.split("?")[1]);
38784         if (params2.state !== state) {
38785           var error2 = new Error("Invalid state");
38786           error2.status = "invalid-state";
38787           callback(error2);
38788           return;
38789         }
38790         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
38791         bc.close();
38792       });
38793       function accessTokenDone(err, xhr) {
38794         o2.done();
38795         if (err) {
38796           callback(err);
38797           return;
38798         }
38799         var access_token = JSON.parse(xhr.response);
38800         token("oauth2_access_token", access_token.access_token);
38801         callback(null, oauth2);
38802       }
38803     }
38804     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
38805       var url = o2.url + "/oauth2/token?" + utilQsString2({
38806         client_id: o2.client_id,
38807         redirect_uri: o2.redirect_uri,
38808         grant_type: "authorization_code",
38809         code: auth_code,
38810         code_verifier
38811       });
38812       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
38813       o2.loading();
38814     }
38815     oauth2.bringPopupWindowToFront = function() {
38816       var broughtPopupToFront = false;
38817       try {
38818         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
38819           oauth2.popupWindow.focus();
38820           broughtPopupToFront = true;
38821         }
38822       } catch (err) {
38823       }
38824       return broughtPopupToFront;
38825     };
38826     oauth2.bootstrapToken = function(auth_code, callback) {
38827       var state = token("oauth2_state");
38828       token("oauth2_state", "");
38829       var params = utilStringQs2(window.location.search.slice(1));
38830       if (params.state !== state) {
38831         var error = new Error("Invalid state");
38832         error.status = "invalid-state";
38833         callback(error);
38834         return;
38835       }
38836       var code_verifier = token("oauth2_pkce_code_verifier");
38837       token("oauth2_pkce_code_verifier", "");
38838       _getAccessToken(auth_code, code_verifier, accessTokenDone);
38839       function accessTokenDone(err, xhr) {
38840         o2.done();
38841         if (err) {
38842           callback(err);
38843           return;
38844         }
38845         var access_token = JSON.parse(xhr.response);
38846         token("oauth2_access_token", access_token.access_token);
38847         callback(null, oauth2);
38848       }
38849     };
38850     oauth2.fetch = function(resource, options) {
38851       if (oauth2.authenticated()) {
38852         return _doFetch();
38853       } else {
38854         if (o2.auto) {
38855           return oauth2.authenticateAsync().then(_doFetch);
38856         } else {
38857           return Promise.reject(new Error("not authenticated"));
38858         }
38859       }
38860       function _doFetch() {
38861         options = options || {};
38862         if (!options.headers) {
38863           options.headers = { "Content-Type": "application/x-www-form-urlencoded" };
38864         }
38865         options.headers.Authorization = "Bearer " + token("oauth2_access_token");
38866         return fetch(resource, options);
38867       }
38868     };
38869     oauth2.xhr = function(options, callback) {
38870       if (oauth2.authenticated()) {
38871         return _doXHR();
38872       } else {
38873         if (o2.auto) {
38874           oauth2.authenticate(_doXHR);
38875           return;
38876         } else {
38877           callback("not authenticated", null);
38878           return;
38879         }
38880       }
38881       function _doXHR() {
38882         var url = options.prefix !== false ? o2.apiUrl + options.path : options.path;
38883         return oauth2.rawxhr(
38884           options.method,
38885           url,
38886           token("oauth2_access_token"),
38887           options.content,
38888           options.headers,
38889           done
38890         );
38891       }
38892       function done(err, xhr) {
38893         if (err) {
38894           callback(err);
38895         } else if (xhr.responseXML) {
38896           callback(err, xhr.responseXML);
38897         } else {
38898           callback(err, xhr.response);
38899         }
38900       }
38901     };
38902     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
38903       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
38904       if (access_token) {
38905         headers.Authorization = "Bearer " + access_token;
38906       }
38907       var xhr = new XMLHttpRequest();
38908       xhr.onreadystatechange = function() {
38909         if (4 === xhr.readyState && 0 !== xhr.status) {
38910           if (/^20\d$/.test(xhr.status)) {
38911             callback(null, xhr);
38912           } else {
38913             callback(xhr, null);
38914           }
38915         }
38916       };
38917       xhr.onerror = function(e3) {
38918         callback(e3, null);
38919       };
38920       xhr.open(method, url, true);
38921       for (var h3 in headers) xhr.setRequestHeader(h3, headers[h3]);
38922       xhr.send(data);
38923       return xhr;
38924     };
38925     oauth2.preauth = function(val) {
38926       if (val && val.access_token) {
38927         token("oauth2_access_token", val.access_token);
38928       }
38929       return oauth2;
38930     };
38931     oauth2.options = function(val) {
38932       if (!arguments.length) return o2;
38933       o2 = val;
38934       o2.apiUrl = o2.apiUrl || "https://api.openstreetmap.org";
38935       o2.url = o2.url || "https://www.openstreetmap.org";
38936       o2.auto = o2.auto || false;
38937       o2.singlepage = o2.singlepage || false;
38938       o2.loading = o2.loading || function() {
38939       };
38940       o2.done = o2.done || function() {
38941       };
38942       return oauth2.preauth(o2);
38943     };
38944     oauth2.options(o2);
38945     return oauth2;
38946   }
38947   function utilQsString2(obj) {
38948     return Object.keys(obj).filter(function(key) {
38949       return obj[key] !== void 0;
38950     }).sort().map(function(key) {
38951       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
38952     }).join("&");
38953   }
38954   function utilStringQs2(str) {
38955     var i3 = 0;
38956     while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
38957     str = str.slice(i3);
38958     return str.split("&").reduce(function(obj, pair3) {
38959       var parts = pair3.split("=");
38960       if (parts.length === 2) {
38961         obj[parts[0]] = decodeURIComponent(parts[1]);
38962       }
38963       return obj;
38964     }, {});
38965   }
38966   function supportsWebCryptoAPI() {
38967     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
38968   }
38969   function _generatePkceChallenge(callback) {
38970     var code_verifier;
38971     if (supportsWebCryptoAPI()) {
38972       var random = window.crypto.getRandomValues(new Uint8Array(32));
38973       code_verifier = base64(random.buffer);
38974       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
38975         return char.charCodeAt(0);
38976       }));
38977       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash2) {
38978         var code_challenge = base64(hash2);
38979         callback({
38980           code_challenge,
38981           code_verifier,
38982           code_challenge_method: "S256"
38983         });
38984       });
38985     } else {
38986       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
38987       code_verifier = "";
38988       for (var i3 = 0; i3 < 64; i3++) {
38989         code_verifier += chars[Math.floor(Math.random() * chars.length)];
38990       }
38991       callback({
38992         code_verifier,
38993         code_challenge: code_verifier,
38994         code_challenge_method: "plain"
38995       });
38996     }
38997   }
38998   function generateState() {
38999     var state;
39000     if (supportsWebCryptoAPI()) {
39001       var random = window.crypto.getRandomValues(new Uint8Array(32));
39002       state = base64(random.buffer);
39003     } else {
39004       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
39005       state = "";
39006       for (var i3 = 0; i3 < 64; i3++) {
39007         state += chars[Math.floor(Math.random() * chars.length)];
39008       }
39009     }
39010     return state;
39011   }
39012   function base64(buffer) {
39013     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
39014   }
39015   var init_osm_auth = __esm({
39016     "node_modules/osm-auth/src/osm-auth.mjs"() {
39017     }
39018   });
39019
39020   // modules/util/jxon.js
39021   var jxon_exports = {};
39022   __export(jxon_exports, {
39023     JXON: () => JXON
39024   });
39025   var JXON;
39026   var init_jxon = __esm({
39027     "modules/util/jxon.js"() {
39028       "use strict";
39029       JXON = new function() {
39030         var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
39031         function parseText(sValue) {
39032           if (rIsNull.test(sValue)) {
39033             return null;
39034           }
39035           if (rIsBool.test(sValue)) {
39036             return sValue.toLowerCase() === "true";
39037           }
39038           if (isFinite(sValue)) {
39039             return parseFloat(sValue);
39040           }
39041           if (isFinite(Date.parse(sValue))) {
39042             return new Date(sValue);
39043           }
39044           return sValue;
39045         }
39046         function EmptyTree() {
39047         }
39048         EmptyTree.prototype.toString = function() {
39049           return "null";
39050         };
39051         EmptyTree.prototype.valueOf = function() {
39052           return null;
39053         };
39054         function objectify(vValue) {
39055           return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
39056         }
39057         function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
39058           var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
39059           var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
39060             /* put here the default value for empty nodes: */
39061             true
39062           );
39063           if (bChildren) {
39064             for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
39065               oNode = oParentNode.childNodes.item(nItem);
39066               if (oNode.nodeType === 4) {
39067                 sCollectedTxt += oNode.nodeValue;
39068               } else if (oNode.nodeType === 3) {
39069                 sCollectedTxt += oNode.nodeValue.trim();
39070               } else if (oNode.nodeType === 1 && !oNode.prefix) {
39071                 aCache.push(oNode);
39072               }
39073             }
39074           }
39075           var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
39076           if (!bHighVerb && (bChildren || bAttributes)) {
39077             vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
39078           }
39079           for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
39080             sProp = aCache[nElId].nodeName.toLowerCase();
39081             vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
39082             if (vResult.hasOwnProperty(sProp)) {
39083               if (vResult[sProp].constructor !== Array) {
39084                 vResult[sProp] = [vResult[sProp]];
39085               }
39086               vResult[sProp].push(vContent);
39087             } else {
39088               vResult[sProp] = vContent;
39089               nLength++;
39090             }
39091           }
39092           if (bAttributes) {
39093             var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
39094             for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
39095               oAttrib = oParentNode.attributes.item(nAttrib);
39096               oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
39097             }
39098             if (bNesteAttr) {
39099               if (bFreeze) {
39100                 Object.freeze(oAttrParent);
39101               }
39102               vResult[sAttributesProp] = oAttrParent;
39103               nLength -= nAttrLen - 1;
39104             }
39105           }
39106           if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
39107             vResult[sValueProp] = vBuiltVal;
39108           } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
39109             vResult = vBuiltVal;
39110           }
39111           if (bFreeze && (bHighVerb || nLength > 0)) {
39112             Object.freeze(vResult);
39113           }
39114           aCache.length = nLevelStart;
39115           return vResult;
39116         }
39117         function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
39118           var vValue, oChild;
39119           if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
39120             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
39121           } else if (oParentObj.constructor === Date) {
39122             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
39123           }
39124           for (var sName in oParentObj) {
39125             vValue = oParentObj[sName];
39126             if (isFinite(sName) || vValue instanceof Function) {
39127               continue;
39128             }
39129             if (sName === sValueProp) {
39130               if (vValue !== null && vValue !== true) {
39131                 oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
39132               }
39133             } else if (sName === sAttributesProp) {
39134               for (var sAttrib in vValue) {
39135                 oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
39136               }
39137             } else if (sName.charAt(0) === sAttrPref) {
39138               oParentEl.setAttribute(sName.slice(1), vValue);
39139             } else if (vValue.constructor === Array) {
39140               for (var nItem = 0; nItem < vValue.length; nItem++) {
39141                 oChild = oXMLDoc.createElement(sName);
39142                 loadObjTree(oXMLDoc, oChild, vValue[nItem]);
39143                 oParentEl.appendChild(oChild);
39144               }
39145             } else {
39146               oChild = oXMLDoc.createElement(sName);
39147               if (vValue instanceof Object) {
39148                 loadObjTree(oXMLDoc, oChild, vValue);
39149               } else if (vValue !== null && vValue !== true) {
39150                 oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
39151               }
39152               oParentEl.appendChild(oChild);
39153             }
39154           }
39155         }
39156         this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
39157           var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
39158             /* put here the default verbosity level: */
39159             1
39160           );
39161           return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
39162         };
39163         this.unbuild = function(oObjTree) {
39164           var oNewDoc = document.implementation.createDocument("", "", null);
39165           loadObjTree(oNewDoc, oNewDoc, oObjTree);
39166           return oNewDoc;
39167         };
39168         this.stringify = function(oObjTree) {
39169           return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
39170         };
39171       }();
39172     }
39173   });
39174
39175   // modules/services/osm.js
39176   var osm_exports2 = {};
39177   __export(osm_exports2, {
39178     default: () => osm_default
39179   });
39180   function authLoading() {
39181     dispatch9.call("authLoading");
39182   }
39183   function authDone() {
39184     dispatch9.call("authDone");
39185   }
39186   function abortRequest4(controllerOrXHR) {
39187     if (controllerOrXHR) {
39188       controllerOrXHR.abort();
39189     }
39190   }
39191   function hasInflightRequests(cache) {
39192     return Object.keys(cache.inflight).length;
39193   }
39194   function abortUnwantedRequests3(cache, visibleTiles) {
39195     Object.keys(cache.inflight).forEach(function(k3) {
39196       if (cache.toLoad[k3]) return;
39197       if (visibleTiles.find(function(tile) {
39198         return k3 === tile.id;
39199       })) return;
39200       abortRequest4(cache.inflight[k3]);
39201       delete cache.inflight[k3];
39202     });
39203   }
39204   function getLoc(attrs) {
39205     var lon = attrs.lon && attrs.lon.value;
39206     var lat = attrs.lat && attrs.lat.value;
39207     return [Number(lon), Number(lat)];
39208   }
39209   function getNodes(obj) {
39210     var elems = obj.getElementsByTagName("nd");
39211     var nodes = new Array(elems.length);
39212     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39213       nodes[i3] = "n" + elems[i3].attributes.ref.value;
39214     }
39215     return nodes;
39216   }
39217   function getNodesJSON(obj) {
39218     var elems = obj.nodes;
39219     var nodes = new Array(elems.length);
39220     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39221       nodes[i3] = "n" + elems[i3];
39222     }
39223     return nodes;
39224   }
39225   function getTags(obj) {
39226     var elems = obj.getElementsByTagName("tag");
39227     var tags = {};
39228     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39229       var attrs = elems[i3].attributes;
39230       tags[attrs.k.value] = attrs.v.value;
39231     }
39232     return tags;
39233   }
39234   function getMembers(obj) {
39235     var elems = obj.getElementsByTagName("member");
39236     var members = new Array(elems.length);
39237     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39238       var attrs = elems[i3].attributes;
39239       members[i3] = {
39240         id: attrs.type.value[0] + attrs.ref.value,
39241         type: attrs.type.value,
39242         role: attrs.role.value
39243       };
39244     }
39245     return members;
39246   }
39247   function getMembersJSON(obj) {
39248     var elems = obj.members;
39249     var members = new Array(elems.length);
39250     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39251       var attrs = elems[i3];
39252       members[i3] = {
39253         id: attrs.type[0] + attrs.ref,
39254         type: attrs.type,
39255         role: attrs.role
39256       };
39257     }
39258     return members;
39259   }
39260   function getVisible(attrs) {
39261     return !attrs.visible || attrs.visible.value !== "false";
39262   }
39263   function parseComments(comments) {
39264     var parsedComments = [];
39265     for (var i3 = 0; i3 < comments.length; i3++) {
39266       var comment = comments[i3];
39267       if (comment.nodeName === "comment") {
39268         var childNodes = comment.childNodes;
39269         var parsedComment = {};
39270         for (var j3 = 0; j3 < childNodes.length; j3++) {
39271           var node = childNodes[j3];
39272           var nodeName = node.nodeName;
39273           if (nodeName === "#text") continue;
39274           parsedComment[nodeName] = node.textContent;
39275           if (nodeName === "uid") {
39276             var uid = node.textContent;
39277             if (uid && !_userCache.user[uid]) {
39278               _userCache.toLoad[uid] = true;
39279             }
39280           }
39281         }
39282         if (parsedComment) {
39283           parsedComments.push(parsedComment);
39284         }
39285       }
39286     }
39287     return parsedComments;
39288   }
39289   function encodeNoteRtree(note) {
39290     return {
39291       minX: note.loc[0],
39292       minY: note.loc[1],
39293       maxX: note.loc[0],
39294       maxY: note.loc[1],
39295       data: note
39296     };
39297   }
39298   function parseJSON(payload, callback, options) {
39299     options = Object.assign({ skipSeen: true }, options);
39300     if (!payload) {
39301       return callback({ message: "No JSON", status: -1 });
39302     }
39303     var json = payload;
39304     if (typeof json !== "object") json = JSON.parse(payload);
39305     if (!json.elements) return callback({ message: "No JSON", status: -1 });
39306     var children2 = json.elements;
39307     var handle = window.requestIdleCallback(function() {
39308       _deferred.delete(handle);
39309       var results = [];
39310       var result;
39311       for (var i3 = 0; i3 < children2.length; i3++) {
39312         result = parseChild(children2[i3]);
39313         if (result) results.push(result);
39314       }
39315       callback(null, results);
39316     });
39317     _deferred.add(handle);
39318     function parseChild(child) {
39319       var parser2 = jsonparsers[child.type];
39320       if (!parser2) return null;
39321       var uid;
39322       uid = osmEntity.id.fromOSM(child.type, child.id);
39323       if (options.skipSeen) {
39324         if (_tileCache.seen[uid]) return null;
39325         _tileCache.seen[uid] = true;
39326       }
39327       return parser2(child, uid);
39328     }
39329   }
39330   function parseUserJSON(payload, callback, options) {
39331     options = Object.assign({ skipSeen: true }, options);
39332     if (!payload) {
39333       return callback({ message: "No JSON", status: -1 });
39334     }
39335     var json = payload;
39336     if (typeof json !== "object") json = JSON.parse(payload);
39337     if (!json.users && !json.user) return callback({ message: "No JSON", status: -1 });
39338     var objs = json.users || [json];
39339     var handle = window.requestIdleCallback(function() {
39340       _deferred.delete(handle);
39341       var results = [];
39342       var result;
39343       for (var i3 = 0; i3 < objs.length; i3++) {
39344         result = parseObj(objs[i3]);
39345         if (result) results.push(result);
39346       }
39347       callback(null, results);
39348     });
39349     _deferred.add(handle);
39350     function parseObj(obj) {
39351       var uid = obj.user.id && obj.user.id.toString();
39352       if (options.skipSeen && _userCache.user[uid]) {
39353         delete _userCache.toLoad[uid];
39354         return null;
39355       }
39356       var user = jsonparsers.user(obj.user, uid);
39357       _userCache.user[uid] = user;
39358       delete _userCache.toLoad[uid];
39359       return user;
39360     }
39361   }
39362   function parseXML(xml, callback, options) {
39363     options = Object.assign({ skipSeen: true }, options);
39364     if (!xml || !xml.childNodes) {
39365       return callback({ message: "No XML", status: -1 });
39366     }
39367     var root3 = xml.childNodes[0];
39368     var children2 = root3.childNodes;
39369     var handle = window.requestIdleCallback(function() {
39370       _deferred.delete(handle);
39371       var results = [];
39372       var result;
39373       for (var i3 = 0; i3 < children2.length; i3++) {
39374         result = parseChild(children2[i3]);
39375         if (result) results.push(result);
39376       }
39377       callback(null, results);
39378     });
39379     _deferred.add(handle);
39380     function parseChild(child) {
39381       var parser2 = parsers[child.nodeName];
39382       if (!parser2) return null;
39383       var uid;
39384       if (child.nodeName === "user") {
39385         uid = child.attributes.id.value;
39386         if (options.skipSeen && _userCache.user[uid]) {
39387           delete _userCache.toLoad[uid];
39388           return null;
39389         }
39390       } else if (child.nodeName === "note") {
39391         uid = child.getElementsByTagName("id")[0].textContent;
39392       } else {
39393         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
39394         if (options.skipSeen) {
39395           if (_tileCache.seen[uid]) return null;
39396           _tileCache.seen[uid] = true;
39397         }
39398       }
39399       return parser2(child, uid);
39400     }
39401   }
39402   function updateRtree3(item, replace) {
39403     _noteCache.rtree.remove(item, function isEql(a4, b3) {
39404       return a4.data.id === b3.data.id;
39405     });
39406     if (replace) {
39407       _noteCache.rtree.insert(item);
39408     }
39409   }
39410   function wrapcb(thisArg, callback, cid) {
39411     return function(err, result) {
39412       if (err) {
39413         return callback.call(thisArg, err);
39414       } else if (thisArg.getConnectionId() !== cid) {
39415         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
39416       } else {
39417         return callback.call(thisArg, err, result);
39418       }
39419     };
39420   }
39421   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;
39422   var init_osm2 = __esm({
39423     "modules/services/osm.js"() {
39424       "use strict";
39425       init_throttle();
39426       init_src4();
39427       init_src18();
39428       init_osm_auth();
39429       init_rbush();
39430       init_jxon();
39431       init_geo2();
39432       init_osm();
39433       init_util();
39434       init_localizer();
39435       init_id();
39436       tiler5 = utilTiler();
39437       dispatch9 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
39438       urlroot = osmApiConnections[0].url;
39439       apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
39440       redirectPath = window.location.origin + window.location.pathname;
39441       oauth = osmAuth({
39442         url: urlroot,
39443         apiUrl: apiUrlroot,
39444         client_id: osmApiConnections[0].client_id,
39445         scope: "read_prefs write_prefs write_api read_gpx write_notes",
39446         redirect_uri: redirectPath + "land.html",
39447         loading: authLoading,
39448         done: authDone
39449       });
39450       _apiConnections = osmApiConnections;
39451       _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
39452       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
39453       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
39454       _userCache = { toLoad: {}, user: {} };
39455       _changeset = {};
39456       _deferred = /* @__PURE__ */ new Set();
39457       _connectionID = 1;
39458       _tileZoom3 = 16;
39459       _noteZoom = 12;
39460       _maxWayNodes = 2e3;
39461       jsonparsers = {
39462         node: function nodeData(obj, uid) {
39463           return new osmNode({
39464             id: uid,
39465             visible: typeof obj.visible === "boolean" ? obj.visible : true,
39466             version: obj.version && obj.version.toString(),
39467             changeset: obj.changeset && obj.changeset.toString(),
39468             timestamp: obj.timestamp,
39469             user: obj.user,
39470             uid: obj.uid && obj.uid.toString(),
39471             loc: [Number(obj.lon), Number(obj.lat)],
39472             tags: obj.tags
39473           });
39474         },
39475         way: function wayData(obj, uid) {
39476           return new osmWay({
39477             id: uid,
39478             visible: typeof obj.visible === "boolean" ? obj.visible : true,
39479             version: obj.version && obj.version.toString(),
39480             changeset: obj.changeset && obj.changeset.toString(),
39481             timestamp: obj.timestamp,
39482             user: obj.user,
39483             uid: obj.uid && obj.uid.toString(),
39484             tags: obj.tags,
39485             nodes: getNodesJSON(obj)
39486           });
39487         },
39488         relation: function relationData(obj, uid) {
39489           return new osmRelation({
39490             id: uid,
39491             visible: typeof obj.visible === "boolean" ? obj.visible : true,
39492             version: obj.version && obj.version.toString(),
39493             changeset: obj.changeset && obj.changeset.toString(),
39494             timestamp: obj.timestamp,
39495             user: obj.user,
39496             uid: obj.uid && obj.uid.toString(),
39497             tags: obj.tags,
39498             members: getMembersJSON(obj)
39499           });
39500         },
39501         user: function parseUser(obj, uid) {
39502           return {
39503             id: uid,
39504             display_name: obj.display_name,
39505             account_created: obj.account_created,
39506             image_url: obj.img && obj.img.href,
39507             changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
39508             active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
39509           };
39510         }
39511       };
39512       parsers = {
39513         node: function nodeData2(obj, uid) {
39514           var attrs = obj.attributes;
39515           return new osmNode({
39516             id: uid,
39517             visible: getVisible(attrs),
39518             version: attrs.version.value,
39519             changeset: attrs.changeset && attrs.changeset.value,
39520             timestamp: attrs.timestamp && attrs.timestamp.value,
39521             user: attrs.user && attrs.user.value,
39522             uid: attrs.uid && attrs.uid.value,
39523             loc: getLoc(attrs),
39524             tags: getTags(obj)
39525           });
39526         },
39527         way: function wayData2(obj, uid) {
39528           var attrs = obj.attributes;
39529           return new osmWay({
39530             id: uid,
39531             visible: getVisible(attrs),
39532             version: attrs.version.value,
39533             changeset: attrs.changeset && attrs.changeset.value,
39534             timestamp: attrs.timestamp && attrs.timestamp.value,
39535             user: attrs.user && attrs.user.value,
39536             uid: attrs.uid && attrs.uid.value,
39537             tags: getTags(obj),
39538             nodes: getNodes(obj)
39539           });
39540         },
39541         relation: function relationData2(obj, uid) {
39542           var attrs = obj.attributes;
39543           return new osmRelation({
39544             id: uid,
39545             visible: getVisible(attrs),
39546             version: attrs.version.value,
39547             changeset: attrs.changeset && attrs.changeset.value,
39548             timestamp: attrs.timestamp && attrs.timestamp.value,
39549             user: attrs.user && attrs.user.value,
39550             uid: attrs.uid && attrs.uid.value,
39551             tags: getTags(obj),
39552             members: getMembers(obj)
39553           });
39554         },
39555         note: function parseNote(obj, uid) {
39556           var attrs = obj.attributes;
39557           var childNodes = obj.childNodes;
39558           var props = {};
39559           props.id = uid;
39560           props.loc = getLoc(attrs);
39561           if (!_noteCache.note[uid]) {
39562             let coincident = false;
39563             const epsilon3 = 1e-5;
39564             do {
39565               if (coincident) {
39566                 props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
39567               }
39568               const bbox2 = geoExtent(props.loc).bbox();
39569               coincident = _noteCache.rtree.search(bbox2).length;
39570             } while (coincident);
39571           } else {
39572             props.loc = _noteCache.note[uid].loc;
39573           }
39574           for (var i3 = 0; i3 < childNodes.length; i3++) {
39575             var node = childNodes[i3];
39576             var nodeName = node.nodeName;
39577             if (nodeName === "#text") continue;
39578             if (nodeName === "comments") {
39579               props[nodeName] = parseComments(node.childNodes);
39580             } else {
39581               props[nodeName] = node.textContent;
39582             }
39583           }
39584           var note = new osmNote(props);
39585           var item = encodeNoteRtree(note);
39586           _noteCache.note[note.id] = note;
39587           updateRtree3(item, true);
39588           return note;
39589         },
39590         user: function parseUser2(obj, uid) {
39591           var attrs = obj.attributes;
39592           var user = {
39593             id: uid,
39594             display_name: attrs.display_name && attrs.display_name.value,
39595             account_created: attrs.account_created && attrs.account_created.value,
39596             changesets_count: "0",
39597             active_blocks: "0"
39598           };
39599           var img = obj.getElementsByTagName("img");
39600           if (img && img[0] && img[0].getAttribute("href")) {
39601             user.image_url = img[0].getAttribute("href");
39602           }
39603           var changesets = obj.getElementsByTagName("changesets");
39604           if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
39605             user.changesets_count = changesets[0].getAttribute("count");
39606           }
39607           var blocks = obj.getElementsByTagName("blocks");
39608           if (blocks && blocks[0]) {
39609             var received = blocks[0].getElementsByTagName("received");
39610             if (received && received[0] && received[0].getAttribute("active")) {
39611               user.active_blocks = received[0].getAttribute("active");
39612             }
39613           }
39614           _userCache.user[uid] = user;
39615           delete _userCache.toLoad[uid];
39616           return user;
39617         }
39618       };
39619       osm_default = {
39620         init: function() {
39621           utilRebind(this, dispatch9, "on");
39622         },
39623         reset: function() {
39624           Array.from(_deferred).forEach(function(handle) {
39625             window.cancelIdleCallback(handle);
39626             _deferred.delete(handle);
39627           });
39628           _connectionID++;
39629           _userChangesets = void 0;
39630           _userDetails = void 0;
39631           _rateLimitError = void 0;
39632           Object.values(_tileCache.inflight).forEach(abortRequest4);
39633           Object.values(_noteCache.inflight).forEach(abortRequest4);
39634           Object.values(_noteCache.inflightPost).forEach(abortRequest4);
39635           if (_changeset.inflight) abortRequest4(_changeset.inflight);
39636           _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
39637           _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
39638           _userCache = { toLoad: {}, user: {} };
39639           _cachedApiStatus = void 0;
39640           _changeset = {};
39641           return this;
39642         },
39643         getConnectionId: function() {
39644           return _connectionID;
39645         },
39646         getUrlRoot: function() {
39647           return urlroot;
39648         },
39649         getApiUrlRoot: function() {
39650           return apiUrlroot;
39651         },
39652         changesetURL: function(changesetID) {
39653           return urlroot + "/changeset/" + changesetID;
39654         },
39655         changesetsURL: function(center, zoom) {
39656           var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
39657           return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
39658         },
39659         entityURL: function(entity) {
39660           return urlroot + "/" + entity.type + "/" + entity.osmId();
39661         },
39662         historyURL: function(entity) {
39663           return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
39664         },
39665         userURL: function(username) {
39666           return urlroot + "/user/" + encodeURIComponent(username);
39667         },
39668         noteURL: function(note) {
39669           return urlroot + "/note/" + note.id;
39670         },
39671         noteReportURL: function(note) {
39672           return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
39673         },
39674         // Generic method to load data from the OSM API
39675         // Can handle either auth or unauth calls.
39676         loadFromAPI: function(path, callback, options) {
39677           options = Object.assign({ skipSeen: true }, options);
39678           var that = this;
39679           var cid = _connectionID;
39680           function done(err, payload) {
39681             if (that.getConnectionId() !== cid) {
39682               if (callback) callback({ message: "Connection Switched", status: -1 });
39683               return;
39684             }
39685             if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
39686               that.reloadApiStatus();
39687             }
39688             if (callback) {
39689               if (err) {
39690                 console.error("API error:", err);
39691                 return callback(err);
39692               } else {
39693                 if (path.indexOf(".json") !== -1) {
39694                   return parseJSON(payload, callback, options);
39695                 } else {
39696                   return parseXML(payload, callback, options);
39697                 }
39698               }
39699             }
39700           }
39701           if (this.authenticated()) {
39702             return oauth.xhr({
39703               method: "GET",
39704               path
39705             }, done);
39706           } else {
39707             var url = apiUrlroot + path;
39708             var controller = new AbortController();
39709             var fn;
39710             if (path.indexOf(".json") !== -1) {
39711               fn = json_default;
39712             } else {
39713               fn = xml_default;
39714             }
39715             fn(url, { signal: controller.signal }).then(function(data) {
39716               done(null, data);
39717             }).catch(function(err) {
39718               if (err.name === "AbortError") return;
39719               var match = err.message.match(/^\d{3}/);
39720               if (match) {
39721                 done({ status: +match[0], statusText: err.message });
39722               } else {
39723                 done(err.message);
39724               }
39725             });
39726             return controller;
39727           }
39728         },
39729         // Load a single entity by id (ways and relations use the `/full` call to include
39730         // nodes and members). Parent relations are not included, see `loadEntityRelations`.
39731         // GET /api/0.6/node/#id
39732         // GET /api/0.6/[way|relation]/#id/full
39733         loadEntity: function(id2, callback) {
39734           var type2 = osmEntity.id.type(id2);
39735           var osmID = osmEntity.id.toOSM(id2);
39736           var options = { skipSeen: false };
39737           this.loadFromAPI(
39738             "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
39739             function(err, entities) {
39740               if (callback) callback(err, { data: entities });
39741             },
39742             options
39743           );
39744         },
39745         // Load a single note by id , XML format
39746         // GET /api/0.6/notes/#id
39747         loadEntityNote: function(id2, callback) {
39748           var options = { skipSeen: false };
39749           this.loadFromAPI(
39750             "/api/0.6/notes/" + id2,
39751             function(err, entities) {
39752               if (callback) callback(err, { data: entities });
39753             },
39754             options
39755           );
39756         },
39757         // Load a single entity with a specific version
39758         // GET /api/0.6/[node|way|relation]/#id/#version
39759         loadEntityVersion: function(id2, version, callback) {
39760           var type2 = osmEntity.id.type(id2);
39761           var osmID = osmEntity.id.toOSM(id2);
39762           var options = { skipSeen: false };
39763           this.loadFromAPI(
39764             "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
39765             function(err, entities) {
39766               if (callback) callback(err, { data: entities });
39767             },
39768             options
39769           );
39770         },
39771         // Load the relations of a single entity with the given.
39772         // GET /api/0.6/[node|way|relation]/#id/relations
39773         loadEntityRelations: function(id2, callback) {
39774           var type2 = osmEntity.id.type(id2);
39775           var osmID = osmEntity.id.toOSM(id2);
39776           var options = { skipSeen: false };
39777           this.loadFromAPI(
39778             "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
39779             function(err, entities) {
39780               if (callback) callback(err, { data: entities });
39781             },
39782             options
39783           );
39784         },
39785         // Load multiple entities in chunks
39786         // (note: callback may be called multiple times)
39787         // Unlike `loadEntity`, child nodes and members are not fetched
39788         // GET /api/0.6/[nodes|ways|relations]?#parameters
39789         loadMultiple: function(ids, callback) {
39790           var that = this;
39791           var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
39792           Object.keys(groups).forEach(function(k3) {
39793             var type2 = k3 + "s";
39794             var osmIDs = groups[k3].map(function(id2) {
39795               return osmEntity.id.toOSM(id2);
39796             });
39797             var options = { skipSeen: false };
39798             utilArrayChunk(osmIDs, 150).forEach(function(arr) {
39799               that.loadFromAPI(
39800                 "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
39801                 function(err, entities) {
39802                   if (callback) callback(err, { data: entities });
39803                 },
39804                 options
39805               );
39806             });
39807           });
39808         },
39809         // Create, upload, and close a changeset
39810         // PUT /api/0.6/changeset/create
39811         // POST /api/0.6/changeset/#id/upload
39812         // PUT /api/0.6/changeset/#id/close
39813         putChangeset: function(changeset, changes, callback) {
39814           var cid = _connectionID;
39815           if (_changeset.inflight) {
39816             return callback({ message: "Changeset already inflight", status: -2 }, changeset);
39817           } else if (_changeset.open) {
39818             return createdChangeset.call(this, null, _changeset.open);
39819           } else {
39820             var options = {
39821               method: "PUT",
39822               path: "/api/0.6/changeset/create",
39823               headers: { "Content-Type": "text/xml" },
39824               content: JXON.stringify(changeset.asJXON())
39825             };
39826             _changeset.inflight = oauth.xhr(
39827               options,
39828               wrapcb(this, createdChangeset, cid)
39829             );
39830           }
39831           function createdChangeset(err, changesetID) {
39832             _changeset.inflight = null;
39833             if (err) {
39834               return callback(err, changeset);
39835             }
39836             _changeset.open = changesetID;
39837             changeset = changeset.update({ id: changesetID });
39838             var options2 = {
39839               method: "POST",
39840               path: "/api/0.6/changeset/" + changesetID + "/upload",
39841               headers: { "Content-Type": "text/xml" },
39842               content: JXON.stringify(changeset.osmChangeJXON(changes))
39843             };
39844             _changeset.inflight = oauth.xhr(
39845               options2,
39846               wrapcb(this, uploadedChangeset, cid)
39847             );
39848           }
39849           function uploadedChangeset(err) {
39850             _changeset.inflight = null;
39851             if (err) return callback(err, changeset);
39852             window.setTimeout(function() {
39853               callback(null, changeset);
39854             }, 2500);
39855             _changeset.open = null;
39856             if (this.getConnectionId() === cid) {
39857               oauth.xhr({
39858                 method: "PUT",
39859                 path: "/api/0.6/changeset/" + changeset.id + "/close",
39860                 headers: { "Content-Type": "text/xml" }
39861               }, function() {
39862                 return true;
39863               });
39864             }
39865           }
39866         },
39867         /** updates the tags on an existing unclosed changeset */
39868         // PUT /api/0.6/changeset/#id
39869         updateChangesetTags: (changeset) => {
39870           return oauth.fetch(`${oauth.options().apiUrl}/api/0.6/changeset/${changeset.id}`, {
39871             method: "PUT",
39872             headers: { "Content-Type": "text/xml" },
39873             body: JXON.stringify(changeset.asJXON())
39874           });
39875         },
39876         // Load multiple users in chunks
39877         // (note: callback may be called multiple times)
39878         // GET /api/0.6/users?users=#id1,#id2,...,#idn
39879         loadUsers: function(uids, callback) {
39880           var toLoad = [];
39881           var cached = [];
39882           utilArrayUniq(uids).forEach(function(uid) {
39883             if (_userCache.user[uid]) {
39884               delete _userCache.toLoad[uid];
39885               cached.push(_userCache.user[uid]);
39886             } else {
39887               toLoad.push(uid);
39888             }
39889           });
39890           if (cached.length || !this.authenticated()) {
39891             callback(void 0, cached);
39892             if (!this.authenticated()) return;
39893           }
39894           utilArrayChunk(toLoad, 150).forEach((function(arr) {
39895             oauth.xhr({
39896               method: "GET",
39897               path: "/api/0.6/users.json?users=" + arr.join()
39898             }, wrapcb(this, done, _connectionID));
39899           }).bind(this));
39900           function done(err, payload) {
39901             if (err) return callback(err);
39902             var options = { skipSeen: true };
39903             return parseUserJSON(payload, function(err2, results) {
39904               if (err2) return callback(err2);
39905               return callback(void 0, results);
39906             }, options);
39907           }
39908         },
39909         // Load a given user by id
39910         // GET /api/0.6/user/#id
39911         loadUser: function(uid, callback) {
39912           if (_userCache.user[uid] || !this.authenticated()) {
39913             delete _userCache.toLoad[uid];
39914             return callback(void 0, _userCache.user[uid]);
39915           }
39916           oauth.xhr({
39917             method: "GET",
39918             path: "/api/0.6/user/" + uid + ".json"
39919           }, wrapcb(this, done, _connectionID));
39920           function done(err, payload) {
39921             if (err) return callback(err);
39922             var options = { skipSeen: true };
39923             return parseUserJSON(payload, function(err2, results) {
39924               if (err2) return callback(err2);
39925               return callback(void 0, results[0]);
39926             }, options);
39927           }
39928         },
39929         // Load the details of the logged-in user
39930         // GET /api/0.6/user/details
39931         userDetails: function(callback) {
39932           if (_userDetails) {
39933             return callback(void 0, _userDetails);
39934           }
39935           oauth.xhr({
39936             method: "GET",
39937             path: "/api/0.6/user/details.json"
39938           }, wrapcb(this, done, _connectionID));
39939           function done(err, payload) {
39940             if (err) return callback(err);
39941             var options = { skipSeen: false };
39942             return parseUserJSON(payload, function(err2, results) {
39943               if (err2) return callback(err2);
39944               _userDetails = results[0];
39945               return callback(void 0, _userDetails);
39946             }, options);
39947           }
39948         },
39949         // Load previous changesets for the logged in user
39950         // GET /api/0.6/changesets?user=#id
39951         userChangesets: function(callback) {
39952           if (_userChangesets) {
39953             return callback(void 0, _userChangesets);
39954           }
39955           this.userDetails(
39956             wrapcb(this, gotDetails, _connectionID)
39957           );
39958           function gotDetails(err, user) {
39959             if (err) {
39960               return callback(err);
39961             }
39962             oauth.xhr({
39963               method: "GET",
39964               path: "/api/0.6/changesets?user=" + user.id
39965             }, wrapcb(this, done, _connectionID));
39966           }
39967           function done(err, xml) {
39968             if (err) {
39969               return callback(err);
39970             }
39971             _userChangesets = Array.prototype.map.call(
39972               xml.getElementsByTagName("changeset"),
39973               function(changeset) {
39974                 return { tags: getTags(changeset) };
39975               }
39976             ).filter(function(changeset) {
39977               var comment = changeset.tags.comment;
39978               return comment && comment !== "";
39979             });
39980             return callback(void 0, _userChangesets);
39981           }
39982         },
39983         // Fetch the status of the OSM API
39984         // GET /api/capabilities
39985         status: function(callback) {
39986           var url = apiUrlroot + "/api/capabilities";
39987           var errback = wrapcb(this, done, _connectionID);
39988           xml_default(url).then(function(data) {
39989             errback(null, data);
39990           }).catch(function(err) {
39991             errback(err.message);
39992           });
39993           function done(err, xml) {
39994             if (err) {
39995               return callback(err, null);
39996             }
39997             var elements = xml.getElementsByTagName("blacklist");
39998             var regexes = [];
39999             for (var i3 = 0; i3 < elements.length; i3++) {
40000               var regexString = elements[i3].getAttribute("regex");
40001               if (regexString) {
40002                 try {
40003                   var regex = new RegExp(regexString);
40004                   regexes.push(regex);
40005                 } catch {
40006                 }
40007               }
40008             }
40009             if (regexes.length) {
40010               _imageryBlocklists = regexes;
40011             }
40012             if (_rateLimitError) {
40013               return callback(_rateLimitError, "rateLimited");
40014             } else {
40015               var waynodes = xml.getElementsByTagName("waynodes");
40016               var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
40017               if (maxWayNodes && isFinite(maxWayNodes)) _maxWayNodes = maxWayNodes;
40018               var apiStatus = xml.getElementsByTagName("status");
40019               var val = apiStatus[0].getAttribute("api");
40020               return callback(void 0, val);
40021             }
40022           }
40023         },
40024         // Calls `status` and dispatches an `apiStatusChange` event if the returned
40025         // status differs from the cached status.
40026         reloadApiStatus: function() {
40027           if (!this.throttledReloadApiStatus) {
40028             var that = this;
40029             this.throttledReloadApiStatus = throttle_default(function() {
40030               that.status(function(err, status) {
40031                 if (status !== _cachedApiStatus) {
40032                   _cachedApiStatus = status;
40033                   dispatch9.call("apiStatusChange", that, err, status);
40034                 }
40035               });
40036             }, 500);
40037           }
40038           this.throttledReloadApiStatus();
40039         },
40040         // Returns the maximum number of nodes a single way can have
40041         maxWayNodes: function() {
40042           return _maxWayNodes;
40043         },
40044         // Load data (entities) from the API in tiles
40045         // GET /api/0.6/map?bbox=
40046         loadTiles: function(projection2, callback) {
40047           if (_off) return;
40048           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
40049           var hadRequests = hasInflightRequests(_tileCache);
40050           abortUnwantedRequests3(_tileCache, tiles);
40051           if (hadRequests && !hasInflightRequests(_tileCache)) {
40052             if (_rateLimitError) {
40053               _rateLimitError = void 0;
40054               dispatch9.call("change");
40055               this.reloadApiStatus();
40056             }
40057             dispatch9.call("loaded");
40058           }
40059           tiles.forEach(function(tile) {
40060             this.loadTile(tile, callback);
40061           }, this);
40062         },
40063         // Load a single data tile
40064         // GET /api/0.6/map?bbox=
40065         loadTile: function(tile, callback) {
40066           if (_off) return;
40067           if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
40068           if (!hasInflightRequests(_tileCache)) {
40069             dispatch9.call("loading");
40070           }
40071           var path = "/api/0.6/map.json?bbox=";
40072           var options = { skipSeen: true };
40073           _tileCache.inflight[tile.id] = this.loadFromAPI(
40074             path + tile.extent.toParam(),
40075             tileCallback.bind(this),
40076             options
40077           );
40078           function tileCallback(err, parsed) {
40079             if (!err) {
40080               delete _tileCache.inflight[tile.id];
40081               delete _tileCache.toLoad[tile.id];
40082               _tileCache.loaded[tile.id] = true;
40083               var bbox2 = tile.extent.bbox();
40084               bbox2.id = tile.id;
40085               _tileCache.rtree.insert(bbox2);
40086             } else {
40087               if (!_rateLimitError && err.status === 509 || err.status === 429) {
40088                 _rateLimitError = err;
40089                 dispatch9.call("change");
40090                 this.reloadApiStatus();
40091               }
40092               setTimeout(() => {
40093                 delete _tileCache.inflight[tile.id];
40094                 this.loadTile(tile, callback);
40095               }, 8e3);
40096             }
40097             if (callback) {
40098               callback(err, Object.assign({ data: parsed }, tile));
40099             }
40100             if (!hasInflightRequests(_tileCache)) {
40101               if (_rateLimitError) {
40102                 _rateLimitError = void 0;
40103                 dispatch9.call("change");
40104                 this.reloadApiStatus();
40105               }
40106               dispatch9.call("loaded");
40107             }
40108           }
40109         },
40110         isDataLoaded: function(loc) {
40111           var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
40112           return _tileCache.rtree.collides(bbox2);
40113         },
40114         // load the tile that covers the given `loc`
40115         loadTileAtLoc: function(loc, callback) {
40116           if (Object.keys(_tileCache.toLoad).length > 50) return;
40117           var k3 = geoZoomToScale(_tileZoom3 + 1);
40118           var offset = geoRawMercator().scale(k3)(loc);
40119           var projection2 = geoRawMercator().transform({ k: k3, x: -offset[0], y: -offset[1] });
40120           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
40121           tiles.forEach(function(tile) {
40122             if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
40123             _tileCache.toLoad[tile.id] = true;
40124             this.loadTile(tile, callback);
40125           }, this);
40126         },
40127         // Load notes from the API in tiles
40128         // GET /api/0.6/notes?bbox=
40129         loadNotes: function(projection2, noteOptions) {
40130           noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
40131           if (_off) return;
40132           var that = this;
40133           var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
40134           var throttleLoadUsers = throttle_default(function() {
40135             var uids = Object.keys(_userCache.toLoad);
40136             if (!uids.length) return;
40137             that.loadUsers(uids, function() {
40138             });
40139           }, 750);
40140           var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
40141           abortUnwantedRequests3(_noteCache, tiles);
40142           tiles.forEach(function(tile) {
40143             if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) return;
40144             var options = { skipSeen: false };
40145             _noteCache.inflight[tile.id] = that.loadFromAPI(
40146               path + tile.extent.toParam(),
40147               function(err) {
40148                 delete _noteCache.inflight[tile.id];
40149                 if (!err) {
40150                   _noteCache.loaded[tile.id] = true;
40151                 }
40152                 throttleLoadUsers();
40153                 dispatch9.call("loadedNotes");
40154               },
40155               options
40156             );
40157           });
40158         },
40159         // Create a note
40160         // POST /api/0.6/notes?params
40161         postNoteCreate: function(note, callback) {
40162           if (!this.authenticated()) {
40163             return callback({ message: "Not Authenticated", status: -3 }, note);
40164           }
40165           if (_noteCache.inflightPost[note.id]) {
40166             return callback({ message: "Note update already inflight", status: -2 }, note);
40167           }
40168           if (!note.loc[0] || !note.loc[1] || !note.newComment) return;
40169           var comment = note.newComment;
40170           if (note.newCategory && note.newCategory !== "None") {
40171             comment += " #" + note.newCategory;
40172           }
40173           var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
40174           _noteCache.inflightPost[note.id] = oauth.xhr({
40175             method: "POST",
40176             path
40177           }, wrapcb(this, done, _connectionID));
40178           function done(err, xml) {
40179             delete _noteCache.inflightPost[note.id];
40180             if (err) {
40181               return callback(err);
40182             }
40183             this.removeNote(note);
40184             var options = { skipSeen: false };
40185             return parseXML(xml, function(err2, results) {
40186               if (err2) {
40187                 return callback(err2);
40188               } else {
40189                 return callback(void 0, results[0]);
40190               }
40191             }, options);
40192           }
40193         },
40194         // Update a note
40195         // POST /api/0.6/notes/#id/comment?text=comment
40196         // POST /api/0.6/notes/#id/close?text=comment
40197         // POST /api/0.6/notes/#id/reopen?text=comment
40198         postNoteUpdate: function(note, newStatus, callback) {
40199           if (!this.authenticated()) {
40200             return callback({ message: "Not Authenticated", status: -3 }, note);
40201           }
40202           if (_noteCache.inflightPost[note.id]) {
40203             return callback({ message: "Note update already inflight", status: -2 }, note);
40204           }
40205           var action;
40206           if (note.status !== "closed" && newStatus === "closed") {
40207             action = "close";
40208           } else if (note.status !== "open" && newStatus === "open") {
40209             action = "reopen";
40210           } else {
40211             action = "comment";
40212             if (!note.newComment) return;
40213           }
40214           var path = "/api/0.6/notes/" + note.id + "/" + action;
40215           if (note.newComment) {
40216             path += "?" + utilQsString({ text: note.newComment });
40217           }
40218           _noteCache.inflightPost[note.id] = oauth.xhr({
40219             method: "POST",
40220             path
40221           }, wrapcb(this, done, _connectionID));
40222           function done(err, xml) {
40223             delete _noteCache.inflightPost[note.id];
40224             if (err) {
40225               return callback(err);
40226             }
40227             this.removeNote(note);
40228             if (action === "close") {
40229               _noteCache.closed[note.id] = true;
40230             } else if (action === "reopen") {
40231               delete _noteCache.closed[note.id];
40232             }
40233             var options = { skipSeen: false };
40234             return parseXML(xml, function(err2, results) {
40235               if (err2) {
40236                 return callback(err2);
40237               } else {
40238                 return callback(void 0, results[0]);
40239               }
40240             }, options);
40241           }
40242         },
40243         /* connection options for source switcher (optional) */
40244         apiConnections: function(val) {
40245           if (!arguments.length) return _apiConnections;
40246           _apiConnections = val;
40247           return this;
40248         },
40249         switch: function(newOptions) {
40250           urlroot = newOptions.url;
40251           apiUrlroot = newOptions.apiUrl || urlroot;
40252           if (newOptions.url && !newOptions.apiUrl) {
40253             newOptions = {
40254               ...newOptions,
40255               apiUrl: newOptions.url
40256             };
40257           }
40258           const oldOptions = utilObjectOmit(oauth.options(), "access_token");
40259           oauth.options({ ...oldOptions, ...newOptions });
40260           this.reset();
40261           this.userChangesets(function() {
40262           });
40263           dispatch9.call("change");
40264           return this;
40265         },
40266         toggle: function(val) {
40267           _off = !val;
40268           return this;
40269         },
40270         isChangesetInflight: function() {
40271           return !!_changeset.inflight;
40272         },
40273         // get/set cached data
40274         // This is used to save/restore the state when entering/exiting the walkthrough
40275         // Also used for testing purposes.
40276         caches: function(obj) {
40277           function cloneCache(source) {
40278             var target = {};
40279             Object.keys(source).forEach(function(k3) {
40280               if (k3 === "rtree") {
40281                 target.rtree = new RBush().fromJSON(source.rtree.toJSON());
40282               } else if (k3 === "note") {
40283                 target.note = {};
40284                 Object.keys(source.note).forEach(function(id2) {
40285                   target.note[id2] = osmNote(source.note[id2]);
40286                 });
40287               } else {
40288                 target[k3] = JSON.parse(JSON.stringify(source[k3]));
40289               }
40290             });
40291             return target;
40292           }
40293           if (!arguments.length) {
40294             return {
40295               tile: cloneCache(_tileCache),
40296               note: cloneCache(_noteCache),
40297               user: cloneCache(_userCache)
40298             };
40299           }
40300           if (obj === "get") {
40301             return {
40302               tile: _tileCache,
40303               note: _noteCache,
40304               user: _userCache
40305             };
40306           }
40307           if (obj.tile) {
40308             _tileCache = obj.tile;
40309             _tileCache.inflight = {};
40310           }
40311           if (obj.note) {
40312             _noteCache = obj.note;
40313             _noteCache.inflight = {};
40314             _noteCache.inflightPost = {};
40315           }
40316           if (obj.user) {
40317             _userCache = obj.user;
40318           }
40319           return this;
40320         },
40321         logout: function() {
40322           _userChangesets = void 0;
40323           _userDetails = void 0;
40324           oauth.logout();
40325           dispatch9.call("change");
40326           return this;
40327         },
40328         authenticated: function() {
40329           return oauth.authenticated();
40330         },
40331         /** @param {import('osm-auth').LoginOptions} options */
40332         authenticate: function(callback, options) {
40333           var that = this;
40334           var cid = _connectionID;
40335           _userChangesets = void 0;
40336           _userDetails = void 0;
40337           function done(err, res) {
40338             if (err) {
40339               if (callback) callback(err);
40340               return;
40341             }
40342             if (that.getConnectionId() !== cid) {
40343               if (callback) callback({ message: "Connection Switched", status: -1 });
40344               return;
40345             }
40346             _rateLimitError = void 0;
40347             dispatch9.call("change");
40348             if (callback) callback(err, res);
40349             that.userChangesets(function() {
40350             });
40351           }
40352           oauth.options({
40353             ...oauth.options(),
40354             locale: _mainLocalizer.localeCode()
40355           });
40356           oauth.authenticate(done, options);
40357         },
40358         imageryBlocklists: function() {
40359           return _imageryBlocklists;
40360         },
40361         tileZoom: function(val) {
40362           if (!arguments.length) return _tileZoom3;
40363           _tileZoom3 = val;
40364           return this;
40365         },
40366         // get all cached notes covering the viewport
40367         notes: function(projection2) {
40368           var viewport = projection2.clipExtent();
40369           var min3 = [viewport[0][0], viewport[1][1]];
40370           var max3 = [viewport[1][0], viewport[0][1]];
40371           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
40372           return _noteCache.rtree.search(bbox2).map(function(d2) {
40373             return d2.data;
40374           });
40375         },
40376         // get a single note from the cache
40377         getNote: function(id2) {
40378           return _noteCache.note[id2];
40379         },
40380         // remove a single note from the cache
40381         removeNote: function(note) {
40382           if (!(note instanceof osmNote) || !note.id) return;
40383           delete _noteCache.note[note.id];
40384           updateRtree3(encodeNoteRtree(note), false);
40385         },
40386         // replace a single note in the cache
40387         replaceNote: function(note) {
40388           if (!(note instanceof osmNote) || !note.id) return;
40389           _noteCache.note[note.id] = note;
40390           updateRtree3(encodeNoteRtree(note), true);
40391           return note;
40392         },
40393         // Get an array of note IDs closed during this session.
40394         // Used to populate `closed:note` changeset tag
40395         getClosedIDs: function() {
40396           return Object.keys(_noteCache.closed).sort();
40397         }
40398       };
40399     }
40400   });
40401
40402   // modules/services/osm_wikibase.js
40403   var osm_wikibase_exports = {};
40404   __export(osm_wikibase_exports, {
40405     default: () => osm_wikibase_default
40406   });
40407   function request(url, callback) {
40408     if (_inflight2[url]) return;
40409     var controller = new AbortController();
40410     _inflight2[url] = controller;
40411     json_default(url, { signal: controller.signal }).then(function(result) {
40412       delete _inflight2[url];
40413       if (callback) callback(null, result);
40414     }).catch(function(err) {
40415       delete _inflight2[url];
40416       if (err.name === "AbortError") return;
40417       if (callback) callback(err.message);
40418     });
40419   }
40420   var apibase3, _inflight2, _wikibaseCache, _localeIDs, debouncedRequest, osm_wikibase_default;
40421   var init_osm_wikibase = __esm({
40422     "modules/services/osm_wikibase.js"() {
40423       "use strict";
40424       init_debounce();
40425       init_src18();
40426       init_localizer();
40427       init_util();
40428       apibase3 = "https://wiki.openstreetmap.org/w/api.php";
40429       _inflight2 = {};
40430       _wikibaseCache = {};
40431       _localeIDs = { en: false };
40432       debouncedRequest = debounce_default(request, 500, { leading: false });
40433       osm_wikibase_default = {
40434         init: function() {
40435           _inflight2 = {};
40436           _wikibaseCache = {};
40437           _localeIDs = {};
40438         },
40439         reset: function() {
40440           Object.values(_inflight2).forEach(function(controller) {
40441             controller.abort();
40442           });
40443           _inflight2 = {};
40444         },
40445         /**
40446          * Get the best value for the property, or undefined if not found
40447          * @param entity object from wikibase
40448          * @param property string e.g. 'P4' for image
40449          * @param langCode string e.g. 'fr' for French
40450          */
40451         claimToValue: function(entity, property, langCode) {
40452           if (!entity.claims[property]) return void 0;
40453           var locale3 = _localeIDs[langCode];
40454           var preferredPick, localePick;
40455           entity.claims[property].forEach(function(stmt) {
40456             if (!preferredPick && stmt.rank === "preferred") {
40457               preferredPick = stmt;
40458             }
40459             if (locale3 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale3) {
40460               localePick = stmt;
40461             }
40462           });
40463           var result = localePick || preferredPick;
40464           if (result) {
40465             var datavalue = result.mainsnak.datavalue;
40466             return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
40467           } else {
40468             return void 0;
40469           }
40470         },
40471         /**
40472          * Convert monolingual property into a key-value object (language -> value)
40473          * @param entity object from wikibase
40474          * @param property string e.g. 'P31' for monolingual wiki page title
40475          */
40476         monolingualClaimToValueObj: function(entity, property) {
40477           if (!entity || !entity.claims[property]) return void 0;
40478           return entity.claims[property].reduce(function(acc, obj) {
40479             var value = obj.mainsnak.datavalue.value;
40480             acc[value.language] = value.text;
40481             return acc;
40482           }, {});
40483         },
40484         toSitelink: function(key, value) {
40485           var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
40486           return result.replace(/_/g, " ").trim();
40487         },
40488         /**
40489          * Converts text like `tag:...=...` into clickable links
40490          *
40491          * @param {string} unsafeText - unsanitized text
40492          */
40493         linkifyWikiText(unsafeText) {
40494           return (selection2) => {
40495             const segments = unsafeText.split(/(key|tag):([\w-]+)(=([\w-]+))?/g);
40496             for (let i3 = 0; i3 < segments.length; i3 += 5) {
40497               const [plainText, , key, , value] = segments.slice(i3);
40498               if (plainText) {
40499                 selection2.append("span").text(plainText);
40500               }
40501               if (key) {
40502                 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 || "*"}`);
40503               }
40504             }
40505           };
40506         },
40507         //
40508         // Pass params object of the form:
40509         // {
40510         //   key: 'string',
40511         //   value: 'string',
40512         //   langCode: 'string'
40513         // }
40514         //
40515         getEntity: function(params, callback) {
40516           var doRequest = params.debounce ? debouncedRequest : request;
40517           var that = this;
40518           var titles = [];
40519           var result = {};
40520           var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
40521           var keySitelink = params.key ? this.toSitelink(params.key) : false;
40522           var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
40523           const localeSitelinks = [];
40524           if (params.langCodes) {
40525             params.langCodes.forEach(function(langCode) {
40526               if (_localeIDs[langCode] === void 0) {
40527                 let localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
40528                 titles.push(localeSitelink);
40529                 that.addLocale(langCode, false);
40530               }
40531             });
40532           }
40533           if (rtypeSitelink) {
40534             if (_wikibaseCache[rtypeSitelink]) {
40535               result.rtype = _wikibaseCache[rtypeSitelink];
40536             } else {
40537               titles.push(rtypeSitelink);
40538             }
40539           }
40540           if (keySitelink) {
40541             if (_wikibaseCache[keySitelink]) {
40542               result.key = _wikibaseCache[keySitelink];
40543             } else {
40544               titles.push(keySitelink);
40545             }
40546           }
40547           if (tagSitelink) {
40548             if (_wikibaseCache[tagSitelink]) {
40549               result.tag = _wikibaseCache[tagSitelink];
40550             } else {
40551               titles.push(tagSitelink);
40552             }
40553           }
40554           if (!titles.length) {
40555             return callback(null, result);
40556           }
40557           var obj = {
40558             action: "wbgetentities",
40559             sites: "wiki",
40560             titles: titles.join("|"),
40561             languages: params.langCodes.join("|"),
40562             languagefallback: 1,
40563             origin: "*",
40564             format: "json"
40565             // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
40566             // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
40567             // formatversion: 2,
40568           };
40569           var url = apibase3 + "?" + utilQsString(obj);
40570           doRequest(url, function(err, d2) {
40571             if (err) {
40572               callback(err);
40573             } else if (!d2.success || d2.error) {
40574               callback(d2.error.messages.map(function(v3) {
40575                 return v3.html["*"];
40576               }).join("<br>"));
40577             } else {
40578               Object.values(d2.entities).forEach(function(res) {
40579                 if (res.missing !== "") {
40580                   var title = res.sitelinks.wiki.title;
40581                   if (title === rtypeSitelink) {
40582                     _wikibaseCache[rtypeSitelink] = res;
40583                     result.rtype = res;
40584                   } else if (title === keySitelink) {
40585                     _wikibaseCache[keySitelink] = res;
40586                     result.key = res;
40587                   } else if (title === tagSitelink) {
40588                     _wikibaseCache[tagSitelink] = res;
40589                     result.tag = res;
40590                   } else if (localeSitelinks.includes(title)) {
40591                     const langCode = title.replace(/ /g, "_").replace(/^Locale:/, "");
40592                     that.addLocale(langCode, res.id);
40593                   } else {
40594                     console.log("Unexpected title " + title);
40595                   }
40596                 }
40597               });
40598               callback(null, result);
40599             }
40600           });
40601         },
40602         //
40603         // Pass params object of the form:
40604         // {
40605         //   key: 'string',     // required
40606         //   value: 'string'    // optional
40607         // }
40608         //
40609         // Get an result object used to display tag documentation
40610         // {
40611         //   title:        'string',
40612         //   description:  'string',
40613         //   editURL:      'string',
40614         //   imageURL:     'string',
40615         //   wiki:         { title: 'string', text: 'string', url: 'string' }
40616         // }
40617         //
40618         getDocs: function(params, callback) {
40619           var that = this;
40620           var langCodes = _mainLocalizer.localeCodes().map(function(code) {
40621             return code.toLowerCase();
40622           });
40623           params.langCodes = langCodes;
40624           this.getEntity(params, function(err, data) {
40625             if (err) {
40626               callback(err);
40627               return;
40628             }
40629             var entity = data.rtype || data.tag || data.key;
40630             if (!entity) {
40631               callback("No entity");
40632               return;
40633             }
40634             var i3;
40635             var description;
40636             for (i3 in langCodes) {
40637               let code2 = langCodes[i3];
40638               if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
40639                 description = entity.descriptions[code2];
40640                 break;
40641               }
40642             }
40643             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
40644             var result = {
40645               title: entity.title,
40646               description: that.linkifyWikiText((description == null ? void 0 : description.value) || ""),
40647               descriptionLocaleCode: description ? description.language : "",
40648               editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
40649             };
40650             if (entity.claims) {
40651               var imageroot;
40652               var image = that.claimToValue(entity, "P4", langCodes[0]);
40653               if (image) {
40654                 imageroot = "https://commons.wikimedia.org/w/index.php";
40655               } else {
40656                 image = that.claimToValue(entity, "P28", langCodes[0]);
40657                 if (image) {
40658                   imageroot = "https://wiki.openstreetmap.org/w/index.php";
40659                 }
40660               }
40661               if (imageroot && image) {
40662                 result.imageURL = imageroot + "?" + utilQsString({
40663                   title: "Special:Redirect/file/" + image,
40664                   width: 400
40665                 });
40666               }
40667             }
40668             var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
40669             var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
40670             var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
40671             var wikis = [rtypeWiki, tagWiki, keyWiki];
40672             for (i3 in wikis) {
40673               var wiki = wikis[i3];
40674               for (var j3 in langCodes) {
40675                 var code = langCodes[j3];
40676                 var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
40677                 var info = getWikiInfo(wiki, code, referenceId);
40678                 if (info) {
40679                   result.wiki = info;
40680                   break;
40681                 }
40682               }
40683               if (result.wiki) break;
40684             }
40685             callback(null, result);
40686             function getWikiInfo(wiki2, langCode, tKey) {
40687               if (wiki2 && wiki2[langCode]) {
40688                 return {
40689                   title: wiki2[langCode],
40690                   text: tKey,
40691                   url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
40692                 };
40693               }
40694             }
40695           });
40696         },
40697         addLocale: function(langCode, qid) {
40698           _localeIDs[langCode] = qid;
40699         },
40700         apibase: function(val) {
40701           if (!arguments.length) return apibase3;
40702           apibase3 = val;
40703           return this;
40704         }
40705       };
40706     }
40707   });
40708
40709   // modules/services/streetside.js
40710   var streetside_exports = {};
40711   __export(streetside_exports, {
40712     default: () => streetside_default
40713   });
40714   function abortRequest5(i3) {
40715     i3.abort();
40716   }
40717   function localeTimestamp2(s2) {
40718     if (!s2) return null;
40719     const options = { day: "numeric", month: "short", year: "numeric" };
40720     const d2 = new Date(s2);
40721     if (isNaN(d2.getTime())) return null;
40722     return d2.toLocaleString(_mainLocalizer.localeCode(), options);
40723   }
40724   function loadTiles3(which, url, projection2, margin) {
40725     const tiles = tiler6.margin(margin).getTiles(projection2);
40726     const cache = _ssCache[which];
40727     Object.keys(cache.inflight).forEach((k3) => {
40728       const wanted = tiles.find((tile) => k3.indexOf(tile.id + ",") === 0);
40729       if (!wanted) {
40730         abortRequest5(cache.inflight[k3]);
40731         delete cache.inflight[k3];
40732       }
40733     });
40734     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
40735   }
40736   function loadNextTilePage2(which, url, tile) {
40737     const cache = _ssCache[which];
40738     const nextPage = cache.nextPage[tile.id] || 0;
40739     const id2 = tile.id + "," + String(nextPage);
40740     if (cache.loaded[id2] || cache.inflight[id2]) return;
40741     cache.inflight[id2] = getBubbles(url, tile, (response) => {
40742       cache.loaded[id2] = true;
40743       delete cache.inflight[id2];
40744       if (!response) return;
40745       if (response.resourceSets[0].resources.length === maxResults2) {
40746         const split = tile.extent.split();
40747         loadNextTilePage2(which, url, { id: tile.id + ",a", extent: split[0] });
40748         loadNextTilePage2(which, url, { id: tile.id + ",b", extent: split[1] });
40749         loadNextTilePage2(which, url, { id: tile.id + ",c", extent: split[2] });
40750         loadNextTilePage2(which, url, { id: tile.id + ",d", extent: split[3] });
40751       }
40752       const features = response.resourceSets[0].resources.map((bubble) => {
40753         const bubbleId = bubble.imageUrl;
40754         if (cache.points[bubbleId]) return null;
40755         const loc = [
40756           bubble.lon || bubble.longitude,
40757           bubble.lat || bubble.latitude
40758         ];
40759         const d2 = {
40760           service: "photo",
40761           loc,
40762           key: bubbleId,
40763           imageUrl: bubble.imageUrl.replace("{subdomain}", bubble.imageUrlSubdomains[0]),
40764           ca: bubble.he || bubble.heading,
40765           captured_at: bubble.vintageEnd,
40766           captured_by: "microsoft",
40767           pano: true,
40768           sequenceKey: null
40769         };
40770         cache.points[bubbleId] = d2;
40771         return {
40772           minX: loc[0],
40773           minY: loc[1],
40774           maxX: loc[0],
40775           maxY: loc[1],
40776           data: d2
40777         };
40778       }).filter(Boolean);
40779       cache.rtree.load(features);
40780       if (which === "bubbles") {
40781         dispatch10.call("loadedImages");
40782       }
40783     });
40784   }
40785   function getBubbles(url, tile, callback) {
40786     let rect = tile.extent.rectangle();
40787     let urlForRequest = url.replace("{key}", bubbleAppKey).replace("{bbox}", [rect[1], rect[0], rect[3], rect[2]].join(",")).replace("{count}", maxResults2);
40788     const controller = new AbortController();
40789     fetch(urlForRequest, { signal: controller.signal }).then(function(response) {
40790       if (!response.ok) {
40791         throw new Error(response.status + " " + response.statusText);
40792       }
40793       return response.json();
40794     }).then(function(result) {
40795       if (!result) {
40796         callback(null);
40797       }
40798       return callback(result || []);
40799     }).catch(function(err) {
40800       if (err.name === "AbortError") {
40801       } else {
40802         throw new Error(err);
40803       }
40804     });
40805     return controller;
40806   }
40807   function partitionViewport4(projection2) {
40808     let z3 = geoScaleToZoom(projection2.scale());
40809     let z22 = Math.ceil(z3 * 2) / 2 + 2.5;
40810     let tiler8 = utilTiler().zoomExtent([z22, z22]);
40811     return tiler8.getTiles(projection2).map((tile) => tile.extent);
40812   }
40813   function searchLimited4(limit, projection2, rtree) {
40814     limit = limit || 5;
40815     return partitionViewport4(projection2).reduce((result, extent) => {
40816       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
40817       return found.length ? result.concat(found) : result;
40818     }, []);
40819   }
40820   function loadImage2(imgInfo) {
40821     return new Promise((resolve) => {
40822       let img = new Image();
40823       img.onload = () => {
40824         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
40825         let ctx = canvas.getContext("2d");
40826         ctx.drawImage(img, imgInfo.x, imgInfo.y);
40827         resolve({ imgInfo, status: "ok" });
40828       };
40829       img.onerror = () => {
40830         resolve({ data: imgInfo, status: "error" });
40831       };
40832       img.setAttribute("crossorigin", "");
40833       img.src = imgInfo.url;
40834     });
40835   }
40836   function loadCanvas(imageGroup) {
40837     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
40838       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
40839       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
40840       let face = data[0].imgInfo.face;
40841       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
40842       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
40843     });
40844   }
40845   function loadFaces(faceGroup) {
40846     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
40847       return { status: "loadFaces done" };
40848     });
40849   }
40850   function setupCanvas(selection2, reset) {
40851     if (reset) {
40852       selection2.selectAll("#ideditor-stitcher-canvases").remove();
40853     }
40854     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);
40855   }
40856   function qkToXY(qk) {
40857     let x2 = 0;
40858     let y2 = 0;
40859     let scale = 256;
40860     for (let i3 = qk.length; i3 > 0; i3--) {
40861       const key = qk[i3 - 1];
40862       x2 += +(key === "1" || key === "3") * scale;
40863       y2 += +(key === "2" || key === "3") * scale;
40864       scale *= 2;
40865     }
40866     return [x2, y2];
40867   }
40868   function getQuadKeys() {
40869     let dim = _resolution / 256;
40870     let quadKeys;
40871     if (dim === 16) {
40872       quadKeys = [
40873         "0000",
40874         "0001",
40875         "0010",
40876         "0011",
40877         "0100",
40878         "0101",
40879         "0110",
40880         "0111",
40881         "1000",
40882         "1001",
40883         "1010",
40884         "1011",
40885         "1100",
40886         "1101",
40887         "1110",
40888         "1111",
40889         "0002",
40890         "0003",
40891         "0012",
40892         "0013",
40893         "0102",
40894         "0103",
40895         "0112",
40896         "0113",
40897         "1002",
40898         "1003",
40899         "1012",
40900         "1013",
40901         "1102",
40902         "1103",
40903         "1112",
40904         "1113",
40905         "0020",
40906         "0021",
40907         "0030",
40908         "0031",
40909         "0120",
40910         "0121",
40911         "0130",
40912         "0131",
40913         "1020",
40914         "1021",
40915         "1030",
40916         "1031",
40917         "1120",
40918         "1121",
40919         "1130",
40920         "1131",
40921         "0022",
40922         "0023",
40923         "0032",
40924         "0033",
40925         "0122",
40926         "0123",
40927         "0132",
40928         "0133",
40929         "1022",
40930         "1023",
40931         "1032",
40932         "1033",
40933         "1122",
40934         "1123",
40935         "1132",
40936         "1133",
40937         "0200",
40938         "0201",
40939         "0210",
40940         "0211",
40941         "0300",
40942         "0301",
40943         "0310",
40944         "0311",
40945         "1200",
40946         "1201",
40947         "1210",
40948         "1211",
40949         "1300",
40950         "1301",
40951         "1310",
40952         "1311",
40953         "0202",
40954         "0203",
40955         "0212",
40956         "0213",
40957         "0302",
40958         "0303",
40959         "0312",
40960         "0313",
40961         "1202",
40962         "1203",
40963         "1212",
40964         "1213",
40965         "1302",
40966         "1303",
40967         "1312",
40968         "1313",
40969         "0220",
40970         "0221",
40971         "0230",
40972         "0231",
40973         "0320",
40974         "0321",
40975         "0330",
40976         "0331",
40977         "1220",
40978         "1221",
40979         "1230",
40980         "1231",
40981         "1320",
40982         "1321",
40983         "1330",
40984         "1331",
40985         "0222",
40986         "0223",
40987         "0232",
40988         "0233",
40989         "0322",
40990         "0323",
40991         "0332",
40992         "0333",
40993         "1222",
40994         "1223",
40995         "1232",
40996         "1233",
40997         "1322",
40998         "1323",
40999         "1332",
41000         "1333",
41001         "2000",
41002         "2001",
41003         "2010",
41004         "2011",
41005         "2100",
41006         "2101",
41007         "2110",
41008         "2111",
41009         "3000",
41010         "3001",
41011         "3010",
41012         "3011",
41013         "3100",
41014         "3101",
41015         "3110",
41016         "3111",
41017         "2002",
41018         "2003",
41019         "2012",
41020         "2013",
41021         "2102",
41022         "2103",
41023         "2112",
41024         "2113",
41025         "3002",
41026         "3003",
41027         "3012",
41028         "3013",
41029         "3102",
41030         "3103",
41031         "3112",
41032         "3113",
41033         "2020",
41034         "2021",
41035         "2030",
41036         "2031",
41037         "2120",
41038         "2121",
41039         "2130",
41040         "2131",
41041         "3020",
41042         "3021",
41043         "3030",
41044         "3031",
41045         "3120",
41046         "3121",
41047         "3130",
41048         "3131",
41049         "2022",
41050         "2023",
41051         "2032",
41052         "2033",
41053         "2122",
41054         "2123",
41055         "2132",
41056         "2133",
41057         "3022",
41058         "3023",
41059         "3032",
41060         "3033",
41061         "3122",
41062         "3123",
41063         "3132",
41064         "3133",
41065         "2200",
41066         "2201",
41067         "2210",
41068         "2211",
41069         "2300",
41070         "2301",
41071         "2310",
41072         "2311",
41073         "3200",
41074         "3201",
41075         "3210",
41076         "3211",
41077         "3300",
41078         "3301",
41079         "3310",
41080         "3311",
41081         "2202",
41082         "2203",
41083         "2212",
41084         "2213",
41085         "2302",
41086         "2303",
41087         "2312",
41088         "2313",
41089         "3202",
41090         "3203",
41091         "3212",
41092         "3213",
41093         "3302",
41094         "3303",
41095         "3312",
41096         "3313",
41097         "2220",
41098         "2221",
41099         "2230",
41100         "2231",
41101         "2320",
41102         "2321",
41103         "2330",
41104         "2331",
41105         "3220",
41106         "3221",
41107         "3230",
41108         "3231",
41109         "3320",
41110         "3321",
41111         "3330",
41112         "3331",
41113         "2222",
41114         "2223",
41115         "2232",
41116         "2233",
41117         "2322",
41118         "2323",
41119         "2332",
41120         "2333",
41121         "3222",
41122         "3223",
41123         "3232",
41124         "3233",
41125         "3322",
41126         "3323",
41127         "3332",
41128         "3333"
41129       ];
41130     } else if (dim === 8) {
41131       quadKeys = [
41132         "000",
41133         "001",
41134         "010",
41135         "011",
41136         "100",
41137         "101",
41138         "110",
41139         "111",
41140         "002",
41141         "003",
41142         "012",
41143         "013",
41144         "102",
41145         "103",
41146         "112",
41147         "113",
41148         "020",
41149         "021",
41150         "030",
41151         "031",
41152         "120",
41153         "121",
41154         "130",
41155         "131",
41156         "022",
41157         "023",
41158         "032",
41159         "033",
41160         "122",
41161         "123",
41162         "132",
41163         "133",
41164         "200",
41165         "201",
41166         "210",
41167         "211",
41168         "300",
41169         "301",
41170         "310",
41171         "311",
41172         "202",
41173         "203",
41174         "212",
41175         "213",
41176         "302",
41177         "303",
41178         "312",
41179         "313",
41180         "220",
41181         "221",
41182         "230",
41183         "231",
41184         "320",
41185         "321",
41186         "330",
41187         "331",
41188         "222",
41189         "223",
41190         "232",
41191         "233",
41192         "322",
41193         "323",
41194         "332",
41195         "333"
41196       ];
41197     } else if (dim === 4) {
41198       quadKeys = [
41199         "00",
41200         "01",
41201         "10",
41202         "11",
41203         "02",
41204         "03",
41205         "12",
41206         "13",
41207         "20",
41208         "21",
41209         "30",
41210         "31",
41211         "22",
41212         "23",
41213         "32",
41214         "33"
41215       ];
41216     } else {
41217       quadKeys = [
41218         "0",
41219         "1",
41220         "2",
41221         "3"
41222       ];
41223     }
41224     return quadKeys;
41225   }
41226   var streetsideApi, maxResults2, bubbleAppKey, pannellumViewerCSS2, pannellumViewerJS2, tileZoom3, tiler6, dispatch10, minHfov, maxHfov, defaultHfov, _hires, _resolution, _currScene, _ssCache, _pannellumViewer2, _sceneOptions, _loadViewerPromise4, streetside_default;
41227   var init_streetside = __esm({
41228     "modules/services/streetside.js"() {
41229       "use strict";
41230       init_src4();
41231       init_src9();
41232       init_src5();
41233       init_rbush();
41234       init_localizer();
41235       init_geo2();
41236       init_util();
41237       init_services();
41238       streetsideApi = "https://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside?mapArea={bbox}&key={key}&count={count}&uriScheme=https";
41239       maxResults2 = 500;
41240       bubbleAppKey = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
41241       pannellumViewerCSS2 = "pannellum/pannellum.css";
41242       pannellumViewerJS2 = "pannellum/pannellum.js";
41243       tileZoom3 = 16.5;
41244       tiler6 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
41245       dispatch10 = dispatch_default("loadedImages", "viewerChanged");
41246       minHfov = 10;
41247       maxHfov = 90;
41248       defaultHfov = 45;
41249       _hires = false;
41250       _resolution = 512;
41251       _currScene = 0;
41252       _sceneOptions = {
41253         showFullscreenCtrl: false,
41254         autoLoad: true,
41255         compass: true,
41256         yaw: 0,
41257         minHfov,
41258         maxHfov,
41259         hfov: defaultHfov,
41260         type: "cubemap",
41261         cubeMap: []
41262       };
41263       streetside_default = {
41264         /**
41265          * init() initialize streetside.
41266          */
41267         init: function() {
41268           if (!_ssCache) {
41269             this.reset();
41270           }
41271           this.event = utilRebind(this, dispatch10, "on");
41272         },
41273         /**
41274          * reset() reset the cache.
41275          */
41276         reset: function() {
41277           if (_ssCache) {
41278             Object.values(_ssCache.bubbles.inflight).forEach(abortRequest5);
41279           }
41280           _ssCache = {
41281             bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), points: {} },
41282             sequences: {}
41283           };
41284         },
41285         /**
41286          * bubbles()
41287          */
41288         bubbles: function(projection2) {
41289           const limit = 5;
41290           return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
41291         },
41292         cachedImage: function(imageKey) {
41293           return _ssCache.bubbles.points[imageKey];
41294         },
41295         sequences: function(projection2) {
41296           const viewport = projection2.clipExtent();
41297           const min3 = [viewport[0][0], viewport[1][1]];
41298           const max3 = [viewport[1][0], viewport[0][1]];
41299           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
41300           let seen = {};
41301           let results = [];
41302           _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
41303             const key = d2.data.sequenceKey;
41304             if (key && !seen[key]) {
41305               seen[key] = true;
41306               results.push(_ssCache.sequences[key].geojson);
41307             }
41308           });
41309           return results;
41310         },
41311         /**
41312          * loadBubbles()
41313          */
41314         loadBubbles: function(projection2, margin) {
41315           if (margin === void 0) margin = 2;
41316           loadTiles3("bubbles", streetsideApi, projection2, margin);
41317         },
41318         viewer: function() {
41319           return _pannellumViewer2;
41320         },
41321         initViewer: function() {
41322           if (!window.pannellum) return;
41323           if (_pannellumViewer2) return;
41324           _currScene += 1;
41325           const sceneID = _currScene.toString();
41326           const options = {
41327             "default": { firstScene: sceneID },
41328             scenes: {}
41329           };
41330           options.scenes[sceneID] = _sceneOptions;
41331           _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options);
41332         },
41333         ensureViewerLoaded: function(context) {
41334           if (_loadViewerPromise4) return _loadViewerPromise4;
41335           let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
41336           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
41337           let that = this;
41338           let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
41339           wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
41340             select_default2(window).on(pointerPrefix + "move.streetside", () => {
41341               dispatch10.call("viewerChanged");
41342             }, true);
41343           }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
41344             select_default2(window).on(pointerPrefix + "move.streetside", null);
41345             let t2 = timer((elapsed) => {
41346               dispatch10.call("viewerChanged");
41347               if (elapsed > 2e3) {
41348                 t2.stop();
41349               }
41350             });
41351           }).append("div").attr("class", "photo-attribution fillD");
41352           let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
41353           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
41354           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
41355           wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
41356           context.ui().photoviewer.on("resize.streetside", () => {
41357             if (_pannellumViewer2) {
41358               _pannellumViewer2.resize();
41359             }
41360           });
41361           _loadViewerPromise4 = new Promise((resolve, reject) => {
41362             let loadedCount = 0;
41363             function loaded() {
41364               loadedCount += 1;
41365               if (loadedCount === 2) resolve();
41366             }
41367             const head = select_default2("head");
41368             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() {
41369               reject();
41370             });
41371             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() {
41372               reject();
41373             });
41374           }).catch(function() {
41375             _loadViewerPromise4 = null;
41376           });
41377           return _loadViewerPromise4;
41378           function step(stepBy) {
41379             return () => {
41380               let viewer = context.container().select(".photoviewer");
41381               let selected = viewer.empty() ? void 0 : viewer.datum();
41382               if (!selected) return;
41383               let nextID = stepBy === 1 ? selected.ne : selected.pr;
41384               let yaw = _pannellumViewer2.getYaw();
41385               let ca = selected.ca + yaw;
41386               let origin = selected.loc;
41387               const meters = 35;
41388               let p1 = [
41389                 origin[0] + geoMetersToLon(meters / 5, origin[1]),
41390                 origin[1]
41391               ];
41392               let p2 = [
41393                 origin[0] + geoMetersToLon(meters / 2, origin[1]),
41394                 origin[1] + geoMetersToLat(meters)
41395               ];
41396               let p3 = [
41397                 origin[0] - geoMetersToLon(meters / 2, origin[1]),
41398                 origin[1] + geoMetersToLat(meters)
41399               ];
41400               let p4 = [
41401                 origin[0] - geoMetersToLon(meters / 5, origin[1]),
41402                 origin[1]
41403               ];
41404               let poly = [p1, p2, p3, p4, p1];
41405               let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
41406               poly = geoRotate(poly, -angle2, origin);
41407               let extent = poly.reduce((extent2, point) => {
41408                 return extent2.extend(geoExtent(point));
41409               }, geoExtent());
41410               let minDist = Infinity;
41411               _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
41412                 if (d2.data.key === selected.key) return;
41413                 if (!geoPointInPolygon(d2.data.loc, poly)) return;
41414                 let dist = geoVecLength(d2.data.loc, selected.loc);
41415                 let theta = selected.ca - d2.data.ca;
41416                 let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
41417                 if (minTheta > 20) {
41418                   dist += 5;
41419                 }
41420                 if (dist < minDist) {
41421                   nextID = d2.data.key;
41422                   minDist = dist;
41423                 }
41424               });
41425               let nextBubble = nextID && that.cachedImage(nextID);
41426               if (!nextBubble) return;
41427               context.map().centerEase(nextBubble.loc);
41428               that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
41429             };
41430           }
41431         },
41432         yaw: function(yaw) {
41433           if (typeof yaw !== "number") return yaw;
41434           _sceneOptions.yaw = yaw;
41435           return this;
41436         },
41437         /**
41438          * showViewer()
41439          */
41440         showViewer: function(context) {
41441           const wrap2 = context.container().select(".photoviewer");
41442           const isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
41443           if (isHidden) {
41444             for (const service of Object.values(services)) {
41445               if (service === this) continue;
41446               if (typeof service.hideViewer === "function") {
41447                 service.hideViewer(context);
41448               }
41449             }
41450             wrap2.classed("hide", false).selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
41451           }
41452           return this;
41453         },
41454         /**
41455          * hideViewer()
41456          */
41457         hideViewer: function(context) {
41458           let viewer = context.container().select(".photoviewer");
41459           if (!viewer.empty()) viewer.datum(null);
41460           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
41461           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
41462           this.updateUrlImage(null);
41463           return this.setStyles(context, null, true);
41464         },
41465         /**
41466          * selectImage().
41467          */
41468         selectImage: function(context, key) {
41469           let that = this;
41470           let d2 = this.cachedImage(key);
41471           let viewer = context.container().select(".photoviewer");
41472           if (!viewer.empty()) viewer.datum(d2);
41473           this.setStyles(context, null, true);
41474           let wrap2 = context.container().select(".photoviewer .ms-wrapper");
41475           let attribution = wrap2.selectAll(".photo-attribution").html("");
41476           wrap2.selectAll(".pnlm-load-box").style("display", "block");
41477           if (!d2) return this;
41478           this.updateUrlImage(key);
41479           _sceneOptions.northOffset = d2.ca;
41480           let line1 = attribution.append("div").attr("class", "attribution-row");
41481           const hiresDomId = utilUniqueDomId("streetside-hires");
41482           let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
41483           label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
41484             d3_event.stopPropagation();
41485             _hires = !_hires;
41486             _resolution = _hires ? 1024 : 512;
41487             wrap2.call(setupCanvas, true);
41488             let viewstate = {
41489               yaw: _pannellumViewer2.getYaw(),
41490               pitch: _pannellumViewer2.getPitch(),
41491               hfov: _pannellumViewer2.getHfov()
41492             };
41493             _sceneOptions = Object.assign(_sceneOptions, viewstate);
41494             that.selectImage(context, d2.key).showViewer(context);
41495           });
41496           label.append("span").call(_t.append("streetside.hires"));
41497           let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
41498           if (d2.captured_by) {
41499             const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
41500             captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
41501             captureInfo.append("span").text("|");
41502           }
41503           if (d2.captured_at) {
41504             captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
41505           }
41506           let line2 = attribution.append("div").attr("class", "attribution-row");
41507           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"));
41508           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"));
41509           const faceKeys = ["01", "02", "03", "10", "11", "12"];
41510           let quadKeys = getQuadKeys();
41511           let faces = faceKeys.map((faceKey) => {
41512             return quadKeys.map((quadKey) => {
41513               const xy = qkToXY(quadKey);
41514               return {
41515                 face: faceKey,
41516                 url: d2.imageUrl.replace("{faceId}", faceKey).replace("{tileId}", quadKey),
41517                 x: xy[0],
41518                 y: xy[1]
41519               };
41520             });
41521           });
41522           loadFaces(faces).then(function() {
41523             if (!_pannellumViewer2) {
41524               that.initViewer();
41525             } else {
41526               _currScene += 1;
41527               let sceneID = _currScene.toString();
41528               _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
41529               if (_currScene > 2) {
41530                 sceneID = (_currScene - 1).toString();
41531                 _pannellumViewer2.removeScene(sceneID);
41532               }
41533             }
41534           });
41535           return this;
41536         },
41537         getSequenceKeyForBubble: function(d2) {
41538           return d2 && d2.sequenceKey;
41539         },
41540         // Updates the currently highlighted sequence and selected bubble.
41541         // Reset is only necessary when interacting with the viewport because
41542         // this implicitly changes the currently selected bubble/sequence
41543         setStyles: function(context, hovered, reset) {
41544           if (reset) {
41545             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
41546             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
41547           }
41548           let hoveredBubbleKey = hovered && hovered.key;
41549           let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
41550           let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
41551           let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
41552           let viewer = context.container().select(".photoviewer");
41553           let selected = viewer.empty() ? void 0 : viewer.datum();
41554           let selectedBubbleKey = selected && selected.key;
41555           let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
41556           let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
41557           let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
41558           let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
41559           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);
41560           context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
41561           context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
41562           function viewfieldPath() {
41563             let d2 = this.parentNode.__data__;
41564             if (d2.pano && d2.key !== selectedBubbleKey) {
41565               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
41566             } else {
41567               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
41568             }
41569           }
41570           return this;
41571         },
41572         updateUrlImage: function(imageKey) {
41573           const hash2 = utilStringQs(window.location.hash);
41574           if (imageKey) {
41575             hash2.photo = "streetside/" + imageKey;
41576           } else {
41577             delete hash2.photo;
41578           }
41579           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
41580         },
41581         /**
41582          * cache().
41583          */
41584         cache: function() {
41585           return _ssCache;
41586         }
41587       };
41588     }
41589   });
41590
41591   // modules/services/taginfo.js
41592   var taginfo_exports = {};
41593   __export(taginfo_exports, {
41594     default: () => taginfo_default
41595   });
41596   function sets(params, n3, o2) {
41597     if (params.geometry && o2[params.geometry]) {
41598       params[n3] = o2[params.geometry];
41599     }
41600     return params;
41601   }
41602   function setFilter(params) {
41603     return sets(params, "filter", tag_filters);
41604   }
41605   function setSort(params) {
41606     return sets(params, "sortname", tag_sorts);
41607   }
41608   function setSortMembers(params) {
41609     return sets(params, "sortname", tag_sort_members);
41610   }
41611   function clean(params) {
41612     return utilObjectOmit(params, ["geometry", "debounce"]);
41613   }
41614   function filterKeys(type2) {
41615     var count_type = type2 ? "count_" + type2 : "count_all";
41616     return function(d2) {
41617       return Number(d2[count_type]) > 2500 || d2.in_wiki;
41618     };
41619   }
41620   function filterMultikeys(prefix) {
41621     return function(d2) {
41622       var re4 = new RegExp("^" + prefix + "(.*)$", "i");
41623       var matches = d2.key.match(re4) || [];
41624       return matches.length === 2 && matches[1].indexOf(":") === -1;
41625     };
41626   }
41627   function filterValues(allowUpperCase) {
41628     return function(d2) {
41629       if (d2.value.match(/[;,]/) !== null) return false;
41630       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null) return false;
41631       return d2.count > 100 || d2.in_wiki;
41632     };
41633   }
41634   function filterRoles(geometry) {
41635     return function(d2) {
41636       if (d2.role === "") return false;
41637       if (d2.role.match(/[A-Z*;,]/) !== null) return false;
41638       return Number(d2[tag_members_fractions[geometry]]) > 0;
41639     };
41640   }
41641   function valKey(d2) {
41642     return {
41643       value: d2.key,
41644       title: d2.key
41645     };
41646   }
41647   function valKeyDescription(d2) {
41648     var obj = {
41649       value: d2.value,
41650       title: d2.description || d2.value
41651     };
41652     return obj;
41653   }
41654   function roleKey(d2) {
41655     return {
41656       value: d2.role,
41657       title: d2.role
41658     };
41659   }
41660   function sortKeys(a4, b3) {
41661     return a4.key.indexOf(":") === -1 && b3.key.indexOf(":") !== -1 ? -1 : a4.key.indexOf(":") !== -1 && b3.key.indexOf(":") === -1 ? 1 : 0;
41662   }
41663   function request2(url, params, exactMatch, callback, loaded) {
41664     if (_inflight3[url]) return;
41665     if (checkCache(url, params, exactMatch, callback)) return;
41666     var controller = new AbortController();
41667     _inflight3[url] = controller;
41668     json_default(url, { signal: controller.signal }).then(function(result) {
41669       delete _inflight3[url];
41670       if (loaded) loaded(null, result);
41671     }).catch(function(err) {
41672       delete _inflight3[url];
41673       if (err.name === "AbortError") return;
41674       if (loaded) loaded(err.message);
41675     });
41676   }
41677   function checkCache(url, params, exactMatch, callback) {
41678     var rp = params.rp || 25;
41679     var testQuery = params.query || "";
41680     var testUrl = url;
41681     do {
41682       var hit = _taginfoCache[testUrl];
41683       if (hit && (url === testUrl || hit.length < rp)) {
41684         callback(null, hit);
41685         return true;
41686       }
41687       if (exactMatch || !testQuery.length) return false;
41688       testQuery = testQuery.slice(0, -1);
41689       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
41690     } while (testQuery.length >= 0);
41691     return false;
41692   }
41693   var apibase4, _inflight3, _popularKeys, _taginfoCache, tag_sorts, tag_sort_members, tag_filters, tag_members_fractions, debouncedRequest2, taginfo_default;
41694   var init_taginfo = __esm({
41695     "modules/services/taginfo.js"() {
41696       "use strict";
41697       init_debounce();
41698       init_src18();
41699       init_util();
41700       init_localizer();
41701       init_tags();
41702       init_id();
41703       apibase4 = taginfoApiUrl;
41704       _inflight3 = {};
41705       _popularKeys = {};
41706       _taginfoCache = {};
41707       tag_sorts = {
41708         point: "count_nodes",
41709         vertex: "count_nodes",
41710         area: "count_ways",
41711         line: "count_ways"
41712       };
41713       tag_sort_members = {
41714         point: "count_node_members",
41715         vertex: "count_node_members",
41716         area: "count_way_members",
41717         line: "count_way_members",
41718         relation: "count_relation_members"
41719       };
41720       tag_filters = {
41721         point: "nodes",
41722         vertex: "nodes",
41723         area: "ways",
41724         line: "ways"
41725       };
41726       tag_members_fractions = {
41727         point: "count_node_members_fraction",
41728         vertex: "count_node_members_fraction",
41729         area: "count_way_members_fraction",
41730         line: "count_way_members_fraction",
41731         relation: "count_relation_members_fraction"
41732       };
41733       debouncedRequest2 = debounce_default(request2, 300, { leading: false });
41734       taginfo_default = {
41735         init: function() {
41736           _inflight3 = {};
41737           _taginfoCache = {};
41738           _popularKeys = {
41739             // manually exclude some keys – #5377, #7485
41740             postal_code: true,
41741             full_name: true,
41742             loc_name: true,
41743             reg_name: true,
41744             short_name: true,
41745             sorting_name: true,
41746             artist_name: true,
41747             nat_name: true,
41748             long_name: true,
41749             via: true,
41750             "bridge:name": true
41751           };
41752           var params = {
41753             rp: 100,
41754             sortname: "values_all",
41755             sortorder: "desc",
41756             page: 1,
41757             debounce: false,
41758             lang: _mainLocalizer.languageCode()
41759           };
41760           this.keys(params, function(err, data) {
41761             if (err) return;
41762             data.forEach(function(d2) {
41763               if (d2.value === "opening_hours") return;
41764               _popularKeys[d2.value] = true;
41765             });
41766           });
41767         },
41768         reset: function() {
41769           Object.values(_inflight3).forEach(function(controller) {
41770             controller.abort();
41771           });
41772           _inflight3 = {};
41773         },
41774         keys: function(params, callback) {
41775           var doRequest = params.debounce ? debouncedRequest2 : request2;
41776           params = clean(setSort(params));
41777           params = Object.assign({
41778             rp: 10,
41779             sortname: "count_all",
41780             sortorder: "desc",
41781             page: 1,
41782             lang: _mainLocalizer.languageCode()
41783           }, params);
41784           var url = apibase4 + "keys/all?" + utilQsString(params);
41785           doRequest(url, params, false, callback, function(err, d2) {
41786             if (err) {
41787               callback(err);
41788             } else {
41789               var f2 = filterKeys(params.filter);
41790               var result = d2.data.filter(f2).sort(sortKeys).map(valKey);
41791               _taginfoCache[url] = result;
41792               callback(null, result);
41793             }
41794           });
41795         },
41796         multikeys: function(params, callback) {
41797           var doRequest = params.debounce ? debouncedRequest2 : request2;
41798           params = clean(setSort(params));
41799           params = Object.assign({
41800             rp: 25,
41801             sortname: "count_all",
41802             sortorder: "desc",
41803             page: 1,
41804             lang: _mainLocalizer.languageCode()
41805           }, params);
41806           var prefix = params.query;
41807           var url = apibase4 + "keys/all?" + utilQsString(params);
41808           doRequest(url, params, true, callback, function(err, d2) {
41809             if (err) {
41810               callback(err);
41811             } else {
41812               var f2 = filterMultikeys(prefix);
41813               var result = d2.data.filter(f2).map(valKey);
41814               _taginfoCache[url] = result;
41815               callback(null, result);
41816             }
41817           });
41818         },
41819         values: function(params, callback) {
41820           var key = params.key;
41821           if (key && _popularKeys[key]) {
41822             callback(null, []);
41823             return;
41824           }
41825           var doRequest = params.debounce ? debouncedRequest2 : request2;
41826           params = clean(setSort(setFilter(params)));
41827           params = Object.assign({
41828             rp: 25,
41829             sortname: "count_all",
41830             sortorder: "desc",
41831             page: 1,
41832             lang: _mainLocalizer.languageCode()
41833           }, params);
41834           var url = apibase4 + "key/values?" + utilQsString(params);
41835           doRequest(url, params, false, callback, function(err, d2) {
41836             if (err) {
41837               callback(err);
41838             } else {
41839               var allowUpperCase = allowUpperCaseTagValues.test(params.key);
41840               var f2 = filterValues(allowUpperCase);
41841               var result = d2.data.filter(f2).map(valKeyDescription);
41842               _taginfoCache[url] = result;
41843               callback(null, result);
41844             }
41845           });
41846         },
41847         roles: function(params, callback) {
41848           var doRequest = params.debounce ? debouncedRequest2 : request2;
41849           var geometry = params.geometry;
41850           params = clean(setSortMembers(params));
41851           params = Object.assign({
41852             rp: 25,
41853             sortname: "count_all_members",
41854             sortorder: "desc",
41855             page: 1,
41856             lang: _mainLocalizer.languageCode()
41857           }, params);
41858           var url = apibase4 + "relation/roles?" + utilQsString(params);
41859           doRequest(url, params, true, callback, function(err, d2) {
41860             if (err) {
41861               callback(err);
41862             } else {
41863               var f2 = filterRoles(geometry);
41864               var result = d2.data.filter(f2).map(roleKey);
41865               _taginfoCache[url] = result;
41866               callback(null, result);
41867             }
41868           });
41869         },
41870         docs: function(params, callback) {
41871           var doRequest = params.debounce ? debouncedRequest2 : request2;
41872           params = clean(setSort(params));
41873           var path = "key/wiki_pages?";
41874           if (params.value) {
41875             path = "tag/wiki_pages?";
41876           } else if (params.rtype) {
41877             path = "relation/wiki_pages?";
41878           }
41879           var url = apibase4 + path + utilQsString(params);
41880           doRequest(url, params, true, callback, function(err, d2) {
41881             if (err) {
41882               callback(err);
41883             } else {
41884               _taginfoCache[url] = d2.data;
41885               callback(null, d2.data);
41886             }
41887           });
41888         },
41889         apibase: function(_3) {
41890           if (!arguments.length) return apibase4;
41891           apibase4 = _3;
41892           return this;
41893         }
41894       };
41895     }
41896   });
41897
41898   // node_modules/@turf/helpers/dist/esm/index.js
41899   function feature2(geom, properties, options = {}) {
41900     const feat = { type: "Feature" };
41901     if (options.id === 0 || options.id) {
41902       feat.id = options.id;
41903     }
41904     if (options.bbox) {
41905       feat.bbox = options.bbox;
41906     }
41907     feat.properties = properties || {};
41908     feat.geometry = geom;
41909     return feat;
41910   }
41911   function polygon(coordinates, properties, options = {}) {
41912     for (const ring of coordinates) {
41913       if (ring.length < 4) {
41914         throw new Error(
41915           "Each LinearRing of a Polygon must have 4 or more Positions."
41916         );
41917       }
41918       if (ring[ring.length - 1].length !== ring[0].length) {
41919         throw new Error("First and last Position are not equivalent.");
41920       }
41921       for (let j3 = 0; j3 < ring[ring.length - 1].length; j3++) {
41922         if (ring[ring.length - 1][j3] !== ring[0][j3]) {
41923           throw new Error("First and last Position are not equivalent.");
41924         }
41925       }
41926     }
41927     const geom = {
41928       type: "Polygon",
41929       coordinates
41930     };
41931     return feature2(geom, properties, options);
41932   }
41933   function lineString(coordinates, properties, options = {}) {
41934     if (coordinates.length < 2) {
41935       throw new Error("coordinates must be an array of two or more positions");
41936     }
41937     const geom = {
41938       type: "LineString",
41939       coordinates
41940     };
41941     return feature2(geom, properties, options);
41942   }
41943   function multiLineString(coordinates, properties, options = {}) {
41944     const geom = {
41945       type: "MultiLineString",
41946       coordinates
41947     };
41948     return feature2(geom, properties, options);
41949   }
41950   function multiPolygon(coordinates, properties, options = {}) {
41951     const geom = {
41952       type: "MultiPolygon",
41953       coordinates
41954     };
41955     return feature2(geom, properties, options);
41956   }
41957   var earthRadius, factors;
41958   var init_esm3 = __esm({
41959     "node_modules/@turf/helpers/dist/esm/index.js"() {
41960       earthRadius = 63710088e-1;
41961       factors = {
41962         centimeters: earthRadius * 100,
41963         centimetres: earthRadius * 100,
41964         degrees: 360 / (2 * Math.PI),
41965         feet: earthRadius * 3.28084,
41966         inches: earthRadius * 39.37,
41967         kilometers: earthRadius / 1e3,
41968         kilometres: earthRadius / 1e3,
41969         meters: earthRadius,
41970         metres: earthRadius,
41971         miles: earthRadius / 1609.344,
41972         millimeters: earthRadius * 1e3,
41973         millimetres: earthRadius * 1e3,
41974         nauticalmiles: earthRadius / 1852,
41975         radians: 1,
41976         yards: earthRadius * 1.0936
41977       };
41978     }
41979   });
41980
41981   // node_modules/@turf/invariant/dist/esm/index.js
41982   function getGeom(geojson) {
41983     if (geojson.type === "Feature") {
41984       return geojson.geometry;
41985     }
41986     return geojson;
41987   }
41988   var init_esm4 = __esm({
41989     "node_modules/@turf/invariant/dist/esm/index.js"() {
41990     }
41991   });
41992
41993   // node_modules/@turf/bbox-clip/dist/esm/index.js
41994   function lineclip(points, bbox2, result) {
41995     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
41996     let a4;
41997     let b3;
41998     if (!result) result = [];
41999     for (i3 = 1; i3 < len; i3++) {
42000       a4 = points[i3 - 1];
42001       b3 = points[i3];
42002       codeB = lastCode = bitCode(b3, bbox2);
42003       while (true) {
42004         if (!(codeA | codeB)) {
42005           part.push(a4);
42006           if (codeB !== lastCode) {
42007             part.push(b3);
42008             if (i3 < len - 1) {
42009               result.push(part);
42010               part = [];
42011             }
42012           } else if (i3 === len - 1) {
42013             part.push(b3);
42014           }
42015           break;
42016         } else if (codeA & codeB) {
42017           break;
42018         } else if (codeA) {
42019           a4 = intersect(a4, b3, codeA, bbox2);
42020           codeA = bitCode(a4, bbox2);
42021         } else {
42022           b3 = intersect(a4, b3, codeB, bbox2);
42023           codeB = bitCode(b3, bbox2);
42024         }
42025       }
42026       codeA = lastCode;
42027     }
42028     if (part.length) result.push(part);
42029     return result;
42030   }
42031   function polygonclip(points, bbox2) {
42032     var result, edge, prev, prevInside, i3, p2, inside;
42033     for (edge = 1; edge <= 8; edge *= 2) {
42034       result = [];
42035       prev = points[points.length - 1];
42036       prevInside = !(bitCode(prev, bbox2) & edge);
42037       for (i3 = 0; i3 < points.length; i3++) {
42038         p2 = points[i3];
42039         inside = !(bitCode(p2, bbox2) & edge);
42040         if (inside !== prevInside) result.push(intersect(prev, p2, edge, bbox2));
42041         if (inside) result.push(p2);
42042         prev = p2;
42043         prevInside = inside;
42044       }
42045       points = result;
42046       if (!points.length) break;
42047     }
42048     return result;
42049   }
42050   function intersect(a4, b3, edge, bbox2) {
42051     return edge & 8 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[3] - a4[1]) / (b3[1] - a4[1]), bbox2[3]] : edge & 4 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[1] - a4[1]) / (b3[1] - a4[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a4[1] + (b3[1] - a4[1]) * (bbox2[2] - a4[0]) / (b3[0] - a4[0])] : edge & 1 ? [bbox2[0], a4[1] + (b3[1] - a4[1]) * (bbox2[0] - a4[0]) / (b3[0] - a4[0])] : null;
42052   }
42053   function bitCode(p2, bbox2) {
42054     var code = 0;
42055     if (p2[0] < bbox2[0]) code |= 1;
42056     else if (p2[0] > bbox2[2]) code |= 2;
42057     if (p2[1] < bbox2[1]) code |= 4;
42058     else if (p2[1] > bbox2[3]) code |= 8;
42059     return code;
42060   }
42061   function bboxClip(feature3, bbox2) {
42062     const geom = getGeom(feature3);
42063     const type2 = geom.type;
42064     const properties = feature3.type === "Feature" ? feature3.properties : {};
42065     let coords = geom.coordinates;
42066     switch (type2) {
42067       case "LineString":
42068       case "MultiLineString": {
42069         const lines = [];
42070         if (type2 === "LineString") {
42071           coords = [coords];
42072         }
42073         coords.forEach((line) => {
42074           lineclip(line, bbox2, lines);
42075         });
42076         if (lines.length === 1) {
42077           return lineString(lines[0], properties);
42078         }
42079         return multiLineString(lines, properties);
42080       }
42081       case "Polygon":
42082         return polygon(clipPolygon(coords, bbox2), properties);
42083       case "MultiPolygon":
42084         return multiPolygon(
42085           coords.map((poly) => {
42086             return clipPolygon(poly, bbox2);
42087           }),
42088           properties
42089         );
42090       default:
42091         throw new Error("geometry " + type2 + " not supported");
42092     }
42093   }
42094   function clipPolygon(rings, bbox2) {
42095     const outRings = [];
42096     for (const ring of rings) {
42097       const clipped = polygonclip(ring, bbox2);
42098       if (clipped.length > 0) {
42099         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
42100           clipped.push(clipped[0]);
42101         }
42102         if (clipped.length >= 4) {
42103           outRings.push(clipped);
42104         }
42105       }
42106     }
42107     return outRings;
42108   }
42109   var turf_bbox_clip_default;
42110   var init_esm5 = __esm({
42111     "node_modules/@turf/bbox-clip/dist/esm/index.js"() {
42112       init_esm3();
42113       init_esm4();
42114       turf_bbox_clip_default = bboxClip;
42115     }
42116   });
42117
42118   // node_modules/fast-json-stable-stringify/index.js
42119   var require_fast_json_stable_stringify = __commonJS({
42120     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
42121       "use strict";
42122       module2.exports = function(data, opts) {
42123         if (!opts) opts = {};
42124         if (typeof opts === "function") opts = { cmp: opts };
42125         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
42126         var cmp = opts.cmp && /* @__PURE__ */ function(f2) {
42127           return function(node) {
42128             return function(a4, b3) {
42129               var aobj = { key: a4, value: node[a4] };
42130               var bobj = { key: b3, value: node[b3] };
42131               return f2(aobj, bobj);
42132             };
42133           };
42134         }(opts.cmp);
42135         var seen = [];
42136         return function stringify3(node) {
42137           if (node && node.toJSON && typeof node.toJSON === "function") {
42138             node = node.toJSON();
42139           }
42140           if (node === void 0) return;
42141           if (typeof node == "number") return isFinite(node) ? "" + node : "null";
42142           if (typeof node !== "object") return JSON.stringify(node);
42143           var i3, out;
42144           if (Array.isArray(node)) {
42145             out = "[";
42146             for (i3 = 0; i3 < node.length; i3++) {
42147               if (i3) out += ",";
42148               out += stringify3(node[i3]) || "null";
42149             }
42150             return out + "]";
42151           }
42152           if (node === null) return "null";
42153           if (seen.indexOf(node) !== -1) {
42154             if (cycles) return JSON.stringify("__cycle__");
42155             throw new TypeError("Converting circular structure to JSON");
42156           }
42157           var seenIndex = seen.push(node) - 1;
42158           var keys2 = Object.keys(node).sort(cmp && cmp(node));
42159           out = "";
42160           for (i3 = 0; i3 < keys2.length; i3++) {
42161             var key = keys2[i3];
42162             var value = stringify3(node[key]);
42163             if (!value) continue;
42164             if (out) out += ",";
42165             out += JSON.stringify(key) + ":" + value;
42166           }
42167           seen.splice(seenIndex, 1);
42168           return "{" + out + "}";
42169         }(data);
42170       };
42171     }
42172   });
42173
42174   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
42175   var require_polygon_clipping_umd = __commonJS({
42176     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
42177       (function(global2, factory) {
42178         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());
42179       })(exports2, function() {
42180         "use strict";
42181         function __generator(thisArg, body) {
42182           var _3 = {
42183             label: 0,
42184             sent: function() {
42185               if (t2[0] & 1) throw t2[1];
42186               return t2[1];
42187             },
42188             trys: [],
42189             ops: []
42190           }, f2, y2, t2, g3;
42191           return g3 = {
42192             next: verb(0),
42193             "throw": verb(1),
42194             "return": verb(2)
42195           }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() {
42196             return this;
42197           }), g3;
42198           function verb(n3) {
42199             return function(v3) {
42200               return step([n3, v3]);
42201             };
42202           }
42203           function step(op) {
42204             if (f2) throw new TypeError("Generator is already executing.");
42205             while (_3) try {
42206               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;
42207               if (y2 = 0, t2) op = [op[0] & 2, t2.value];
42208               switch (op[0]) {
42209                 case 0:
42210                 case 1:
42211                   t2 = op;
42212                   break;
42213                 case 4:
42214                   _3.label++;
42215                   return {
42216                     value: op[1],
42217                     done: false
42218                   };
42219                 case 5:
42220                   _3.label++;
42221                   y2 = op[1];
42222                   op = [0];
42223                   continue;
42224                 case 7:
42225                   op = _3.ops.pop();
42226                   _3.trys.pop();
42227                   continue;
42228                 default:
42229                   if (!(t2 = _3.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
42230                     _3 = 0;
42231                     continue;
42232                   }
42233                   if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
42234                     _3.label = op[1];
42235                     break;
42236                   }
42237                   if (op[0] === 6 && _3.label < t2[1]) {
42238                     _3.label = t2[1];
42239                     t2 = op;
42240                     break;
42241                   }
42242                   if (t2 && _3.label < t2[2]) {
42243                     _3.label = t2[2];
42244                     _3.ops.push(op);
42245                     break;
42246                   }
42247                   if (t2[2]) _3.ops.pop();
42248                   _3.trys.pop();
42249                   continue;
42250               }
42251               op = body.call(thisArg, _3);
42252             } catch (e3) {
42253               op = [6, e3];
42254               y2 = 0;
42255             } finally {
42256               f2 = t2 = 0;
42257             }
42258             if (op[0] & 5) throw op[1];
42259             return {
42260               value: op[0] ? op[1] : void 0,
42261               done: true
42262             };
42263           }
42264         }
42265         var Node = (
42266           /** @class */
42267           /* @__PURE__ */ function() {
42268             function Node2(key, data) {
42269               this.next = null;
42270               this.key = key;
42271               this.data = data;
42272               this.left = null;
42273               this.right = null;
42274             }
42275             return Node2;
42276           }()
42277         );
42278         function DEFAULT_COMPARE(a4, b3) {
42279           return a4 > b3 ? 1 : a4 < b3 ? -1 : 0;
42280         }
42281         function splay(i3, t2, comparator) {
42282           var N3 = new Node(null, null);
42283           var l2 = N3;
42284           var r2 = N3;
42285           while (true) {
42286             var cmp2 = comparator(i3, t2.key);
42287             if (cmp2 < 0) {
42288               if (t2.left === null) break;
42289               if (comparator(i3, t2.left.key) < 0) {
42290                 var y2 = t2.left;
42291                 t2.left = y2.right;
42292                 y2.right = t2;
42293                 t2 = y2;
42294                 if (t2.left === null) break;
42295               }
42296               r2.left = t2;
42297               r2 = t2;
42298               t2 = t2.left;
42299             } else if (cmp2 > 0) {
42300               if (t2.right === null) break;
42301               if (comparator(i3, t2.right.key) > 0) {
42302                 var y2 = t2.right;
42303                 t2.right = y2.left;
42304                 y2.left = t2;
42305                 t2 = y2;
42306                 if (t2.right === null) break;
42307               }
42308               l2.right = t2;
42309               l2 = t2;
42310               t2 = t2.right;
42311             } else break;
42312           }
42313           l2.right = t2.left;
42314           r2.left = t2.right;
42315           t2.left = N3.right;
42316           t2.right = N3.left;
42317           return t2;
42318         }
42319         function insert(i3, data, t2, comparator) {
42320           var node = new Node(i3, data);
42321           if (t2 === null) {
42322             node.left = node.right = null;
42323             return node;
42324           }
42325           t2 = splay(i3, t2, comparator);
42326           var cmp2 = comparator(i3, t2.key);
42327           if (cmp2 < 0) {
42328             node.left = t2.left;
42329             node.right = t2;
42330             t2.left = null;
42331           } else if (cmp2 >= 0) {
42332             node.right = t2.right;
42333             node.left = t2;
42334             t2.right = null;
42335           }
42336           return node;
42337         }
42338         function split(key, v3, comparator) {
42339           var left = null;
42340           var right = null;
42341           if (v3) {
42342             v3 = splay(key, v3, comparator);
42343             var cmp2 = comparator(v3.key, key);
42344             if (cmp2 === 0) {
42345               left = v3.left;
42346               right = v3.right;
42347             } else if (cmp2 < 0) {
42348               right = v3.right;
42349               v3.right = null;
42350               left = v3;
42351             } else {
42352               left = v3.left;
42353               v3.left = null;
42354               right = v3;
42355             }
42356           }
42357           return {
42358             left,
42359             right
42360           };
42361         }
42362         function merge3(left, right, comparator) {
42363           if (right === null) return left;
42364           if (left === null) return right;
42365           right = splay(left.key, right, comparator);
42366           right.left = left;
42367           return right;
42368         }
42369         function printRow(root3, prefix, isTail, out, printNode) {
42370           if (root3) {
42371             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
42372             var indent = prefix + (isTail ? "    " : "\u2502   ");
42373             if (root3.left) printRow(root3.left, indent, false, out, printNode);
42374             if (root3.right) printRow(root3.right, indent, true, out, printNode);
42375           }
42376         }
42377         var Tree = (
42378           /** @class */
42379           function() {
42380             function Tree2(comparator) {
42381               if (comparator === void 0) {
42382                 comparator = DEFAULT_COMPARE;
42383               }
42384               this._root = null;
42385               this._size = 0;
42386               this._comparator = comparator;
42387             }
42388             Tree2.prototype.insert = function(key, data) {
42389               this._size++;
42390               return this._root = insert(key, data, this._root, this._comparator);
42391             };
42392             Tree2.prototype.add = function(key, data) {
42393               var node = new Node(key, data);
42394               if (this._root === null) {
42395                 node.left = node.right = null;
42396                 this._size++;
42397                 this._root = node;
42398               }
42399               var comparator = this._comparator;
42400               var t2 = splay(key, this._root, comparator);
42401               var cmp2 = comparator(key, t2.key);
42402               if (cmp2 === 0) this._root = t2;
42403               else {
42404                 if (cmp2 < 0) {
42405                   node.left = t2.left;
42406                   node.right = t2;
42407                   t2.left = null;
42408                 } else if (cmp2 > 0) {
42409                   node.right = t2.right;
42410                   node.left = t2;
42411                   t2.right = null;
42412                 }
42413                 this._size++;
42414                 this._root = node;
42415               }
42416               return this._root;
42417             };
42418             Tree2.prototype.remove = function(key) {
42419               this._root = this._remove(key, this._root, this._comparator);
42420             };
42421             Tree2.prototype._remove = function(i3, t2, comparator) {
42422               var x2;
42423               if (t2 === null) return null;
42424               t2 = splay(i3, t2, comparator);
42425               var cmp2 = comparator(i3, t2.key);
42426               if (cmp2 === 0) {
42427                 if (t2.left === null) {
42428                   x2 = t2.right;
42429                 } else {
42430                   x2 = splay(i3, t2.left, comparator);
42431                   x2.right = t2.right;
42432                 }
42433                 this._size--;
42434                 return x2;
42435               }
42436               return t2;
42437             };
42438             Tree2.prototype.pop = function() {
42439               var node = this._root;
42440               if (node) {
42441                 while (node.left) node = node.left;
42442                 this._root = splay(node.key, this._root, this._comparator);
42443                 this._root = this._remove(node.key, this._root, this._comparator);
42444                 return {
42445                   key: node.key,
42446                   data: node.data
42447                 };
42448               }
42449               return null;
42450             };
42451             Tree2.prototype.findStatic = function(key) {
42452               var current = this._root;
42453               var compare2 = this._comparator;
42454               while (current) {
42455                 var cmp2 = compare2(key, current.key);
42456                 if (cmp2 === 0) return current;
42457                 else if (cmp2 < 0) current = current.left;
42458                 else current = current.right;
42459               }
42460               return null;
42461             };
42462             Tree2.prototype.find = function(key) {
42463               if (this._root) {
42464                 this._root = splay(key, this._root, this._comparator);
42465                 if (this._comparator(key, this._root.key) !== 0) return null;
42466               }
42467               return this._root;
42468             };
42469             Tree2.prototype.contains = function(key) {
42470               var current = this._root;
42471               var compare2 = this._comparator;
42472               while (current) {
42473                 var cmp2 = compare2(key, current.key);
42474                 if (cmp2 === 0) return true;
42475                 else if (cmp2 < 0) current = current.left;
42476                 else current = current.right;
42477               }
42478               return false;
42479             };
42480             Tree2.prototype.forEach = function(visitor, ctx) {
42481               var current = this._root;
42482               var Q3 = [];
42483               var done = false;
42484               while (!done) {
42485                 if (current !== null) {
42486                   Q3.push(current);
42487                   current = current.left;
42488                 } else {
42489                   if (Q3.length !== 0) {
42490                     current = Q3.pop();
42491                     visitor.call(ctx, current);
42492                     current = current.right;
42493                   } else done = true;
42494                 }
42495               }
42496               return this;
42497             };
42498             Tree2.prototype.range = function(low, high, fn, ctx) {
42499               var Q3 = [];
42500               var compare2 = this._comparator;
42501               var node = this._root;
42502               var cmp2;
42503               while (Q3.length !== 0 || node) {
42504                 if (node) {
42505                   Q3.push(node);
42506                   node = node.left;
42507                 } else {
42508                   node = Q3.pop();
42509                   cmp2 = compare2(node.key, high);
42510                   if (cmp2 > 0) {
42511                     break;
42512                   } else if (compare2(node.key, low) >= 0) {
42513                     if (fn.call(ctx, node)) return this;
42514                   }
42515                   node = node.right;
42516                 }
42517               }
42518               return this;
42519             };
42520             Tree2.prototype.keys = function() {
42521               var keys2 = [];
42522               this.forEach(function(_a4) {
42523                 var key = _a4.key;
42524                 return keys2.push(key);
42525               });
42526               return keys2;
42527             };
42528             Tree2.prototype.values = function() {
42529               var values = [];
42530               this.forEach(function(_a4) {
42531                 var data = _a4.data;
42532                 return values.push(data);
42533               });
42534               return values;
42535             };
42536             Tree2.prototype.min = function() {
42537               if (this._root) return this.minNode(this._root).key;
42538               return null;
42539             };
42540             Tree2.prototype.max = function() {
42541               if (this._root) return this.maxNode(this._root).key;
42542               return null;
42543             };
42544             Tree2.prototype.minNode = function(t2) {
42545               if (t2 === void 0) {
42546                 t2 = this._root;
42547               }
42548               if (t2) while (t2.left) t2 = t2.left;
42549               return t2;
42550             };
42551             Tree2.prototype.maxNode = function(t2) {
42552               if (t2 === void 0) {
42553                 t2 = this._root;
42554               }
42555               if (t2) while (t2.right) t2 = t2.right;
42556               return t2;
42557             };
42558             Tree2.prototype.at = function(index2) {
42559               var current = this._root;
42560               var done = false;
42561               var i3 = 0;
42562               var Q3 = [];
42563               while (!done) {
42564                 if (current) {
42565                   Q3.push(current);
42566                   current = current.left;
42567                 } else {
42568                   if (Q3.length > 0) {
42569                     current = Q3.pop();
42570                     if (i3 === index2) return current;
42571                     i3++;
42572                     current = current.right;
42573                   } else done = true;
42574                 }
42575               }
42576               return null;
42577             };
42578             Tree2.prototype.next = function(d2) {
42579               var root3 = this._root;
42580               var successor = null;
42581               if (d2.right) {
42582                 successor = d2.right;
42583                 while (successor.left) successor = successor.left;
42584                 return successor;
42585               }
42586               var comparator = this._comparator;
42587               while (root3) {
42588                 var cmp2 = comparator(d2.key, root3.key);
42589                 if (cmp2 === 0) break;
42590                 else if (cmp2 < 0) {
42591                   successor = root3;
42592                   root3 = root3.left;
42593                 } else root3 = root3.right;
42594               }
42595               return successor;
42596             };
42597             Tree2.prototype.prev = function(d2) {
42598               var root3 = this._root;
42599               var predecessor = null;
42600               if (d2.left !== null) {
42601                 predecessor = d2.left;
42602                 while (predecessor.right) predecessor = predecessor.right;
42603                 return predecessor;
42604               }
42605               var comparator = this._comparator;
42606               while (root3) {
42607                 var cmp2 = comparator(d2.key, root3.key);
42608                 if (cmp2 === 0) break;
42609                 else if (cmp2 < 0) root3 = root3.left;
42610                 else {
42611                   predecessor = root3;
42612                   root3 = root3.right;
42613                 }
42614               }
42615               return predecessor;
42616             };
42617             Tree2.prototype.clear = function() {
42618               this._root = null;
42619               this._size = 0;
42620               return this;
42621             };
42622             Tree2.prototype.toList = function() {
42623               return toList(this._root);
42624             };
42625             Tree2.prototype.load = function(keys2, values, presort) {
42626               if (values === void 0) {
42627                 values = [];
42628               }
42629               if (presort === void 0) {
42630                 presort = false;
42631               }
42632               var size = keys2.length;
42633               var comparator = this._comparator;
42634               if (presort) sort(keys2, values, 0, size - 1, comparator);
42635               if (this._root === null) {
42636                 this._root = loadRecursive(keys2, values, 0, size);
42637                 this._size = size;
42638               } else {
42639                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
42640                 size = this._size + size;
42641                 this._root = sortedListToBST({
42642                   head: mergedList
42643                 }, 0, size);
42644               }
42645               return this;
42646             };
42647             Tree2.prototype.isEmpty = function() {
42648               return this._root === null;
42649             };
42650             Object.defineProperty(Tree2.prototype, "size", {
42651               get: function() {
42652                 return this._size;
42653               },
42654               enumerable: true,
42655               configurable: true
42656             });
42657             Object.defineProperty(Tree2.prototype, "root", {
42658               get: function() {
42659                 return this._root;
42660               },
42661               enumerable: true,
42662               configurable: true
42663             });
42664             Tree2.prototype.toString = function(printNode) {
42665               if (printNode === void 0) {
42666                 printNode = function(n3) {
42667                   return String(n3.key);
42668                 };
42669               }
42670               var out = [];
42671               printRow(this._root, "", true, function(v3) {
42672                 return out.push(v3);
42673               }, printNode);
42674               return out.join("");
42675             };
42676             Tree2.prototype.update = function(key, newKey, newData) {
42677               var comparator = this._comparator;
42678               var _a4 = split(key, this._root, comparator), left = _a4.left, right = _a4.right;
42679               if (comparator(key, newKey) < 0) {
42680                 right = insert(newKey, newData, right, comparator);
42681               } else {
42682                 left = insert(newKey, newData, left, comparator);
42683               }
42684               this._root = merge3(left, right, comparator);
42685             };
42686             Tree2.prototype.split = function(key) {
42687               return split(key, this._root, this._comparator);
42688             };
42689             Tree2.prototype[Symbol.iterator] = function() {
42690               var current, Q3, done;
42691               return __generator(this, function(_a4) {
42692                 switch (_a4.label) {
42693                   case 0:
42694                     current = this._root;
42695                     Q3 = [];
42696                     done = false;
42697                     _a4.label = 1;
42698                   case 1:
42699                     if (!!done) return [3, 6];
42700                     if (!(current !== null)) return [3, 2];
42701                     Q3.push(current);
42702                     current = current.left;
42703                     return [3, 5];
42704                   case 2:
42705                     if (!(Q3.length !== 0)) return [3, 4];
42706                     current = Q3.pop();
42707                     return [4, current];
42708                   case 3:
42709                     _a4.sent();
42710                     current = current.right;
42711                     return [3, 5];
42712                   case 4:
42713                     done = true;
42714                     _a4.label = 5;
42715                   case 5:
42716                     return [3, 1];
42717                   case 6:
42718                     return [
42719                       2
42720                       /*return*/
42721                     ];
42722                 }
42723               });
42724             };
42725             return Tree2;
42726           }()
42727         );
42728         function loadRecursive(keys2, values, start2, end) {
42729           var size = end - start2;
42730           if (size > 0) {
42731             var middle = start2 + Math.floor(size / 2);
42732             var key = keys2[middle];
42733             var data = values[middle];
42734             var node = new Node(key, data);
42735             node.left = loadRecursive(keys2, values, start2, middle);
42736             node.right = loadRecursive(keys2, values, middle + 1, end);
42737             return node;
42738           }
42739           return null;
42740         }
42741         function createList(keys2, values) {
42742           var head = new Node(null, null);
42743           var p2 = head;
42744           for (var i3 = 0; i3 < keys2.length; i3++) {
42745             p2 = p2.next = new Node(keys2[i3], values[i3]);
42746           }
42747           p2.next = null;
42748           return head.next;
42749         }
42750         function toList(root3) {
42751           var current = root3;
42752           var Q3 = [];
42753           var done = false;
42754           var head = new Node(null, null);
42755           var p2 = head;
42756           while (!done) {
42757             if (current) {
42758               Q3.push(current);
42759               current = current.left;
42760             } else {
42761               if (Q3.length > 0) {
42762                 current = p2 = p2.next = Q3.pop();
42763                 current = current.right;
42764               } else done = true;
42765             }
42766           }
42767           p2.next = null;
42768           return head.next;
42769         }
42770         function sortedListToBST(list, start2, end) {
42771           var size = end - start2;
42772           if (size > 0) {
42773             var middle = start2 + Math.floor(size / 2);
42774             var left = sortedListToBST(list, start2, middle);
42775             var root3 = list.head;
42776             root3.left = left;
42777             list.head = list.head.next;
42778             root3.right = sortedListToBST(list, middle + 1, end);
42779             return root3;
42780           }
42781           return null;
42782         }
42783         function mergeLists(l1, l2, compare2) {
42784           var head = new Node(null, null);
42785           var p2 = head;
42786           var p1 = l1;
42787           var p22 = l2;
42788           while (p1 !== null && p22 !== null) {
42789             if (compare2(p1.key, p22.key) < 0) {
42790               p2.next = p1;
42791               p1 = p1.next;
42792             } else {
42793               p2.next = p22;
42794               p22 = p22.next;
42795             }
42796             p2 = p2.next;
42797           }
42798           if (p1 !== null) {
42799             p2.next = p1;
42800           } else if (p22 !== null) {
42801             p2.next = p22;
42802           }
42803           return head.next;
42804         }
42805         function sort(keys2, values, left, right, compare2) {
42806           if (left >= right) return;
42807           var pivot = keys2[left + right >> 1];
42808           var i3 = left - 1;
42809           var j3 = right + 1;
42810           while (true) {
42811             do
42812               i3++;
42813             while (compare2(keys2[i3], pivot) < 0);
42814             do
42815               j3--;
42816             while (compare2(keys2[j3], pivot) > 0);
42817             if (i3 >= j3) break;
42818             var tmp = keys2[i3];
42819             keys2[i3] = keys2[j3];
42820             keys2[j3] = tmp;
42821             tmp = values[i3];
42822             values[i3] = values[j3];
42823             values[j3] = tmp;
42824           }
42825           sort(keys2, values, left, j3, compare2);
42826           sort(keys2, values, j3 + 1, right, compare2);
42827         }
42828         const isInBbox2 = (bbox2, point) => {
42829           return bbox2.ll.x <= point.x && point.x <= bbox2.ur.x && bbox2.ll.y <= point.y && point.y <= bbox2.ur.y;
42830         };
42831         const getBboxOverlap2 = (b1, b22) => {
42832           if (b22.ur.x < b1.ll.x || b1.ur.x < b22.ll.x || b22.ur.y < b1.ll.y || b1.ur.y < b22.ll.y) return null;
42833           const lowerX = b1.ll.x < b22.ll.x ? b22.ll.x : b1.ll.x;
42834           const upperX = b1.ur.x < b22.ur.x ? b1.ur.x : b22.ur.x;
42835           const lowerY = b1.ll.y < b22.ll.y ? b22.ll.y : b1.ll.y;
42836           const upperY = b1.ur.y < b22.ur.y ? b1.ur.y : b22.ur.y;
42837           return {
42838             ll: {
42839               x: lowerX,
42840               y: lowerY
42841             },
42842             ur: {
42843               x: upperX,
42844               y: upperY
42845             }
42846           };
42847         };
42848         let epsilon$1 = Number.EPSILON;
42849         if (epsilon$1 === void 0) epsilon$1 = Math.pow(2, -52);
42850         const EPSILON_SQ = epsilon$1 * epsilon$1;
42851         const cmp = (a4, b3) => {
42852           if (-epsilon$1 < a4 && a4 < epsilon$1) {
42853             if (-epsilon$1 < b3 && b3 < epsilon$1) {
42854               return 0;
42855             }
42856           }
42857           const ab = a4 - b3;
42858           if (ab * ab < EPSILON_SQ * a4 * b3) {
42859             return 0;
42860           }
42861           return a4 < b3 ? -1 : 1;
42862         };
42863         class PtRounder {
42864           constructor() {
42865             this.reset();
42866           }
42867           reset() {
42868             this.xRounder = new CoordRounder();
42869             this.yRounder = new CoordRounder();
42870           }
42871           round(x2, y2) {
42872             return {
42873               x: this.xRounder.round(x2),
42874               y: this.yRounder.round(y2)
42875             };
42876           }
42877         }
42878         class CoordRounder {
42879           constructor() {
42880             this.tree = new Tree();
42881             this.round(0);
42882           }
42883           // Note: this can rounds input values backwards or forwards.
42884           //       You might ask, why not restrict this to just rounding
42885           //       forwards? Wouldn't that allow left endpoints to always
42886           //       remain left endpoints during splitting (never change to
42887           //       right). No - it wouldn't, because we snap intersections
42888           //       to endpoints (to establish independence from the segment
42889           //       angle for t-intersections).
42890           round(coord2) {
42891             const node = this.tree.add(coord2);
42892             const prevNode = this.tree.prev(node);
42893             if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
42894               this.tree.remove(coord2);
42895               return prevNode.key;
42896             }
42897             const nextNode = this.tree.next(node);
42898             if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
42899               this.tree.remove(coord2);
42900               return nextNode.key;
42901             }
42902             return coord2;
42903           }
42904         }
42905         const rounder = new PtRounder();
42906         const epsilon3 = 11102230246251565e-32;
42907         const splitter = 134217729;
42908         const resulterrbound = (3 + 8 * epsilon3) * epsilon3;
42909         function sum(elen, e3, flen, f2, h3) {
42910           let Q3, Qnew, hh, bvirt;
42911           let enow = e3[0];
42912           let fnow = f2[0];
42913           let eindex = 0;
42914           let findex = 0;
42915           if (fnow > enow === fnow > -enow) {
42916             Q3 = enow;
42917             enow = e3[++eindex];
42918           } else {
42919             Q3 = fnow;
42920             fnow = f2[++findex];
42921           }
42922           let hindex = 0;
42923           if (eindex < elen && findex < flen) {
42924             if (fnow > enow === fnow > -enow) {
42925               Qnew = enow + Q3;
42926               hh = Q3 - (Qnew - enow);
42927               enow = e3[++eindex];
42928             } else {
42929               Qnew = fnow + Q3;
42930               hh = Q3 - (Qnew - fnow);
42931               fnow = f2[++findex];
42932             }
42933             Q3 = Qnew;
42934             if (hh !== 0) {
42935               h3[hindex++] = hh;
42936             }
42937             while (eindex < elen && findex < flen) {
42938               if (fnow > enow === fnow > -enow) {
42939                 Qnew = Q3 + enow;
42940                 bvirt = Qnew - Q3;
42941                 hh = Q3 - (Qnew - bvirt) + (enow - bvirt);
42942                 enow = e3[++eindex];
42943               } else {
42944                 Qnew = Q3 + fnow;
42945                 bvirt = Qnew - Q3;
42946                 hh = Q3 - (Qnew - bvirt) + (fnow - bvirt);
42947                 fnow = f2[++findex];
42948               }
42949               Q3 = Qnew;
42950               if (hh !== 0) {
42951                 h3[hindex++] = hh;
42952               }
42953             }
42954           }
42955           while (eindex < elen) {
42956             Qnew = Q3 + enow;
42957             bvirt = Qnew - Q3;
42958             hh = Q3 - (Qnew - bvirt) + (enow - bvirt);
42959             enow = e3[++eindex];
42960             Q3 = Qnew;
42961             if (hh !== 0) {
42962               h3[hindex++] = hh;
42963             }
42964           }
42965           while (findex < flen) {
42966             Qnew = Q3 + fnow;
42967             bvirt = Qnew - Q3;
42968             hh = Q3 - (Qnew - bvirt) + (fnow - bvirt);
42969             fnow = f2[++findex];
42970             Q3 = Qnew;
42971             if (hh !== 0) {
42972               h3[hindex++] = hh;
42973             }
42974           }
42975           if (Q3 !== 0 || hindex === 0) {
42976             h3[hindex++] = Q3;
42977           }
42978           return hindex;
42979         }
42980         function estimate(elen, e3) {
42981           let Q3 = e3[0];
42982           for (let i3 = 1; i3 < elen; i3++) Q3 += e3[i3];
42983           return Q3;
42984         }
42985         function vec(n3) {
42986           return new Float64Array(n3);
42987         }
42988         const ccwerrboundA = (3 + 16 * epsilon3) * epsilon3;
42989         const ccwerrboundB = (2 + 12 * epsilon3) * epsilon3;
42990         const ccwerrboundC = (9 + 64 * epsilon3) * epsilon3 * epsilon3;
42991         const B3 = vec(4);
42992         const C1 = vec(8);
42993         const C22 = vec(12);
42994         const D3 = vec(16);
42995         const u2 = vec(4);
42996         function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
42997           let acxtail, acytail, bcxtail, bcytail;
42998           let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3;
42999           const acx = ax - cx;
43000           const bcx = bx - cx;
43001           const acy = ay - cy;
43002           const bcy = by - cy;
43003           s1 = acx * bcy;
43004           c2 = splitter * acx;
43005           ahi = c2 - (c2 - acx);
43006           alo = acx - ahi;
43007           c2 = splitter * bcy;
43008           bhi = c2 - (c2 - bcy);
43009           blo = bcy - bhi;
43010           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43011           t12 = acy * bcx;
43012           c2 = splitter * acy;
43013           ahi = c2 - (c2 - acy);
43014           alo = acy - ahi;
43015           c2 = splitter * bcx;
43016           bhi = c2 - (c2 - bcx);
43017           blo = bcx - bhi;
43018           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43019           _i = s0 - t02;
43020           bvirt = s0 - _i;
43021           B3[0] = s0 - (_i + bvirt) + (bvirt - t02);
43022           _j = s1 + _i;
43023           bvirt = _j - s1;
43024           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43025           _i = _0 - t12;
43026           bvirt = _0 - _i;
43027           B3[1] = _0 - (_i + bvirt) + (bvirt - t12);
43028           u3 = _j + _i;
43029           bvirt = u3 - _j;
43030           B3[2] = _j - (u3 - bvirt) + (_i - bvirt);
43031           B3[3] = u3;
43032           let det = estimate(4, B3);
43033           let errbound = ccwerrboundB * detsum;
43034           if (det >= errbound || -det >= errbound) {
43035             return det;
43036           }
43037           bvirt = ax - acx;
43038           acxtail = ax - (acx + bvirt) + (bvirt - cx);
43039           bvirt = bx - bcx;
43040           bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
43041           bvirt = ay - acy;
43042           acytail = ay - (acy + bvirt) + (bvirt - cy);
43043           bvirt = by - bcy;
43044           bcytail = by - (bcy + bvirt) + (bvirt - cy);
43045           if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
43046             return det;
43047           }
43048           errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
43049           det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
43050           if (det >= errbound || -det >= errbound) return det;
43051           s1 = acxtail * bcy;
43052           c2 = splitter * acxtail;
43053           ahi = c2 - (c2 - acxtail);
43054           alo = acxtail - ahi;
43055           c2 = splitter * bcy;
43056           bhi = c2 - (c2 - bcy);
43057           blo = bcy - bhi;
43058           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43059           t12 = acytail * bcx;
43060           c2 = splitter * acytail;
43061           ahi = c2 - (c2 - acytail);
43062           alo = acytail - ahi;
43063           c2 = splitter * bcx;
43064           bhi = c2 - (c2 - bcx);
43065           blo = bcx - bhi;
43066           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43067           _i = s0 - t02;
43068           bvirt = s0 - _i;
43069           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
43070           _j = s1 + _i;
43071           bvirt = _j - s1;
43072           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43073           _i = _0 - t12;
43074           bvirt = _0 - _i;
43075           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
43076           u3 = _j + _i;
43077           bvirt = u3 - _j;
43078           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
43079           u2[3] = u3;
43080           const C1len = sum(4, B3, 4, u2, C1);
43081           s1 = acx * bcytail;
43082           c2 = splitter * acx;
43083           ahi = c2 - (c2 - acx);
43084           alo = acx - ahi;
43085           c2 = splitter * bcytail;
43086           bhi = c2 - (c2 - bcytail);
43087           blo = bcytail - bhi;
43088           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43089           t12 = acy * bcxtail;
43090           c2 = splitter * acy;
43091           ahi = c2 - (c2 - acy);
43092           alo = acy - ahi;
43093           c2 = splitter * bcxtail;
43094           bhi = c2 - (c2 - bcxtail);
43095           blo = bcxtail - bhi;
43096           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43097           _i = s0 - t02;
43098           bvirt = s0 - _i;
43099           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
43100           _j = s1 + _i;
43101           bvirt = _j - s1;
43102           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43103           _i = _0 - t12;
43104           bvirt = _0 - _i;
43105           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
43106           u3 = _j + _i;
43107           bvirt = u3 - _j;
43108           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
43109           u2[3] = u3;
43110           const C2len = sum(C1len, C1, 4, u2, C22);
43111           s1 = acxtail * bcytail;
43112           c2 = splitter * acxtail;
43113           ahi = c2 - (c2 - acxtail);
43114           alo = acxtail - ahi;
43115           c2 = splitter * bcytail;
43116           bhi = c2 - (c2 - bcytail);
43117           blo = bcytail - bhi;
43118           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43119           t12 = acytail * bcxtail;
43120           c2 = splitter * acytail;
43121           ahi = c2 - (c2 - acytail);
43122           alo = acytail - ahi;
43123           c2 = splitter * bcxtail;
43124           bhi = c2 - (c2 - bcxtail);
43125           blo = bcxtail - bhi;
43126           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43127           _i = s0 - t02;
43128           bvirt = s0 - _i;
43129           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
43130           _j = s1 + _i;
43131           bvirt = _j - s1;
43132           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43133           _i = _0 - t12;
43134           bvirt = _0 - _i;
43135           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
43136           u3 = _j + _i;
43137           bvirt = u3 - _j;
43138           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
43139           u2[3] = u3;
43140           const Dlen = sum(C2len, C22, 4, u2, D3);
43141           return D3[Dlen - 1];
43142         }
43143         function orient2d(ax, ay, bx, by, cx, cy) {
43144           const detleft = (ay - cy) * (bx - cx);
43145           const detright = (ax - cx) * (by - cy);
43146           const det = detleft - detright;
43147           const detsum = Math.abs(detleft + detright);
43148           if (Math.abs(det) >= ccwerrboundA * detsum) return det;
43149           return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
43150         }
43151         const crossProduct2 = (a4, b3) => a4.x * b3.y - a4.y * b3.x;
43152         const dotProduct2 = (a4, b3) => a4.x * b3.x + a4.y * b3.y;
43153         const compareVectorAngles = (basePt, endPt1, endPt2) => {
43154           const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
43155           if (res > 0) return -1;
43156           if (res < 0) return 1;
43157           return 0;
43158         };
43159         const length2 = (v3) => Math.sqrt(dotProduct2(v3, v3));
43160         const sineOfAngle2 = (pShared, pBase, pAngle) => {
43161           const vBase = {
43162             x: pBase.x - pShared.x,
43163             y: pBase.y - pShared.y
43164           };
43165           const vAngle = {
43166             x: pAngle.x - pShared.x,
43167             y: pAngle.y - pShared.y
43168           };
43169           return crossProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
43170         };
43171         const cosineOfAngle2 = (pShared, pBase, pAngle) => {
43172           const vBase = {
43173             x: pBase.x - pShared.x,
43174             y: pBase.y - pShared.y
43175           };
43176           const vAngle = {
43177             x: pAngle.x - pShared.x,
43178             y: pAngle.y - pShared.y
43179           };
43180           return dotProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
43181         };
43182         const horizontalIntersection2 = (pt2, v3, y2) => {
43183           if (v3.y === 0) return null;
43184           return {
43185             x: pt2.x + v3.x / v3.y * (y2 - pt2.y),
43186             y: y2
43187           };
43188         };
43189         const verticalIntersection2 = (pt2, v3, x2) => {
43190           if (v3.x === 0) return null;
43191           return {
43192             x: x2,
43193             y: pt2.y + v3.y / v3.x * (x2 - pt2.x)
43194           };
43195         };
43196         const intersection$1 = (pt1, v1, pt2, v22) => {
43197           if (v1.x === 0) return verticalIntersection2(pt2, v22, pt1.x);
43198           if (v22.x === 0) return verticalIntersection2(pt1, v1, pt2.x);
43199           if (v1.y === 0) return horizontalIntersection2(pt2, v22, pt1.y);
43200           if (v22.y === 0) return horizontalIntersection2(pt1, v1, pt2.y);
43201           const kross = crossProduct2(v1, v22);
43202           if (kross == 0) return null;
43203           const ve3 = {
43204             x: pt2.x - pt1.x,
43205             y: pt2.y - pt1.y
43206           };
43207           const d1 = crossProduct2(ve3, v1) / kross;
43208           const d2 = crossProduct2(ve3, v22) / kross;
43209           const x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v22.x;
43210           const y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v22.y;
43211           const x3 = (x12 + x2) / 2;
43212           const y3 = (y12 + y2) / 2;
43213           return {
43214             x: x3,
43215             y: y3
43216           };
43217         };
43218         class SweepEvent2 {
43219           // for ordering sweep events in the sweep event queue
43220           static compare(a4, b3) {
43221             const ptCmp = SweepEvent2.comparePoints(a4.point, b3.point);
43222             if (ptCmp !== 0) return ptCmp;
43223             if (a4.point !== b3.point) a4.link(b3);
43224             if (a4.isLeft !== b3.isLeft) return a4.isLeft ? 1 : -1;
43225             return Segment2.compare(a4.segment, b3.segment);
43226           }
43227           // for ordering points in sweep line order
43228           static comparePoints(aPt, bPt) {
43229             if (aPt.x < bPt.x) return -1;
43230             if (aPt.x > bPt.x) return 1;
43231             if (aPt.y < bPt.y) return -1;
43232             if (aPt.y > bPt.y) return 1;
43233             return 0;
43234           }
43235           // Warning: 'point' input will be modified and re-used (for performance)
43236           constructor(point, isLeft) {
43237             if (point.events === void 0) point.events = [this];
43238             else point.events.push(this);
43239             this.point = point;
43240             this.isLeft = isLeft;
43241           }
43242           link(other) {
43243             if (other.point === this.point) {
43244               throw new Error("Tried to link already linked events");
43245             }
43246             const otherEvents = other.point.events;
43247             for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
43248               const evt = otherEvents[i3];
43249               this.point.events.push(evt);
43250               evt.point = this.point;
43251             }
43252             this.checkForConsuming();
43253           }
43254           /* Do a pass over our linked events and check to see if any pair
43255            * of segments match, and should be consumed. */
43256           checkForConsuming() {
43257             const numEvents = this.point.events.length;
43258             for (let i3 = 0; i3 < numEvents; i3++) {
43259               const evt1 = this.point.events[i3];
43260               if (evt1.segment.consumedBy !== void 0) continue;
43261               for (let j3 = i3 + 1; j3 < numEvents; j3++) {
43262                 const evt2 = this.point.events[j3];
43263                 if (evt2.consumedBy !== void 0) continue;
43264                 if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
43265                 evt1.segment.consume(evt2.segment);
43266               }
43267             }
43268           }
43269           getAvailableLinkedEvents() {
43270             const events = [];
43271             for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
43272               const evt = this.point.events[i3];
43273               if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
43274                 events.push(evt);
43275               }
43276             }
43277             return events;
43278           }
43279           /**
43280            * Returns a comparator function for sorting linked events that will
43281            * favor the event that will give us the smallest left-side angle.
43282            * All ring construction starts as low as possible heading to the right,
43283            * so by always turning left as sharp as possible we'll get polygons
43284            * without uncessary loops & holes.
43285            *
43286            * The comparator function has a compute cache such that it avoids
43287            * re-computing already-computed values.
43288            */
43289           getLeftmostComparator(baseEvent) {
43290             const cache = /* @__PURE__ */ new Map();
43291             const fillCache = (linkedEvent) => {
43292               const nextEvent = linkedEvent.otherSE;
43293               cache.set(linkedEvent, {
43294                 sine: sineOfAngle2(this.point, baseEvent.point, nextEvent.point),
43295                 cosine: cosineOfAngle2(this.point, baseEvent.point, nextEvent.point)
43296               });
43297             };
43298             return (a4, b3) => {
43299               if (!cache.has(a4)) fillCache(a4);
43300               if (!cache.has(b3)) fillCache(b3);
43301               const {
43302                 sine: asine,
43303                 cosine: acosine
43304               } = cache.get(a4);
43305               const {
43306                 sine: bsine,
43307                 cosine: bcosine
43308               } = cache.get(b3);
43309               if (asine >= 0 && bsine >= 0) {
43310                 if (acosine < bcosine) return 1;
43311                 if (acosine > bcosine) return -1;
43312                 return 0;
43313               }
43314               if (asine < 0 && bsine < 0) {
43315                 if (acosine < bcosine) return -1;
43316                 if (acosine > bcosine) return 1;
43317                 return 0;
43318               }
43319               if (bsine < asine) return -1;
43320               if (bsine > asine) return 1;
43321               return 0;
43322             };
43323           }
43324         }
43325         let segmentId2 = 0;
43326         class Segment2 {
43327           /* This compare() function is for ordering segments in the sweep
43328            * line tree, and does so according to the following criteria:
43329            *
43330            * Consider the vertical line that lies an infinestimal step to the
43331            * right of the right-more of the two left endpoints of the input
43332            * segments. Imagine slowly moving a point up from negative infinity
43333            * in the increasing y direction. Which of the two segments will that
43334            * point intersect first? That segment comes 'before' the other one.
43335            *
43336            * If neither segment would be intersected by such a line, (if one
43337            * or more of the segments are vertical) then the line to be considered
43338            * is directly on the right-more of the two left inputs.
43339            */
43340           static compare(a4, b3) {
43341             const alx = a4.leftSE.point.x;
43342             const blx = b3.leftSE.point.x;
43343             const arx = a4.rightSE.point.x;
43344             const brx = b3.rightSE.point.x;
43345             if (brx < alx) return 1;
43346             if (arx < blx) return -1;
43347             const aly = a4.leftSE.point.y;
43348             const bly = b3.leftSE.point.y;
43349             const ary = a4.rightSE.point.y;
43350             const bry = b3.rightSE.point.y;
43351             if (alx < blx) {
43352               if (bly < aly && bly < ary) return 1;
43353               if (bly > aly && bly > ary) return -1;
43354               const aCmpBLeft = a4.comparePoint(b3.leftSE.point);
43355               if (aCmpBLeft < 0) return 1;
43356               if (aCmpBLeft > 0) return -1;
43357               const bCmpARight = b3.comparePoint(a4.rightSE.point);
43358               if (bCmpARight !== 0) return bCmpARight;
43359               return -1;
43360             }
43361             if (alx > blx) {
43362               if (aly < bly && aly < bry) return -1;
43363               if (aly > bly && aly > bry) return 1;
43364               const bCmpALeft = b3.comparePoint(a4.leftSE.point);
43365               if (bCmpALeft !== 0) return bCmpALeft;
43366               const aCmpBRight = a4.comparePoint(b3.rightSE.point);
43367               if (aCmpBRight < 0) return 1;
43368               if (aCmpBRight > 0) return -1;
43369               return 1;
43370             }
43371             if (aly < bly) return -1;
43372             if (aly > bly) return 1;
43373             if (arx < brx) {
43374               const bCmpARight = b3.comparePoint(a4.rightSE.point);
43375               if (bCmpARight !== 0) return bCmpARight;
43376             }
43377             if (arx > brx) {
43378               const aCmpBRight = a4.comparePoint(b3.rightSE.point);
43379               if (aCmpBRight < 0) return 1;
43380               if (aCmpBRight > 0) return -1;
43381             }
43382             if (arx !== brx) {
43383               const ay = ary - aly;
43384               const ax = arx - alx;
43385               const by = bry - bly;
43386               const bx = brx - blx;
43387               if (ay > ax && by < bx) return 1;
43388               if (ay < ax && by > bx) return -1;
43389             }
43390             if (arx > brx) return 1;
43391             if (arx < brx) return -1;
43392             if (ary < bry) return -1;
43393             if (ary > bry) return 1;
43394             if (a4.id < b3.id) return -1;
43395             if (a4.id > b3.id) return 1;
43396             return 0;
43397           }
43398           /* Warning: a reference to ringWindings input will be stored,
43399            *  and possibly will be later modified */
43400           constructor(leftSE, rightSE, rings, windings) {
43401             this.id = ++segmentId2;
43402             this.leftSE = leftSE;
43403             leftSE.segment = this;
43404             leftSE.otherSE = rightSE;
43405             this.rightSE = rightSE;
43406             rightSE.segment = this;
43407             rightSE.otherSE = leftSE;
43408             this.rings = rings;
43409             this.windings = windings;
43410           }
43411           static fromRing(pt1, pt2, ring) {
43412             let leftPt, rightPt, winding;
43413             const cmpPts = SweepEvent2.comparePoints(pt1, pt2);
43414             if (cmpPts < 0) {
43415               leftPt = pt1;
43416               rightPt = pt2;
43417               winding = 1;
43418             } else if (cmpPts > 0) {
43419               leftPt = pt2;
43420               rightPt = pt1;
43421               winding = -1;
43422             } else throw new Error(`Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`);
43423             const leftSE = new SweepEvent2(leftPt, true);
43424             const rightSE = new SweepEvent2(rightPt, false);
43425             return new Segment2(leftSE, rightSE, [ring], [winding]);
43426           }
43427           /* When a segment is split, the rightSE is replaced with a new sweep event */
43428           replaceRightSE(newRightSE) {
43429             this.rightSE = newRightSE;
43430             this.rightSE.segment = this;
43431             this.rightSE.otherSE = this.leftSE;
43432             this.leftSE.otherSE = this.rightSE;
43433           }
43434           bbox() {
43435             const y12 = this.leftSE.point.y;
43436             const y2 = this.rightSE.point.y;
43437             return {
43438               ll: {
43439                 x: this.leftSE.point.x,
43440                 y: y12 < y2 ? y12 : y2
43441               },
43442               ur: {
43443                 x: this.rightSE.point.x,
43444                 y: y12 > y2 ? y12 : y2
43445               }
43446             };
43447           }
43448           /* A vector from the left point to the right */
43449           vector() {
43450             return {
43451               x: this.rightSE.point.x - this.leftSE.point.x,
43452               y: this.rightSE.point.y - this.leftSE.point.y
43453             };
43454           }
43455           isAnEndpoint(pt2) {
43456             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;
43457           }
43458           /* Compare this segment with a point.
43459            *
43460            * A point P is considered to be colinear to a segment if there
43461            * exists a distance D such that if we travel along the segment
43462            * from one * endpoint towards the other a distance D, we find
43463            * ourselves at point P.
43464            *
43465            * Return value indicates:
43466            *
43467            *   1: point lies above the segment (to the left of vertical)
43468            *   0: point is colinear to segment
43469            *  -1: point lies below the segment (to the right of vertical)
43470            */
43471           comparePoint(point) {
43472             if (this.isAnEndpoint(point)) return 0;
43473             const lPt = this.leftSE.point;
43474             const rPt = this.rightSE.point;
43475             const v3 = this.vector();
43476             if (lPt.x === rPt.x) {
43477               if (point.x === lPt.x) return 0;
43478               return point.x < lPt.x ? 1 : -1;
43479             }
43480             const yDist = (point.y - lPt.y) / v3.y;
43481             const xFromYDist = lPt.x + yDist * v3.x;
43482             if (point.x === xFromYDist) return 0;
43483             const xDist = (point.x - lPt.x) / v3.x;
43484             const yFromXDist = lPt.y + xDist * v3.y;
43485             if (point.y === yFromXDist) return 0;
43486             return point.y < yFromXDist ? -1 : 1;
43487           }
43488           /**
43489            * Given another segment, returns the first non-trivial intersection
43490            * between the two segments (in terms of sweep line ordering), if it exists.
43491            *
43492            * A 'non-trivial' intersection is one that will cause one or both of the
43493            * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
43494            *
43495            *   * endpoint of segA with endpoint of segB --> trivial
43496            *   * endpoint of segA with point along segB --> non-trivial
43497            *   * endpoint of segB with point along segA --> non-trivial
43498            *   * point along segA with point along segB --> non-trivial
43499            *
43500            * If no non-trivial intersection exists, return null
43501            * Else, return null.
43502            */
43503           getIntersection(other) {
43504             const tBbox = this.bbox();
43505             const oBbox = other.bbox();
43506             const bboxOverlap = getBboxOverlap2(tBbox, oBbox);
43507             if (bboxOverlap === null) return null;
43508             const tlp = this.leftSE.point;
43509             const trp = this.rightSE.point;
43510             const olp = other.leftSE.point;
43511             const orp = other.rightSE.point;
43512             const touchesOtherLSE = isInBbox2(tBbox, olp) && this.comparePoint(olp) === 0;
43513             const touchesThisLSE = isInBbox2(oBbox, tlp) && other.comparePoint(tlp) === 0;
43514             const touchesOtherRSE = isInBbox2(tBbox, orp) && this.comparePoint(orp) === 0;
43515             const touchesThisRSE = isInBbox2(oBbox, trp) && other.comparePoint(trp) === 0;
43516             if (touchesThisLSE && touchesOtherLSE) {
43517               if (touchesThisRSE && !touchesOtherRSE) return trp;
43518               if (!touchesThisRSE && touchesOtherRSE) return orp;
43519               return null;
43520             }
43521             if (touchesThisLSE) {
43522               if (touchesOtherRSE) {
43523                 if (tlp.x === orp.x && tlp.y === orp.y) return null;
43524               }
43525               return tlp;
43526             }
43527             if (touchesOtherLSE) {
43528               if (touchesThisRSE) {
43529                 if (trp.x === olp.x && trp.y === olp.y) return null;
43530               }
43531               return olp;
43532             }
43533             if (touchesThisRSE && touchesOtherRSE) return null;
43534             if (touchesThisRSE) return trp;
43535             if (touchesOtherRSE) return orp;
43536             const pt2 = intersection$1(tlp, this.vector(), olp, other.vector());
43537             if (pt2 === null) return null;
43538             if (!isInBbox2(bboxOverlap, pt2)) return null;
43539             return rounder.round(pt2.x, pt2.y);
43540           }
43541           /**
43542            * Split the given segment into multiple segments on the given points.
43543            *  * Each existing segment will retain its leftSE and a new rightSE will be
43544            *    generated for it.
43545            *  * A new segment will be generated which will adopt the original segment's
43546            *    rightSE, and a new leftSE will be generated for it.
43547            *  * If there are more than two points given to split on, new segments
43548            *    in the middle will be generated with new leftSE and rightSE's.
43549            *  * An array of the newly generated SweepEvents will be returned.
43550            *
43551            * Warning: input array of points is modified
43552            */
43553           split(point) {
43554             const newEvents = [];
43555             const alreadyLinked = point.events !== void 0;
43556             const newLeftSE = new SweepEvent2(point, true);
43557             const newRightSE = new SweepEvent2(point, false);
43558             const oldRightSE = this.rightSE;
43559             this.replaceRightSE(newRightSE);
43560             newEvents.push(newRightSE);
43561             newEvents.push(newLeftSE);
43562             const newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
43563             if (SweepEvent2.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
43564               newSeg.swapEvents();
43565             }
43566             if (SweepEvent2.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
43567               this.swapEvents();
43568             }
43569             if (alreadyLinked) {
43570               newLeftSE.checkForConsuming();
43571               newRightSE.checkForConsuming();
43572             }
43573             return newEvents;
43574           }
43575           /* Swap which event is left and right */
43576           swapEvents() {
43577             const tmpEvt = this.rightSE;
43578             this.rightSE = this.leftSE;
43579             this.leftSE = tmpEvt;
43580             this.leftSE.isLeft = true;
43581             this.rightSE.isLeft = false;
43582             for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
43583               this.windings[i3] *= -1;
43584             }
43585           }
43586           /* Consume another segment. We take their rings under our wing
43587            * and mark them as consumed. Use for perfectly overlapping segments */
43588           consume(other) {
43589             let consumer = this;
43590             let consumee = other;
43591             while (consumer.consumedBy) consumer = consumer.consumedBy;
43592             while (consumee.consumedBy) consumee = consumee.consumedBy;
43593             const cmp2 = Segment2.compare(consumer, consumee);
43594             if (cmp2 === 0) return;
43595             if (cmp2 > 0) {
43596               const tmp = consumer;
43597               consumer = consumee;
43598               consumee = tmp;
43599             }
43600             if (consumer.prev === consumee) {
43601               const tmp = consumer;
43602               consumer = consumee;
43603               consumee = tmp;
43604             }
43605             for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
43606               const ring = consumee.rings[i3];
43607               const winding = consumee.windings[i3];
43608               const index2 = consumer.rings.indexOf(ring);
43609               if (index2 === -1) {
43610                 consumer.rings.push(ring);
43611                 consumer.windings.push(winding);
43612               } else consumer.windings[index2] += winding;
43613             }
43614             consumee.rings = null;
43615             consumee.windings = null;
43616             consumee.consumedBy = consumer;
43617             consumee.leftSE.consumedBy = consumer.leftSE;
43618             consumee.rightSE.consumedBy = consumer.rightSE;
43619           }
43620           /* The first segment previous segment chain that is in the result */
43621           prevInResult() {
43622             if (this._prevInResult !== void 0) return this._prevInResult;
43623             if (!this.prev) this._prevInResult = null;
43624             else if (this.prev.isInResult()) this._prevInResult = this.prev;
43625             else this._prevInResult = this.prev.prevInResult();
43626             return this._prevInResult;
43627           }
43628           beforeState() {
43629             if (this._beforeState !== void 0) return this._beforeState;
43630             if (!this.prev) this._beforeState = {
43631               rings: [],
43632               windings: [],
43633               multiPolys: []
43634             };
43635             else {
43636               const seg = this.prev.consumedBy || this.prev;
43637               this._beforeState = seg.afterState();
43638             }
43639             return this._beforeState;
43640           }
43641           afterState() {
43642             if (this._afterState !== void 0) return this._afterState;
43643             const beforeState = this.beforeState();
43644             this._afterState = {
43645               rings: beforeState.rings.slice(0),
43646               windings: beforeState.windings.slice(0),
43647               multiPolys: []
43648             };
43649             const ringsAfter = this._afterState.rings;
43650             const windingsAfter = this._afterState.windings;
43651             const mpsAfter = this._afterState.multiPolys;
43652             for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
43653               const ring = this.rings[i3];
43654               const winding = this.windings[i3];
43655               const index2 = ringsAfter.indexOf(ring);
43656               if (index2 === -1) {
43657                 ringsAfter.push(ring);
43658                 windingsAfter.push(winding);
43659               } else windingsAfter[index2] += winding;
43660             }
43661             const polysAfter = [];
43662             const polysExclude = [];
43663             for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
43664               if (windingsAfter[i3] === 0) continue;
43665               const ring = ringsAfter[i3];
43666               const poly = ring.poly;
43667               if (polysExclude.indexOf(poly) !== -1) continue;
43668               if (ring.isExterior) polysAfter.push(poly);
43669               else {
43670                 if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
43671                 const index2 = polysAfter.indexOf(ring.poly);
43672                 if (index2 !== -1) polysAfter.splice(index2, 1);
43673               }
43674             }
43675             for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
43676               const mp = polysAfter[i3].multiPoly;
43677               if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
43678             }
43679             return this._afterState;
43680           }
43681           /* Is this segment part of the final result? */
43682           isInResult() {
43683             if (this.consumedBy) return false;
43684             if (this._isInResult !== void 0) return this._isInResult;
43685             const mpsBefore = this.beforeState().multiPolys;
43686             const mpsAfter = this.afterState().multiPolys;
43687             switch (operation2.type) {
43688               case "union": {
43689                 const noBefores = mpsBefore.length === 0;
43690                 const noAfters = mpsAfter.length === 0;
43691                 this._isInResult = noBefores !== noAfters;
43692                 break;
43693               }
43694               case "intersection": {
43695                 let least;
43696                 let most;
43697                 if (mpsBefore.length < mpsAfter.length) {
43698                   least = mpsBefore.length;
43699                   most = mpsAfter.length;
43700                 } else {
43701                   least = mpsAfter.length;
43702                   most = mpsBefore.length;
43703                 }
43704                 this._isInResult = most === operation2.numMultiPolys && least < most;
43705                 break;
43706               }
43707               case "xor": {
43708                 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
43709                 this._isInResult = diff % 2 === 1;
43710                 break;
43711               }
43712               case "difference": {
43713                 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
43714                 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
43715                 break;
43716               }
43717               default:
43718                 throw new Error(`Unrecognized operation type found ${operation2.type}`);
43719             }
43720             return this._isInResult;
43721           }
43722         }
43723         class RingIn2 {
43724           constructor(geomRing, poly, isExterior) {
43725             if (!Array.isArray(geomRing) || geomRing.length === 0) {
43726               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43727             }
43728             this.poly = poly;
43729             this.isExterior = isExterior;
43730             this.segments = [];
43731             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
43732               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43733             }
43734             const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
43735             this.bbox = {
43736               ll: {
43737                 x: firstPoint.x,
43738                 y: firstPoint.y
43739               },
43740               ur: {
43741                 x: firstPoint.x,
43742                 y: firstPoint.y
43743               }
43744             };
43745             let prevPoint = firstPoint;
43746             for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
43747               if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
43748                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43749               }
43750               let point = rounder.round(geomRing[i3][0], geomRing[i3][1]);
43751               if (point.x === prevPoint.x && point.y === prevPoint.y) continue;
43752               this.segments.push(Segment2.fromRing(prevPoint, point, this));
43753               if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;
43754               if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;
43755               if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;
43756               if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;
43757               prevPoint = point;
43758             }
43759             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
43760               this.segments.push(Segment2.fromRing(prevPoint, firstPoint, this));
43761             }
43762           }
43763           getSweepEvents() {
43764             const sweepEvents = [];
43765             for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
43766               const segment = this.segments[i3];
43767               sweepEvents.push(segment.leftSE);
43768               sweepEvents.push(segment.rightSE);
43769             }
43770             return sweepEvents;
43771           }
43772         }
43773         class PolyIn2 {
43774           constructor(geomPoly, multiPoly) {
43775             if (!Array.isArray(geomPoly)) {
43776               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43777             }
43778             this.exteriorRing = new RingIn2(geomPoly[0], this, true);
43779             this.bbox = {
43780               ll: {
43781                 x: this.exteriorRing.bbox.ll.x,
43782                 y: this.exteriorRing.bbox.ll.y
43783               },
43784               ur: {
43785                 x: this.exteriorRing.bbox.ur.x,
43786                 y: this.exteriorRing.bbox.ur.y
43787               }
43788             };
43789             this.interiorRings = [];
43790             for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
43791               const ring = new RingIn2(geomPoly[i3], this, false);
43792               if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;
43793               if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;
43794               if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;
43795               if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;
43796               this.interiorRings.push(ring);
43797             }
43798             this.multiPoly = multiPoly;
43799           }
43800           getSweepEvents() {
43801             const sweepEvents = this.exteriorRing.getSweepEvents();
43802             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
43803               const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
43804               for (let j3 = 0, jMax = ringSweepEvents.length; j3 < jMax; j3++) {
43805                 sweepEvents.push(ringSweepEvents[j3]);
43806               }
43807             }
43808             return sweepEvents;
43809           }
43810         }
43811         class MultiPolyIn2 {
43812           constructor(geom, isSubject) {
43813             if (!Array.isArray(geom)) {
43814               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43815             }
43816             try {
43817               if (typeof geom[0][0][0] === "number") geom = [geom];
43818             } catch (ex) {
43819             }
43820             this.polys = [];
43821             this.bbox = {
43822               ll: {
43823                 x: Number.POSITIVE_INFINITY,
43824                 y: Number.POSITIVE_INFINITY
43825               },
43826               ur: {
43827                 x: Number.NEGATIVE_INFINITY,
43828                 y: Number.NEGATIVE_INFINITY
43829               }
43830             };
43831             for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
43832               const poly = new PolyIn2(geom[i3], this);
43833               if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;
43834               if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;
43835               if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;
43836               if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;
43837               this.polys.push(poly);
43838             }
43839             this.isSubject = isSubject;
43840           }
43841           getSweepEvents() {
43842             const sweepEvents = [];
43843             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
43844               const polySweepEvents = this.polys[i3].getSweepEvents();
43845               for (let j3 = 0, jMax = polySweepEvents.length; j3 < jMax; j3++) {
43846                 sweepEvents.push(polySweepEvents[j3]);
43847               }
43848             }
43849             return sweepEvents;
43850           }
43851         }
43852         class RingOut2 {
43853           /* Given the segments from the sweep line pass, compute & return a series
43854            * of closed rings from all the segments marked to be part of the result */
43855           static factory(allSegments) {
43856             const ringsOut = [];
43857             for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
43858               const segment = allSegments[i3];
43859               if (!segment.isInResult() || segment.ringOut) continue;
43860               let prevEvent = null;
43861               let event = segment.leftSE;
43862               let nextEvent = segment.rightSE;
43863               const events = [event];
43864               const startingPoint = event.point;
43865               const intersectionLEs = [];
43866               while (true) {
43867                 prevEvent = event;
43868                 event = nextEvent;
43869                 events.push(event);
43870                 if (event.point === startingPoint) break;
43871                 while (true) {
43872                   const availableLEs = event.getAvailableLinkedEvents();
43873                   if (availableLEs.length === 0) {
43874                     const firstPt = events[0].point;
43875                     const lastPt = events[events.length - 1].point;
43876                     throw new Error(`Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`);
43877                   }
43878                   if (availableLEs.length === 1) {
43879                     nextEvent = availableLEs[0].otherSE;
43880                     break;
43881                   }
43882                   let indexLE = null;
43883                   for (let j3 = 0, jMax = intersectionLEs.length; j3 < jMax; j3++) {
43884                     if (intersectionLEs[j3].point === event.point) {
43885                       indexLE = j3;
43886                       break;
43887                     }
43888                   }
43889                   if (indexLE !== null) {
43890                     const intersectionLE = intersectionLEs.splice(indexLE)[0];
43891                     const ringEvents = events.splice(intersectionLE.index);
43892                     ringEvents.unshift(ringEvents[0].otherSE);
43893                     ringsOut.push(new RingOut2(ringEvents.reverse()));
43894                     continue;
43895                   }
43896                   intersectionLEs.push({
43897                     index: events.length,
43898                     point: event.point
43899                   });
43900                   const comparator = event.getLeftmostComparator(prevEvent);
43901                   nextEvent = availableLEs.sort(comparator)[0].otherSE;
43902                   break;
43903                 }
43904               }
43905               ringsOut.push(new RingOut2(events));
43906             }
43907             return ringsOut;
43908           }
43909           constructor(events) {
43910             this.events = events;
43911             for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
43912               events[i3].segment.ringOut = this;
43913             }
43914             this.poly = null;
43915           }
43916           getGeom() {
43917             let prevPt = this.events[0].point;
43918             const points = [prevPt];
43919             for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
43920               const pt3 = this.events[i3].point;
43921               const nextPt2 = this.events[i3 + 1].point;
43922               if (compareVectorAngles(pt3, prevPt, nextPt2) === 0) continue;
43923               points.push(pt3);
43924               prevPt = pt3;
43925             }
43926             if (points.length === 1) return null;
43927             const pt2 = points[0];
43928             const nextPt = points[1];
43929             if (compareVectorAngles(pt2, prevPt, nextPt) === 0) points.shift();
43930             points.push(points[0]);
43931             const step = this.isExteriorRing() ? 1 : -1;
43932             const iStart = this.isExteriorRing() ? 0 : points.length - 1;
43933             const iEnd = this.isExteriorRing() ? points.length : -1;
43934             const orderedPoints = [];
43935             for (let i3 = iStart; i3 != iEnd; i3 += step) orderedPoints.push([points[i3].x, points[i3].y]);
43936             return orderedPoints;
43937           }
43938           isExteriorRing() {
43939             if (this._isExteriorRing === void 0) {
43940               const enclosing = this.enclosingRing();
43941               this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
43942             }
43943             return this._isExteriorRing;
43944           }
43945           enclosingRing() {
43946             if (this._enclosingRing === void 0) {
43947               this._enclosingRing = this._calcEnclosingRing();
43948             }
43949             return this._enclosingRing;
43950           }
43951           /* Returns the ring that encloses this one, if any */
43952           _calcEnclosingRing() {
43953             let leftMostEvt = this.events[0];
43954             for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
43955               const evt = this.events[i3];
43956               if (SweepEvent2.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
43957             }
43958             let prevSeg = leftMostEvt.segment.prevInResult();
43959             let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
43960             while (true) {
43961               if (!prevSeg) return null;
43962               if (!prevPrevSeg) return prevSeg.ringOut;
43963               if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
43964                 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
43965                   return prevSeg.ringOut;
43966                 } else return prevSeg.ringOut.enclosingRing();
43967               }
43968               prevSeg = prevPrevSeg.prevInResult();
43969               prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
43970             }
43971           }
43972         }
43973         class PolyOut2 {
43974           constructor(exteriorRing) {
43975             this.exteriorRing = exteriorRing;
43976             exteriorRing.poly = this;
43977             this.interiorRings = [];
43978           }
43979           addInterior(ring) {
43980             this.interiorRings.push(ring);
43981             ring.poly = this;
43982           }
43983           getGeom() {
43984             const geom = [this.exteriorRing.getGeom()];
43985             if (geom[0] === null) return null;
43986             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
43987               const ringGeom = this.interiorRings[i3].getGeom();
43988               if (ringGeom === null) continue;
43989               geom.push(ringGeom);
43990             }
43991             return geom;
43992           }
43993         }
43994         class MultiPolyOut2 {
43995           constructor(rings) {
43996             this.rings = rings;
43997             this.polys = this._composePolys(rings);
43998           }
43999           getGeom() {
44000             const geom = [];
44001             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
44002               const polyGeom = this.polys[i3].getGeom();
44003               if (polyGeom === null) continue;
44004               geom.push(polyGeom);
44005             }
44006             return geom;
44007           }
44008           _composePolys(rings) {
44009             const polys = [];
44010             for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
44011               const ring = rings[i3];
44012               if (ring.poly) continue;
44013               if (ring.isExteriorRing()) polys.push(new PolyOut2(ring));
44014               else {
44015                 const enclosingRing = ring.enclosingRing();
44016                 if (!enclosingRing.poly) polys.push(new PolyOut2(enclosingRing));
44017                 enclosingRing.poly.addInterior(ring);
44018               }
44019             }
44020             return polys;
44021           }
44022         }
44023         class SweepLine2 {
44024           constructor(queue) {
44025             let comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment2.compare;
44026             this.queue = queue;
44027             this.tree = new Tree(comparator);
44028             this.segments = [];
44029           }
44030           process(event) {
44031             const segment = event.segment;
44032             const newEvents = [];
44033             if (event.consumedBy) {
44034               if (event.isLeft) this.queue.remove(event.otherSE);
44035               else this.tree.remove(segment);
44036               return newEvents;
44037             }
44038             const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
44039             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.`);
44040             let prevNode = node;
44041             let nextNode = node;
44042             let prevSeg = void 0;
44043             let nextSeg = void 0;
44044             while (prevSeg === void 0) {
44045               prevNode = this.tree.prev(prevNode);
44046               if (prevNode === null) prevSeg = null;
44047               else if (prevNode.key.consumedBy === void 0) prevSeg = prevNode.key;
44048             }
44049             while (nextSeg === void 0) {
44050               nextNode = this.tree.next(nextNode);
44051               if (nextNode === null) nextSeg = null;
44052               else if (nextNode.key.consumedBy === void 0) nextSeg = nextNode.key;
44053             }
44054             if (event.isLeft) {
44055               let prevMySplitter = null;
44056               if (prevSeg) {
44057                 const prevInter = prevSeg.getIntersection(segment);
44058                 if (prevInter !== null) {
44059                   if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
44060                   if (!prevSeg.isAnEndpoint(prevInter)) {
44061                     const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
44062                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44063                       newEvents.push(newEventsFromSplit[i3]);
44064                     }
44065                   }
44066                 }
44067               }
44068               let nextMySplitter = null;
44069               if (nextSeg) {
44070                 const nextInter = nextSeg.getIntersection(segment);
44071                 if (nextInter !== null) {
44072                   if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
44073                   if (!nextSeg.isAnEndpoint(nextInter)) {
44074                     const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
44075                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44076                       newEvents.push(newEventsFromSplit[i3]);
44077                     }
44078                   }
44079                 }
44080               }
44081               if (prevMySplitter !== null || nextMySplitter !== null) {
44082                 let mySplitter = null;
44083                 if (prevMySplitter === null) mySplitter = nextMySplitter;
44084                 else if (nextMySplitter === null) mySplitter = prevMySplitter;
44085                 else {
44086                   const cmpSplitters = SweepEvent2.comparePoints(prevMySplitter, nextMySplitter);
44087                   mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
44088                 }
44089                 this.queue.remove(segment.rightSE);
44090                 newEvents.push(segment.rightSE);
44091                 const newEventsFromSplit = segment.split(mySplitter);
44092                 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44093                   newEvents.push(newEventsFromSplit[i3]);
44094                 }
44095               }
44096               if (newEvents.length > 0) {
44097                 this.tree.remove(segment);
44098                 newEvents.push(event);
44099               } else {
44100                 this.segments.push(segment);
44101                 segment.prev = prevSeg;
44102               }
44103             } else {
44104               if (prevSeg && nextSeg) {
44105                 const inter = prevSeg.getIntersection(nextSeg);
44106                 if (inter !== null) {
44107                   if (!prevSeg.isAnEndpoint(inter)) {
44108                     const newEventsFromSplit = this._splitSafely(prevSeg, inter);
44109                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44110                       newEvents.push(newEventsFromSplit[i3]);
44111                     }
44112                   }
44113                   if (!nextSeg.isAnEndpoint(inter)) {
44114                     const newEventsFromSplit = this._splitSafely(nextSeg, inter);
44115                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44116                       newEvents.push(newEventsFromSplit[i3]);
44117                     }
44118                   }
44119                 }
44120               }
44121               this.tree.remove(segment);
44122             }
44123             return newEvents;
44124           }
44125           /* Safely split a segment that is currently in the datastructures
44126            * IE - a segment other than the one that is currently being processed. */
44127           _splitSafely(seg, pt2) {
44128             this.tree.remove(seg);
44129             const rightSE = seg.rightSE;
44130             this.queue.remove(rightSE);
44131             const newEvents = seg.split(pt2);
44132             newEvents.push(rightSE);
44133             if (seg.consumedBy === void 0) this.tree.add(seg);
44134             return newEvents;
44135           }
44136         }
44137         const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
44138         const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
44139         class Operation2 {
44140           run(type2, geom, moreGeoms) {
44141             operation2.type = type2;
44142             rounder.reset();
44143             const multipolys = [new MultiPolyIn2(geom, true)];
44144             for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
44145               multipolys.push(new MultiPolyIn2(moreGeoms[i3], false));
44146             }
44147             operation2.numMultiPolys = multipolys.length;
44148             if (operation2.type === "difference") {
44149               const subject = multipolys[0];
44150               let i3 = 1;
44151               while (i3 < multipolys.length) {
44152                 if (getBboxOverlap2(multipolys[i3].bbox, subject.bbox) !== null) i3++;
44153                 else multipolys.splice(i3, 1);
44154               }
44155             }
44156             if (operation2.type === "intersection") {
44157               for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
44158                 const mpA = multipolys[i3];
44159                 for (let j3 = i3 + 1, jMax = multipolys.length; j3 < jMax; j3++) {
44160                   if (getBboxOverlap2(mpA.bbox, multipolys[j3].bbox) === null) return [];
44161                 }
44162               }
44163             }
44164             const queue = new Tree(SweepEvent2.compare);
44165             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
44166               const sweepEvents = multipolys[i3].getSweepEvents();
44167               for (let j3 = 0, jMax = sweepEvents.length; j3 < jMax; j3++) {
44168                 queue.insert(sweepEvents[j3]);
44169                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
44170                   throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
44171                 }
44172               }
44173             }
44174             const sweepLine = new SweepLine2(queue);
44175             let prevQueueSize = queue.size;
44176             let node = queue.pop();
44177             while (node) {
44178               const evt = node.key;
44179               if (queue.size === prevQueueSize) {
44180                 const seg = evt.segment;
44181                 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.`);
44182               }
44183               if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
44184                 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
44185               }
44186               if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
44187                 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
44188               }
44189               const newEvents = sweepLine.process(evt);
44190               for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
44191                 const evt2 = newEvents[i3];
44192                 if (evt2.consumedBy === void 0) queue.insert(evt2);
44193               }
44194               prevQueueSize = queue.size;
44195               node = queue.pop();
44196             }
44197             rounder.reset();
44198             const ringsOut = RingOut2.factory(sweepLine.segments);
44199             const result = new MultiPolyOut2(ringsOut);
44200             return result.getGeom();
44201           }
44202         }
44203         const operation2 = new Operation2();
44204         const union2 = function(geom) {
44205           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
44206             moreGeoms[_key - 1] = arguments[_key];
44207           }
44208           return operation2.run("union", geom, moreGeoms);
44209         };
44210         const intersection2 = function(geom) {
44211           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
44212             moreGeoms[_key2 - 1] = arguments[_key2];
44213           }
44214           return operation2.run("intersection", geom, moreGeoms);
44215         };
44216         const xor = function(geom) {
44217           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
44218             moreGeoms[_key3 - 1] = arguments[_key3];
44219           }
44220           return operation2.run("xor", geom, moreGeoms);
44221         };
44222         const difference2 = function(subjectGeom) {
44223           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
44224             clippingGeoms[_key4 - 1] = arguments[_key4];
44225           }
44226           return operation2.run("difference", subjectGeom, clippingGeoms);
44227         };
44228         var index = {
44229           union: union2,
44230           intersection: intersection2,
44231           xor,
44232           difference: difference2
44233         };
44234         return index;
44235       });
44236     }
44237   });
44238
44239   // modules/services/vector_tile.js
44240   var vector_tile_exports = {};
44241   __export(vector_tile_exports, {
44242     default: () => vector_tile_default
44243   });
44244   function abortRequest6(controller) {
44245     controller.abort();
44246   }
44247   function vtToGeoJSON(data, tile, mergeCache) {
44248     var vectorTile = new VectorTile(new Pbf(data));
44249     var layers = Object.keys(vectorTile.layers);
44250     if (!Array.isArray(layers)) {
44251       layers = [layers];
44252     }
44253     var features = [];
44254     layers.forEach(function(layerID) {
44255       var layer = vectorTile.layers[layerID];
44256       if (layer) {
44257         for (var i3 = 0; i3 < layer.length; i3++) {
44258           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
44259           var geometry = feature3.geometry;
44260           if (geometry.type === "Polygon") {
44261             geometry.type = "MultiPolygon";
44262             geometry.coordinates = [geometry.coordinates];
44263           }
44264           var isClipped = false;
44265           if (geometry.type === "MultiPolygon") {
44266             var featureClip = turf_bbox_clip_default(feature3, tile.extent.rectangle());
44267             if (!(0, import_fast_deep_equal4.default)(feature3.geometry, featureClip.geometry)) {
44268               isClipped = true;
44269             }
44270             if (!feature3.geometry.coordinates.length) continue;
44271             if (!feature3.geometry.coordinates[0].length) continue;
44272           }
44273           var featurehash = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
44274           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3.properties || {}));
44275           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
44276           feature3.__featurehash__ = featurehash;
44277           feature3.__propertyhash__ = propertyhash;
44278           features.push(feature3);
44279           if (isClipped && geometry.type === "MultiPolygon") {
44280             var merged = mergeCache[propertyhash];
44281             if (merged && merged.length) {
44282               var other = merged[0];
44283               var coords = import_polygon_clipping.default.union(
44284                 feature3.geometry.coordinates,
44285                 other.geometry.coordinates
44286               );
44287               if (!coords || !coords.length) {
44288                 continue;
44289               }
44290               merged.push(feature3);
44291               for (var j3 = 0; j3 < merged.length; j3++) {
44292                 merged[j3].geometry.coordinates = coords;
44293                 merged[j3].__featurehash__ = featurehash;
44294               }
44295             } else {
44296               mergeCache[propertyhash] = [feature3];
44297             }
44298           }
44299         }
44300       }
44301     });
44302     return features;
44303   }
44304   function loadTile3(source, tile) {
44305     if (source.loaded[tile.id] || source.inflight[tile.id]) return;
44306     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) {
44307       var subdomains = r2.split(",");
44308       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
44309     });
44310     var controller = new AbortController();
44311     source.inflight[tile.id] = controller;
44312     fetch(url, { signal: controller.signal }).then(function(response) {
44313       if (!response.ok) {
44314         throw new Error(response.status + " " + response.statusText);
44315       }
44316       source.loaded[tile.id] = [];
44317       delete source.inflight[tile.id];
44318       return response.arrayBuffer();
44319     }).then(function(data) {
44320       if (!data) {
44321         throw new Error("No Data");
44322       }
44323       var z3 = tile.xyz[2];
44324       if (!source.canMerge[z3]) {
44325         source.canMerge[z3] = {};
44326       }
44327       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z3]);
44328       dispatch11.call("loadedData");
44329     }).catch(function() {
44330       source.loaded[tile.id] = [];
44331       delete source.inflight[tile.id];
44332     });
44333   }
44334   var import_fast_deep_equal4, import_fast_json_stable_stringify, import_polygon_clipping, tiler7, dispatch11, _vtCache, vector_tile_default;
44335   var init_vector_tile2 = __esm({
44336     "modules/services/vector_tile.js"() {
44337       "use strict";
44338       init_src4();
44339       import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
44340       init_esm5();
44341       import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
44342       import_polygon_clipping = __toESM(require_polygon_clipping_umd());
44343       init_pbf();
44344       init_vector_tile();
44345       init_util();
44346       tiler7 = utilTiler().tileSize(512).margin(1);
44347       dispatch11 = dispatch_default("loadedData");
44348       vector_tile_default = {
44349         init: function() {
44350           if (!_vtCache) {
44351             this.reset();
44352           }
44353           this.event = utilRebind(this, dispatch11, "on");
44354         },
44355         reset: function() {
44356           for (var sourceID in _vtCache) {
44357             var source = _vtCache[sourceID];
44358             if (source && source.inflight) {
44359               Object.values(source.inflight).forEach(abortRequest6);
44360             }
44361           }
44362           _vtCache = {};
44363         },
44364         addSource: function(sourceID, template) {
44365           _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
44366           return _vtCache[sourceID];
44367         },
44368         data: function(sourceID, projection2) {
44369           var source = _vtCache[sourceID];
44370           if (!source) return [];
44371           var tiles = tiler7.getTiles(projection2);
44372           var seen = {};
44373           var results = [];
44374           for (var i3 = 0; i3 < tiles.length; i3++) {
44375             var features = source.loaded[tiles[i3].id];
44376             if (!features || !features.length) continue;
44377             for (var j3 = 0; j3 < features.length; j3++) {
44378               var feature3 = features[j3];
44379               var hash2 = feature3.__featurehash__;
44380               if (seen[hash2]) continue;
44381               seen[hash2] = true;
44382               results.push(Object.assign({}, feature3));
44383             }
44384           }
44385           return results;
44386         },
44387         loadTiles: function(sourceID, template, projection2) {
44388           var source = _vtCache[sourceID];
44389           if (!source) {
44390             source = this.addSource(sourceID, template);
44391           }
44392           var tiles = tiler7.getTiles(projection2);
44393           Object.keys(source.inflight).forEach(function(k3) {
44394             var wanted = tiles.find(function(tile) {
44395               return k3 === tile.id;
44396             });
44397             if (!wanted) {
44398               abortRequest6(source.inflight[k3]);
44399               delete source.inflight[k3];
44400             }
44401           });
44402           tiles.forEach(function(tile) {
44403             loadTile3(source, tile);
44404           });
44405         },
44406         cache: function() {
44407           return _vtCache;
44408         }
44409       };
44410     }
44411   });
44412
44413   // modules/services/wikidata.js
44414   var wikidata_exports = {};
44415   __export(wikidata_exports, {
44416     default: () => wikidata_default
44417   });
44418   var apibase5, _wikidataCache, wikidata_default;
44419   var init_wikidata = __esm({
44420     "modules/services/wikidata.js"() {
44421       "use strict";
44422       init_src18();
44423       init_util();
44424       init_localizer();
44425       apibase5 = "https://www.wikidata.org/w/api.php?";
44426       _wikidataCache = {};
44427       wikidata_default = {
44428         init: function() {
44429         },
44430         reset: function() {
44431           _wikidataCache = {};
44432         },
44433         // Search for Wikidata items matching the query
44434         itemsForSearchQuery: function(query, callback, language) {
44435           if (!query) {
44436             if (callback) callback("No query", {});
44437             return;
44438           }
44439           var lang = this.languagesToQuery()[0];
44440           var url = apibase5 + utilQsString({
44441             action: "wbsearchentities",
44442             format: "json",
44443             formatversion: 2,
44444             search: query,
44445             type: "item",
44446             // the language to search
44447             language: language || lang,
44448             // the language for the label and description in the result
44449             uselang: lang,
44450             limit: 10,
44451             origin: "*"
44452           });
44453           json_default(url).then((result) => {
44454             if (result && result.error) {
44455               if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
44456                 this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
44457                 return;
44458               } else {
44459                 throw new Error(result.error);
44460               }
44461             }
44462             if (callback) callback(null, result.search || {});
44463           }).catch(function(err) {
44464             if (callback) callback(err.message, {});
44465           });
44466         },
44467         // Given a Wikipedia language and article title,
44468         // return an array of corresponding Wikidata entities.
44469         itemsByTitle: function(lang, title, callback) {
44470           if (!title) {
44471             if (callback) callback("No title", {});
44472             return;
44473           }
44474           lang = lang || "en";
44475           var url = apibase5 + utilQsString({
44476             action: "wbgetentities",
44477             format: "json",
44478             formatversion: 2,
44479             sites: lang.replace(/-/g, "_") + "wiki",
44480             titles: title,
44481             languages: "en",
44482             // shrink response by filtering to one language
44483             origin: "*"
44484           });
44485           json_default(url).then(function(result) {
44486             if (result && result.error) {
44487               throw new Error(result.error);
44488             }
44489             if (callback) callback(null, result.entities || {});
44490           }).catch(function(err) {
44491             if (callback) callback(err.message, {});
44492           });
44493         },
44494         languagesToQuery: function() {
44495           return _mainLocalizer.localeCodes().map(function(code) {
44496             return code.toLowerCase();
44497           }).filter(function(code) {
44498             return code !== "en-us";
44499           });
44500         },
44501         entityByQID: function(qid, callback) {
44502           if (!qid) {
44503             callback("No qid", {});
44504             return;
44505           }
44506           if (_wikidataCache[qid]) {
44507             if (callback) callback(null, _wikidataCache[qid]);
44508             return;
44509           }
44510           var langs = this.languagesToQuery();
44511           var url = apibase5 + utilQsString({
44512             action: "wbgetentities",
44513             format: "json",
44514             formatversion: 2,
44515             ids: qid,
44516             props: "labels|descriptions|claims|sitelinks",
44517             sitefilter: langs.map(function(d2) {
44518               return d2 + "wiki";
44519             }).join("|"),
44520             languages: langs.join("|"),
44521             languagefallback: 1,
44522             origin: "*"
44523           });
44524           json_default(url).then(function(result) {
44525             if (result && result.error) {
44526               throw new Error(result.error);
44527             }
44528             if (callback) callback(null, result.entities[qid] || {});
44529           }).catch(function(err) {
44530             if (callback) callback(err.message, {});
44531           });
44532         },
44533         // Pass `params` object of the form:
44534         // {
44535         //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
44536         // }
44537         //
44538         // Get an result object used to display tag documentation
44539         // {
44540         //   title:        'string',
44541         //   description:  'string',
44542         //   editURL:      'string',
44543         //   imageURL:     'string',
44544         //   wiki:         { title: 'string', text: 'string', url: 'string' }
44545         // }
44546         //
44547         getDocs: function(params, callback) {
44548           var langs = this.languagesToQuery();
44549           this.entityByQID(params.qid, function(err, entity) {
44550             if (err || !entity) {
44551               callback(err || "No entity");
44552               return;
44553             }
44554             var i3;
44555             var description;
44556             for (i3 in langs) {
44557               let code = langs[i3];
44558               if (entity.descriptions[code] && entity.descriptions[code].language === code) {
44559                 description = entity.descriptions[code];
44560                 break;
44561               }
44562             }
44563             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
44564             var result = {
44565               title: entity.id,
44566               description: (selection2) => selection2.text(description ? description.value : ""),
44567               descriptionLocaleCode: description ? description.language : "",
44568               editURL: "https://www.wikidata.org/wiki/" + entity.id
44569             };
44570             if (entity.claims) {
44571               var imageroot = "https://commons.wikimedia.org/w/index.php";
44572               var props = ["P154", "P18"];
44573               var prop, image;
44574               for (i3 = 0; i3 < props.length; i3++) {
44575                 prop = entity.claims[props[i3]];
44576                 if (prop && Object.keys(prop).length > 0) {
44577                   image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
44578                   if (image) {
44579                     result.imageURL = imageroot + "?" + utilQsString({
44580                       title: "Special:Redirect/file/" + image,
44581                       width: 400
44582                     });
44583                     break;
44584                   }
44585                 }
44586               }
44587             }
44588             if (entity.sitelinks) {
44589               var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
44590               for (i3 = 0; i3 < langs.length; i3++) {
44591                 var w3 = langs[i3] + "wiki";
44592                 if (entity.sitelinks[w3]) {
44593                   var title = entity.sitelinks[w3].title;
44594                   var tKey = "inspector.wiki_reference";
44595                   if (!englishLocale && langs[i3] === "en") {
44596                     tKey = "inspector.wiki_en_reference";
44597                   }
44598                   result.wiki = {
44599                     title,
44600                     text: tKey,
44601                     url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
44602                   };
44603                   break;
44604                 }
44605               }
44606             }
44607             callback(null, result);
44608           });
44609         }
44610       };
44611     }
44612   });
44613
44614   // modules/services/wikipedia.js
44615   var wikipedia_exports = {};
44616   __export(wikipedia_exports, {
44617     default: () => wikipedia_default
44618   });
44619   var endpoint, wikipedia_default;
44620   var init_wikipedia = __esm({
44621     "modules/services/wikipedia.js"() {
44622       "use strict";
44623       init_src18();
44624       init_util();
44625       endpoint = "https://en.wikipedia.org/w/api.php?";
44626       wikipedia_default = {
44627         init: function() {
44628         },
44629         reset: function() {
44630         },
44631         search: function(lang, query, callback) {
44632           if (!query) {
44633             if (callback) callback("No Query", []);
44634             return;
44635           }
44636           lang = lang || "en";
44637           var url = endpoint.replace("en", lang) + utilQsString({
44638             action: "query",
44639             list: "search",
44640             srlimit: "10",
44641             srinfo: "suggestion",
44642             format: "json",
44643             origin: "*",
44644             srsearch: query
44645           });
44646           json_default(url).then(function(result) {
44647             if (result && result.error) {
44648               throw new Error(result.error);
44649             } else if (!result || !result.query || !result.query.search) {
44650               throw new Error("No Results");
44651             }
44652             if (callback) {
44653               var titles = result.query.search.map(function(d2) {
44654                 return d2.title;
44655               });
44656               callback(null, titles);
44657             }
44658           }).catch(function(err) {
44659             if (callback) callback(err, []);
44660           });
44661         },
44662         suggestions: function(lang, query, callback) {
44663           if (!query) {
44664             if (callback) callback("", []);
44665             return;
44666           }
44667           lang = lang || "en";
44668           var url = endpoint.replace("en", lang) + utilQsString({
44669             action: "opensearch",
44670             namespace: 0,
44671             suggest: "",
44672             format: "json",
44673             origin: "*",
44674             search: query
44675           });
44676           json_default(url).then(function(result) {
44677             if (result && result.error) {
44678               throw new Error(result.error);
44679             } else if (!result || result.length < 2) {
44680               throw new Error("No Results");
44681             }
44682             if (callback) callback(null, result[1] || []);
44683           }).catch(function(err) {
44684             if (callback) callback(err.message, []);
44685           });
44686         },
44687         translations: function(lang, title, callback) {
44688           if (!title) {
44689             if (callback) callback("No Title");
44690             return;
44691           }
44692           var url = endpoint.replace("en", lang) + utilQsString({
44693             action: "query",
44694             prop: "langlinks",
44695             format: "json",
44696             origin: "*",
44697             lllimit: 500,
44698             titles: title
44699           });
44700           json_default(url).then(function(result) {
44701             if (result && result.error) {
44702               throw new Error(result.error);
44703             } else if (!result || !result.query || !result.query.pages) {
44704               throw new Error("No Results");
44705             }
44706             if (callback) {
44707               var list = result.query.pages[Object.keys(result.query.pages)[0]];
44708               var translations = {};
44709               if (list && list.langlinks) {
44710                 list.langlinks.forEach(function(d2) {
44711                   translations[d2.lang] = d2["*"];
44712                 });
44713               }
44714               callback(null, translations);
44715             }
44716           }).catch(function(err) {
44717             if (callback) callback(err.message);
44718           });
44719         }
44720       };
44721     }
44722   });
44723
44724   // modules/services/mapilio.js
44725   var mapilio_exports = {};
44726   __export(mapilio_exports, {
44727     default: () => mapilio_default
44728   });
44729   function partitionViewport5(projection2) {
44730     const z3 = geoScaleToZoom(projection2.scale());
44731     const z22 = Math.ceil(z3 * 2) / 2 + 2.5;
44732     const tiler8 = utilTiler().zoomExtent([z22, z22]);
44733     return tiler8.getTiles(projection2).map(function(tile) {
44734       return tile.extent;
44735     });
44736   }
44737   function searchLimited5(limit, projection2, rtree) {
44738     limit = limit || 5;
44739     return partitionViewport5(projection2).reduce(function(result, extent) {
44740       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
44741         return d2.data;
44742       });
44743       return found.length ? result.concat(found) : result;
44744     }, []);
44745   }
44746   function loadTiles4(which, url, maxZoom2, projection2) {
44747     const tiler8 = utilTiler().zoomExtent([minZoom2, maxZoom2]).skipNullIsland(true);
44748     const tiles = tiler8.getTiles(projection2);
44749     tiles.forEach(function(tile) {
44750       loadTile4(which, url, tile);
44751     });
44752   }
44753   function loadTile4(which, url, tile) {
44754     const cache = _cache3.requests;
44755     const tileId = `${tile.id}-${which}`;
44756     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
44757     const controller = new AbortController();
44758     cache.inflight[tileId] = controller;
44759     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
44760     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
44761       if (!response.ok) {
44762         throw new Error(response.status + " " + response.statusText);
44763       }
44764       cache.loaded[tileId] = true;
44765       delete cache.inflight[tileId];
44766       return response.arrayBuffer();
44767     }).then(function(data) {
44768       if (data.byteLength === 0) {
44769         throw new Error("No Data");
44770       }
44771       loadTileDataToCache2(data, tile, which);
44772       if (which === "images") {
44773         dispatch12.call("loadedImages");
44774       } else {
44775         dispatch12.call("loadedLines");
44776       }
44777     }).catch(function(e3) {
44778       if (e3.message === "No Data") {
44779         cache.loaded[tileId] = true;
44780       } else {
44781         console.error(e3);
44782       }
44783     });
44784   }
44785   function loadTileDataToCache2(data, tile) {
44786     const vectorTile = new VectorTile(new Pbf(data));
44787     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
44788       const features = [];
44789       const cache = _cache3.images;
44790       const layer = vectorTile.layers[pointLayer];
44791       for (let i3 = 0; i3 < layer.length; i3++) {
44792         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
44793         const loc = feature3.geometry.coordinates;
44794         let resolutionArr = feature3.properties.resolution.split("x");
44795         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
44796         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
44797         let isPano = sourceWidth % sourceHeight === 0;
44798         const d2 = {
44799           service: "photo",
44800           loc,
44801           capture_time: feature3.properties.capture_time,
44802           id: feature3.properties.id,
44803           sequence_id: feature3.properties.sequence_uuid,
44804           heading: feature3.properties.heading,
44805           resolution: feature3.properties.resolution,
44806           isPano
44807         };
44808         cache.forImageId[d2.id] = d2;
44809         features.push({
44810           minX: loc[0],
44811           minY: loc[1],
44812           maxX: loc[0],
44813           maxY: loc[1],
44814           data: d2
44815         });
44816       }
44817       if (cache.rtree) {
44818         cache.rtree.load(features);
44819       }
44820     }
44821     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
44822       const cache = _cache3.sequences;
44823       const layer = vectorTile.layers[lineLayer];
44824       for (let i3 = 0; i3 < layer.length; i3++) {
44825         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
44826         if (cache.lineString[feature3.properties.sequence_uuid]) {
44827           const cacheEntry = cache.lineString[feature3.properties.sequence_uuid];
44828           if (cacheEntry.some((f2) => {
44829             const cachedCoords = f2.geometry.coordinates;
44830             const featureCoords = feature3.geometry.coordinates;
44831             return isEqual_default(cachedCoords, featureCoords);
44832           })) continue;
44833           cacheEntry.push(feature3);
44834         } else {
44835           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
44836         }
44837       }
44838     }
44839   }
44840   function getImageData(imageId, sequenceId) {
44841     return fetch(apiUrl2 + `/api/sequence-detail?sequence_uuid=${sequenceId}`, { method: "GET" }).then(function(response) {
44842       if (!response.ok) {
44843         throw new Error(response.status + " " + response.statusText);
44844       }
44845       return response.json();
44846     }).then(function(data) {
44847       let index = data.data.findIndex((feature3) => feature3.id === imageId);
44848       const { filename, uploaded_hash } = data.data[index];
44849       _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
44850     });
44851   }
44852   var apiUrl2, imageBaseUrl, baseTileUrl2, pointLayer, lineLayer, tileStyle, minZoom2, dispatch12, imgZoom2, pannellumViewerCSS3, pannellumViewerJS3, resolution, _activeImage, _cache3, _loadViewerPromise5, _pannellumViewer3, _sceneOptions2, _currScene2, mapilio_default;
44853   var init_mapilio = __esm({
44854     "modules/services/mapilio.js"() {
44855       "use strict";
44856       init_src4();
44857       init_src5();
44858       init_src12();
44859       init_pbf();
44860       init_rbush();
44861       init_vector_tile();
44862       init_lodash();
44863       init_util();
44864       init_geo2();
44865       init_localizer();
44866       init_services();
44867       apiUrl2 = "https://end.mapilio.com";
44868       imageBaseUrl = "https://cdn.mapilio.com/im";
44869       baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
44870       pointLayer = "map_points";
44871       lineLayer = "map_roads_line";
44872       tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
44873       minZoom2 = 14;
44874       dispatch12 = dispatch_default("loadedImages", "loadedLines");
44875       imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
44876       pannellumViewerCSS3 = "pannellum/pannellum.css";
44877       pannellumViewerJS3 = "pannellum/pannellum.js";
44878       resolution = 1080;
44879       _sceneOptions2 = {
44880         showFullscreenCtrl: false,
44881         autoLoad: true,
44882         yaw: 0,
44883         minHfov: 10,
44884         maxHfov: 90,
44885         hfov: 60
44886       };
44887       _currScene2 = 0;
44888       mapilio_default = {
44889         // Initialize Mapilio
44890         init: function() {
44891           if (!_cache3) {
44892             this.reset();
44893           }
44894           this.event = utilRebind(this, dispatch12, "on");
44895         },
44896         // Reset cache and state
44897         reset: function() {
44898           if (_cache3) {
44899             Object.values(_cache3.requests.inflight).forEach(function(request3) {
44900               request3.abort();
44901             });
44902           }
44903           _cache3 = {
44904             images: { rtree: new RBush(), forImageId: {} },
44905             sequences: { rtree: new RBush(), lineString: {} },
44906             requests: { loaded: {}, inflight: {} }
44907           };
44908         },
44909         // Get visible images
44910         images: function(projection2) {
44911           const limit = 5;
44912           return searchLimited5(limit, projection2, _cache3.images.rtree);
44913         },
44914         cachedImage: function(imageKey) {
44915           return _cache3.images.forImageId[imageKey];
44916         },
44917         // Load images in the visible area
44918         loadImages: function(projection2) {
44919           let url = baseTileUrl2 + pointLayer + tileStyle;
44920           loadTiles4("images", url, 14, projection2);
44921         },
44922         // Load line in the visible area
44923         loadLines: function(projection2) {
44924           let url = baseTileUrl2 + lineLayer + tileStyle;
44925           loadTiles4("line", url, 14, projection2);
44926         },
44927         // Get visible sequences
44928         sequences: function(projection2) {
44929           const viewport = projection2.clipExtent();
44930           const min3 = [viewport[0][0], viewport[1][1]];
44931           const max3 = [viewport[1][0], viewport[0][1]];
44932           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
44933           const sequenceIds = {};
44934           let lineStrings = [];
44935           _cache3.images.rtree.search(bbox2).forEach(function(d2) {
44936             if (d2.data.sequence_id) {
44937               sequenceIds[d2.data.sequence_id] = true;
44938             }
44939           });
44940           Object.keys(sequenceIds).forEach(function(sequenceId) {
44941             if (_cache3.sequences.lineString[sequenceId]) {
44942               lineStrings = lineStrings.concat(_cache3.sequences.lineString[sequenceId]);
44943             }
44944           });
44945           return lineStrings;
44946         },
44947         // Set the currently visible image
44948         setActiveImage: function(image) {
44949           if (image) {
44950             _activeImage = {
44951               id: image.id,
44952               sequence_id: image.sequence_id
44953             };
44954           } else {
44955             _activeImage = null;
44956           }
44957         },
44958         // Update the currently highlighted sequence and selected bubble.
44959         setStyles: function(context, hovered) {
44960           const hoveredImageId = hovered && hovered.id;
44961           const hoveredSequenceId = hovered && hovered.sequence_id;
44962           const selectedSequenceId = _activeImage && _activeImage.sequence_id;
44963           const selectedImageId = _activeImage && _activeImage.id;
44964           const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
44965           const sequences = context.container().selectAll(".layer-mapilio .sequence");
44966           markers.classed("highlighted", function(d2) {
44967             return d2.id === hoveredImageId;
44968           }).classed("hovered", function(d2) {
44969             return d2.id === hoveredImageId;
44970           }).classed("currentView", function(d2) {
44971             return d2.id === selectedImageId;
44972           });
44973           sequences.classed("highlighted", function(d2) {
44974             return d2.properties.sequence_uuid === hoveredSequenceId;
44975           }).classed("currentView", function(d2) {
44976             return d2.properties.sequence_uuid === selectedSequenceId;
44977           });
44978           return this;
44979         },
44980         updateUrlImage: function(imageKey) {
44981           const hash2 = utilStringQs(window.location.hash);
44982           if (imageKey) {
44983             hash2.photo = "mapilio/" + imageKey;
44984           } else {
44985             delete hash2.photo;
44986           }
44987           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
44988         },
44989         initViewer: function() {
44990           if (!window.pannellum) return;
44991           if (_pannellumViewer3) return;
44992           _currScene2 += 1;
44993           const sceneID = _currScene2.toString();
44994           const options = {
44995             "default": { firstScene: sceneID },
44996             scenes: {}
44997           };
44998           options.scenes[sceneID] = _sceneOptions2;
44999           _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options);
45000         },
45001         selectImage: function(context, id2) {
45002           let that = this;
45003           let d2 = this.cachedImage(id2);
45004           this.setActiveImage(d2);
45005           this.updateUrlImage(d2.id);
45006           let viewer = context.container().select(".photoviewer");
45007           if (!viewer.empty()) viewer.datum(d2);
45008           this.setStyles(context, null);
45009           if (!d2) return this;
45010           let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
45011           let attribution = wrap2.selectAll(".photo-attribution").text("");
45012           if (d2.capture_time) {
45013             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
45014             attribution.append("span").text("|");
45015           }
45016           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");
45017           wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
45018           wrap2.selectAll("img").remove();
45019           wrap2.selectAll("button.back").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 - 1));
45020           wrap2.selectAll("button.forward").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 + 1));
45021           getImageData(d2.id, d2.sequence_id).then(function() {
45022             if (d2.isPano) {
45023               if (!_pannellumViewer3) {
45024                 that.initViewer();
45025               } else {
45026                 _currScene2 += 1;
45027                 let sceneID = _currScene2.toString();
45028                 _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
45029                 if (_currScene2 > 2) {
45030                   sceneID = (_currScene2 - 1).toString();
45031                   _pannellumViewer3.removeScene(sceneID);
45032                 }
45033               }
45034             } else {
45035               that.initOnlyPhoto(context);
45036             }
45037           });
45038           function localeDateString2(s2) {
45039             if (!s2) return null;
45040             var options = { day: "numeric", month: "short", year: "numeric" };
45041             var d4 = new Date(s2);
45042             if (isNaN(d4.getTime())) return null;
45043             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options);
45044           }
45045           return this;
45046         },
45047         initOnlyPhoto: function(context) {
45048           if (_pannellumViewer3) {
45049             _pannellumViewer3.destroy();
45050             _pannellumViewer3 = null;
45051           }
45052           let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
45053           let imgWrap = wrap2.select("img");
45054           if (!imgWrap.empty()) {
45055             imgWrap.attr("src", _sceneOptions2.panorama);
45056           } else {
45057             wrap2.append("img").attr("src", _sceneOptions2.panorama);
45058           }
45059         },
45060         ensureViewerLoaded: function(context) {
45061           let that = this;
45062           let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
45063           if (!imgWrap.empty()) {
45064             imgWrap.remove();
45065           }
45066           if (_loadViewerPromise5) return _loadViewerPromise5;
45067           let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
45068           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
45069           wrapEnter.append("div").attr("class", "photo-attribution fillD");
45070           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
45071           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
45072           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
45073           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
45074           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom2.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
45075           context.ui().photoviewer.on("resize.mapilio", () => {
45076             if (_pannellumViewer3) {
45077               _pannellumViewer3.resize();
45078             }
45079           });
45080           _loadViewerPromise5 = new Promise((resolve, reject) => {
45081             let loadedCount = 0;
45082             function loaded() {
45083               loadedCount += 1;
45084               if (loadedCount === 2) resolve();
45085             }
45086             const head = select_default2("head");
45087             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() {
45088               reject();
45089             });
45090             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() {
45091               reject();
45092             });
45093           }).catch(function() {
45094             _loadViewerPromise5 = null;
45095           });
45096           function step(stepBy) {
45097             return function() {
45098               if (!_activeImage) return;
45099               const imageId = _activeImage.id;
45100               const nextIndex = imageId + stepBy;
45101               if (!nextIndex) return;
45102               const nextImage = _cache3.images.forImageId[nextIndex];
45103               context.map().centerEase(nextImage.loc);
45104               that.selectImage(context, nextImage.id);
45105             };
45106           }
45107           function zoomPan2(d3_event) {
45108             var t2 = d3_event.transform;
45109             context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
45110           }
45111           return _loadViewerPromise5;
45112         },
45113         showViewer: function(context) {
45114           const wrap2 = context.container().select(".photoviewer");
45115           const isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
45116           if (isHidden) {
45117             for (const service of Object.values(services)) {
45118               if (service === this) continue;
45119               if (typeof service.hideViewer === "function") {
45120                 service.hideViewer(context);
45121               }
45122             }
45123             wrap2.classed("hide", false).selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
45124           }
45125           return this;
45126         },
45127         /**
45128          * hideViewer()
45129          */
45130         hideViewer: function(context) {
45131           let viewer = context.container().select(".photoviewer");
45132           if (!viewer.empty()) viewer.datum(null);
45133           this.updateUrlImage(null);
45134           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
45135           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
45136           this.setActiveImage();
45137           return this.setStyles(context, null);
45138         },
45139         // Return the current cache
45140         cache: function() {
45141           return _cache3;
45142         }
45143       };
45144     }
45145   });
45146
45147   // modules/services/panoramax.js
45148   var panoramax_exports = {};
45149   __export(panoramax_exports, {
45150     default: () => panoramax_default
45151   });
45152   function partitionViewport6(projection2) {
45153     const z3 = geoScaleToZoom(projection2.scale());
45154     const z22 = Math.ceil(z3 * 2) / 2 + 2.5;
45155     const tiler8 = utilTiler().zoomExtent([z22, z22]);
45156     return tiler8.getTiles(projection2).map(function(tile) {
45157       return tile.extent;
45158     });
45159   }
45160   function searchLimited6(limit, projection2, rtree) {
45161     limit = limit || 5;
45162     return partitionViewport6(projection2).reduce(function(result, extent) {
45163       let found = rtree.search(extent.bbox());
45164       const spacing = Math.max(1, Math.floor(found.length / limit));
45165       found = found.filter((d2, idx) => idx % spacing === 0 || d2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)).sort((a4, b3) => {
45166         if (a4.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return -1;
45167         if (b3.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return 1;
45168         return 0;
45169       }).slice(0, limit).map((d2) => d2.data);
45170       return found.length ? result.concat(found) : result;
45171     }, []);
45172   }
45173   function loadTiles5(which, url, maxZoom2, projection2, zoom) {
45174     const tiler8 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
45175     const tiles = tiler8.getTiles(projection2);
45176     tiles.forEach(function(tile) {
45177       loadTile5(which, url, tile, zoom);
45178     });
45179   }
45180   function loadTile5(which, url, tile, zoom) {
45181     const cache = _cache4.requests;
45182     const tileId = `${tile.id}-${which}`;
45183     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
45184     const controller = new AbortController();
45185     cache.inflight[tileId] = controller;
45186     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
45187     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
45188       if (!response.ok) {
45189         throw new Error(response.status + " " + response.statusText);
45190       }
45191       cache.loaded[tileId] = true;
45192       delete cache.inflight[tileId];
45193       return response.arrayBuffer();
45194     }).then(function(data) {
45195       if (data.byteLength === 0) {
45196         throw new Error("No Data");
45197       }
45198       loadTileDataToCache3(data, tile, zoom);
45199       if (which === "images") {
45200         dispatch13.call("loadedImages");
45201       } else {
45202         dispatch13.call("loadedLines");
45203       }
45204     }).catch(function(e3) {
45205       if (e3.message === "No Data") {
45206         cache.loaded[tileId] = true;
45207       } else {
45208         console.error(e3);
45209       }
45210     });
45211   }
45212   function loadTileDataToCache3(data, tile, zoom) {
45213     const vectorTile = new VectorTile(new Pbf(data));
45214     let features, cache, layer, i3, feature3, loc, d2;
45215     if (vectorTile.layers.hasOwnProperty(pictureLayer)) {
45216       features = [];
45217       cache = _cache4.images;
45218       layer = vectorTile.layers[pictureLayer];
45219       for (i3 = 0; i3 < layer.length; i3++) {
45220         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
45221         loc = feature3.geometry.coordinates;
45222         d2 = {
45223           service: "photo",
45224           loc,
45225           capture_time: feature3.properties.ts,
45226           capture_time_parsed: new Date(feature3.properties.ts),
45227           id: feature3.properties.id,
45228           account_id: feature3.properties.account_id,
45229           sequence_id: feature3.properties.first_sequence,
45230           heading: parseInt(feature3.properties.heading, 10),
45231           image_path: "",
45232           isPano: feature3.properties.type === "equirectangular",
45233           model: feature3.properties.model
45234         };
45235         cache.forImageId[d2.id] = d2;
45236         features.push({
45237           minX: loc[0],
45238           minY: loc[1],
45239           maxX: loc[0],
45240           maxY: loc[1],
45241           data: d2
45242         });
45243       }
45244       if (cache.rtree) {
45245         cache.rtree.load(features);
45246       }
45247     }
45248     if (vectorTile.layers.hasOwnProperty(sequenceLayer)) {
45249       cache = _cache4.sequences;
45250       if (zoom >= lineMinZoom && zoom < imageMinZoom) cache = _cache4.mockSequences;
45251       layer = vectorTile.layers[sequenceLayer];
45252       for (i3 = 0; i3 < layer.length; i3++) {
45253         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
45254         if (cache.lineString[feature3.properties.id]) {
45255           cache.lineString[feature3.properties.id].push(feature3);
45256         } else {
45257           cache.lineString[feature3.properties.id] = [feature3];
45258         }
45259       }
45260     }
45261   }
45262   async function getUsername(userId) {
45263     const cache = _cache4.users;
45264     if (cache[userId]) return cache[userId].name;
45265     const requestUrl = usernameURL.replace("{userId}", userId);
45266     const response = await fetch(requestUrl, { method: "GET" });
45267     if (!response.ok) {
45268       throw new Error(response.status + " " + response.statusText);
45269     }
45270     const data = await response.json();
45271     cache[userId] = data;
45272     return data.name;
45273   }
45274   var apiUrl3, tileUrl2, imageDataUrl, sequenceDataUrl, userIdUrl, usernameURL, viewerUrl, highDefinition, standardDefinition, pictureLayer, sequenceLayer, minZoom3, imageMinZoom, lineMinZoom, dispatch13, _cache4, _loadViewerPromise6, _definition, _isHD, _planeFrame2, _pannellumFrame2, _currentFrame2, _currentScene, _activeImage2, _isViewerOpen2, panoramax_default;
45275   var init_panoramax = __esm({
45276     "modules/services/panoramax.js"() {
45277       "use strict";
45278       init_src4();
45279       init_pbf();
45280       init_rbush();
45281       init_vector_tile();
45282       init_util();
45283       init_geo2();
45284       init_localizer();
45285       init_pannellum_photo();
45286       init_plane_photo();
45287       init_services();
45288       apiUrl3 = "https://api.panoramax.xyz/";
45289       tileUrl2 = apiUrl3 + "api/map/{z}/{x}/{y}.mvt";
45290       imageDataUrl = apiUrl3 + "api/collections/{collectionId}/items/{itemId}";
45291       sequenceDataUrl = apiUrl3 + "api/collections/{collectionId}/items?limit=1000";
45292       userIdUrl = apiUrl3 + "api/users/search?q={username}";
45293       usernameURL = apiUrl3 + "api/users/{userId}";
45294       viewerUrl = apiUrl3;
45295       highDefinition = "hd";
45296       standardDefinition = "sd";
45297       pictureLayer = "pictures";
45298       sequenceLayer = "sequences";
45299       minZoom3 = 10;
45300       imageMinZoom = 15;
45301       lineMinZoom = 10;
45302       dispatch13 = dispatch_default("loadedImages", "loadedLines", "viewerChanged");
45303       _definition = standardDefinition;
45304       _isHD = false;
45305       _currentScene = {
45306         currentImage: null,
45307         nextImage: null,
45308         prevImage: null
45309       };
45310       _isViewerOpen2 = false;
45311       panoramax_default = {
45312         init: function() {
45313           if (!_cache4) {
45314             this.reset();
45315           }
45316           this.event = utilRebind(this, dispatch13, "on");
45317         },
45318         reset: function() {
45319           if (_cache4) {
45320             Object.values(_cache4.requests.inflight).forEach(function(request3) {
45321               request3.abort();
45322             });
45323           }
45324           _cache4 = {
45325             images: { rtree: new RBush(), forImageId: {} },
45326             sequences: { rtree: new RBush(), lineString: {}, items: {} },
45327             users: {},
45328             mockSequences: { rtree: new RBush(), lineString: {} },
45329             requests: { loaded: {}, inflight: {} }
45330           };
45331         },
45332         /**
45333          * Get visible images from cache
45334          * @param {*} projection Current Projection
45335          * @returns images data for the current projection
45336          */
45337         images: function(projection2) {
45338           const limit = 5;
45339           return searchLimited6(limit, projection2, _cache4.images.rtree);
45340         },
45341         /**
45342          * Get a specific image from cache
45343          * @param {*} imageKey the image id
45344          * @returns
45345          */
45346         cachedImage: function(imageKey) {
45347           return _cache4.images.forImageId[imageKey];
45348         },
45349         /**
45350          * Fetches images data for the visible area
45351          * @param {*} projection Current Projection
45352          */
45353         loadImages: function(projection2) {
45354           loadTiles5("images", tileUrl2, imageMinZoom, projection2);
45355         },
45356         /**
45357          * Fetches sequences data for the visible area
45358          * @param {*} projection Current Projection
45359          */
45360         loadLines: function(projection2, zoom) {
45361           loadTiles5("line", tileUrl2, lineMinZoom, projection2, zoom);
45362         },
45363         /**
45364          * Fetches all possible userIDs from Panoramax
45365          * @param {string} usernames one or multiple usernames
45366          * @returns userIDs
45367          */
45368         getUserIds: async function(usernames) {
45369           const requestUrls = usernames.map((username) => userIdUrl.replace("{username}", username));
45370           const responses = await Promise.all(requestUrls.map((requestUrl) => fetch(requestUrl, { method: "GET" })));
45371           if (responses.some((response) => !response.ok)) {
45372             const response = responses.find((response2) => !response2.ok);
45373             throw new Error(response.status + " " + response.statusText);
45374           }
45375           const data = await Promise.all(responses.map((response) => response.json()));
45376           return data.flatMap((d2, i3) => d2.features.filter((f2) => f2.name === usernames[i3]).map((f2) => f2.id));
45377         },
45378         /**
45379          * Get visible sequences from cache
45380          * @param {*} projection Current Projection
45381          * @param {number} zoom Current zoom (if zoom < `lineMinZoom` less accurate lines will be drawn)
45382          * @returns sequences data for the current projection
45383          */
45384         sequences: function(projection2, zoom) {
45385           const viewport = projection2.clipExtent();
45386           const min3 = [viewport[0][0], viewport[1][1]];
45387           const max3 = [viewport[1][0], viewport[0][1]];
45388           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
45389           const sequenceIds = {};
45390           let lineStrings = [];
45391           if (zoom >= imageMinZoom) {
45392             _cache4.images.rtree.search(bbox2).forEach(function(d2) {
45393               if (d2.data.sequence_id) {
45394                 sequenceIds[d2.data.sequence_id] = true;
45395               }
45396             });
45397             Object.keys(sequenceIds).forEach(function(sequenceId) {
45398               if (_cache4.sequences.lineString[sequenceId]) {
45399                 lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
45400               }
45401             });
45402             return lineStrings;
45403           }
45404           if (zoom >= lineMinZoom) {
45405             Object.keys(_cache4.mockSequences.lineString).forEach(function(sequenceId) {
45406               lineStrings = lineStrings.concat(_cache4.mockSequences.lineString[sequenceId]);
45407             });
45408           }
45409           return lineStrings;
45410         },
45411         /**
45412          * Updates the data for the currently visible image
45413          * @param {*} image Image data
45414          */
45415         setActiveImage: function(image) {
45416           if (image && image.id && image.sequence_id) {
45417             _activeImage2 = {
45418               id: image.id,
45419               sequence_id: image.sequence_id,
45420               loc: image.loc
45421             };
45422           } else {
45423             _activeImage2 = null;
45424           }
45425         },
45426         getActiveImage: function() {
45427           return _activeImage2;
45428         },
45429         /**
45430          * Update the currently highlighted sequence and selected bubble
45431          * @param {*} context Current HTML context
45432          * @param {*} [hovered] The hovered bubble image
45433          */
45434         setStyles: function(context, hovered) {
45435           const hoveredImageId = hovered && hovered.id;
45436           const hoveredSequenceId = hovered && hovered.sequence_id;
45437           const selectedSequenceId = _activeImage2 && _activeImage2.sequence_id;
45438           const selectedImageId = _activeImage2 && _activeImage2.id;
45439           const markers = context.container().selectAll(".layer-panoramax .viewfield-group");
45440           const sequences = context.container().selectAll(".layer-panoramax .sequence");
45441           markers.classed("highlighted", function(d2) {
45442             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
45443           }).classed("hovered", function(d2) {
45444             return d2.id === hoveredImageId;
45445           }).classed("currentView", function(d2) {
45446             return d2.id === selectedImageId;
45447           });
45448           sequences.classed("highlighted", function(d2) {
45449             return d2.properties.id === hoveredSequenceId;
45450           }).classed("currentView", function(d2) {
45451             return d2.properties.id === selectedSequenceId;
45452           });
45453           context.container().selectAll(".layer-panoramax .viewfield-group .viewfield").attr("d", viewfieldPath);
45454           function viewfieldPath() {
45455             let d2 = this.parentNode.__data__;
45456             if (d2.isPano && d2.id !== selectedImageId) {
45457               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
45458             } else {
45459               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
45460             }
45461           }
45462           return this;
45463         },
45464         // Get viewer status
45465         isViewerOpen: function() {
45466           return _isViewerOpen2;
45467         },
45468         /**
45469          * Updates the URL to save the current shown image
45470          * @param {*} imageKey
45471          */
45472         updateUrlImage: function(imageKey) {
45473           const hash2 = utilStringQs(window.location.hash);
45474           if (imageKey) {
45475             hash2.photo = "panoramax/" + imageKey;
45476           } else {
45477             delete hash2.photo;
45478           }
45479           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
45480         },
45481         /**
45482          * Loads the selected image in the frame
45483          * @param {*} context Current HTML context
45484          * @param {*} id of the selected image
45485          * @returns
45486          */
45487         selectImage: function(context, id2) {
45488           let that = this;
45489           let d2 = that.cachedImage(id2);
45490           that.setActiveImage(d2);
45491           that.updateUrlImage(d2.id);
45492           const viewerLink = `${viewerUrl}#pic=${d2.id}&focus=pic`;
45493           let viewer = context.container().select(".photoviewer");
45494           if (!viewer.empty()) viewer.datum(d2);
45495           this.setStyles(context, null);
45496           if (!d2) return this;
45497           let wrap2 = context.container().select(".photoviewer .panoramax-wrapper");
45498           let attribution = wrap2.selectAll(".photo-attribution").text("");
45499           let line1 = attribution.append("div").attr("class", "attribution-row");
45500           const hdDomId = utilUniqueDomId("panoramax-hd");
45501           let label = line1.append("label").attr("for", hdDomId).attr("class", "panoramax-hd");
45502           label.append("input").attr("type", "checkbox").attr("id", hdDomId).property("checked", _isHD).on("click", (d3_event) => {
45503             d3_event.stopPropagation();
45504             _isHD = !_isHD;
45505             _definition = _isHD ? highDefinition : standardDefinition;
45506             that.selectImage(context, d2.id).showViewer(context);
45507           });
45508           label.append("span").call(_t.append("panoramax.hd"));
45509           if (d2.capture_time) {
45510             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
45511             attribution.append("span").text("|");
45512           }
45513           attribution.append("a").attr("class", "report-photo").attr("href", "mailto:signalement.ign@panoramax.fr").call(_t.append("panoramax.report"));
45514           attribution.append("span").text("|");
45515           attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", viewerLink).text("panoramax.xyz");
45516           this.getImageData(d2.sequence_id, d2.id).then(function(data) {
45517             _currentScene = {
45518               currentImage: null,
45519               nextImage: null,
45520               prevImage: null
45521             };
45522             _currentScene.currentImage = data.assets[_definition];
45523             const nextIndex = data.links.findIndex((x2) => x2.rel === "next");
45524             const prevIndex = data.links.findIndex((x2) => x2.rel === "prev");
45525             if (nextIndex !== -1) {
45526               _currentScene.nextImage = data.links[nextIndex];
45527             }
45528             if (prevIndex !== -1) {
45529               _currentScene.prevImage = data.links[prevIndex];
45530             }
45531             d2.image_path = _currentScene.currentImage.href;
45532             wrap2.selectAll("button.back").classed("hide", _currentScene.prevImage === null);
45533             wrap2.selectAll("button.forward").classed("hide", _currentScene.nextImage === null);
45534             _currentFrame2 = d2.isPano ? _pannellumFrame2 : _planeFrame2;
45535             _currentFrame2.showPhotoFrame(wrap2).selectPhoto(d2, true);
45536           });
45537           function localeDateString2(s2) {
45538             if (!s2) return null;
45539             var options = { day: "numeric", month: "short", year: "numeric" };
45540             var d4 = new Date(s2);
45541             if (isNaN(d4.getTime())) return null;
45542             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options);
45543           }
45544           if (d2.account_id) {
45545             attribution.append("span").text("|");
45546             let line2 = attribution.append("span").attr("class", "attribution-row");
45547             getUsername(d2.account_id).then(function(username) {
45548               line2.append("span").attr("class", "captured_by").text("@" + username);
45549             });
45550           }
45551           return this;
45552         },
45553         photoFrame: function() {
45554           return _currentFrame2;
45555         },
45556         /**
45557          * Fetches the data for a specific image
45558          * @param {*} collectionId
45559          * @param {*} imageId
45560          * @returns The fetched image data
45561          */
45562         getImageData: async function(collectionId, imageId) {
45563           const cache = _cache4.sequences.items;
45564           if (cache[collectionId]) {
45565             const cached = cache[collectionId].find((d2) => d2.id === imageId);
45566             if (cached) return cached;
45567           } else {
45568             const response = await fetch(
45569               sequenceDataUrl.replace("{collectionId}", collectionId),
45570               { method: "GET" }
45571             );
45572             if (!response.ok) {
45573               throw new Error(response.status + " " + response.statusText);
45574             }
45575             const data = (await response.json()).features;
45576             cache[collectionId] = data;
45577           }
45578           const result = cache[collectionId].find((d2) => d2.id === imageId);
45579           if (result) return result;
45580           const itemResponse = await fetch(
45581             imageDataUrl.replace("{collectionId}", collectionId).replace("{itemId}", imageId),
45582             { method: "GET" }
45583           );
45584           if (!itemResponse.ok) {
45585             throw new Error(itemResponse.status + " " + itemResponse.statusText);
45586           }
45587           const itemData = await itemResponse.json();
45588           cache[collectionId].push(itemData);
45589           return itemData;
45590         },
45591         ensureViewerLoaded: function(context) {
45592           let that = this;
45593           let imgWrap = context.container().select("#ideditor-viewer-panoramax-simple > img");
45594           if (!imgWrap.empty()) {
45595             imgWrap.remove();
45596           }
45597           if (_loadViewerPromise6) return _loadViewerPromise6;
45598           let wrap2 = context.container().select(".photoviewer").selectAll(".panoramax-wrapper").data([0]);
45599           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper panoramax-wrapper").classed("hide", true).on("dblclick.zoom", null);
45600           wrapEnter.append("div").attr("class", "photo-attribution fillD");
45601           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-panoramax");
45602           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
45603           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
45604           _loadViewerPromise6 = Promise.all([
45605             pannellum_photo_default.init(context, wrapEnter),
45606             plane_photo_default.init(context, wrapEnter)
45607           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
45608             _pannellumFrame2 = pannellumPhotoFrame;
45609             _pannellumFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
45610             _planeFrame2 = planePhotoFrame;
45611             _planeFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
45612           });
45613           function step(stepBy) {
45614             return function() {
45615               if (!_currentScene.currentImage) return;
45616               let nextId;
45617               if (stepBy === 1) nextId = _currentScene.nextImage.id;
45618               else nextId = _currentScene.prevImage.id;
45619               if (!nextId) return;
45620               const nextImage = _cache4.images.forImageId[nextId];
45621               if (nextImage) {
45622                 context.map().centerEase(nextImage.loc);
45623                 that.selectImage(context, nextImage.id);
45624               }
45625             };
45626           }
45627           return _loadViewerPromise6;
45628         },
45629         /**
45630          * Shows the current viewer if hidden
45631          * @param {*} context
45632          */
45633         showViewer: function(context) {
45634           const wrap2 = context.container().select(".photoviewer");
45635           const isHidden = wrap2.selectAll(".photo-wrapper.panoramax-wrapper.hide").size();
45636           if (isHidden) {
45637             for (const service of Object.values(services)) {
45638               if (service === this) continue;
45639               if (typeof service.hideViewer === "function") {
45640                 service.hideViewer(context);
45641               }
45642             }
45643             wrap2.classed("hide", false).selectAll(".photo-wrapper.panoramax-wrapper").classed("hide", false);
45644           }
45645           _isViewerOpen2 = true;
45646           return this;
45647         },
45648         /**
45649          * Hides the current viewer if shown, resets the active image and sequence
45650          * @param {*} context
45651          */
45652         hideViewer: function(context) {
45653           let viewer = context.container().select(".photoviewer");
45654           if (!viewer.empty()) viewer.datum(null);
45655           this.updateUrlImage(null);
45656           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
45657           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
45658           this.setActiveImage(null);
45659           _isViewerOpen2 = false;
45660           return this.setStyles(context, null);
45661         },
45662         cache: function() {
45663           return _cache4;
45664         }
45665       };
45666     }
45667   });
45668
45669   // modules/services/index.js
45670   var services_exports = {};
45671   __export(services_exports, {
45672     serviceKartaview: () => kartaview_default,
45673     serviceKeepRight: () => keepRight_default,
45674     serviceMapRules: () => maprules_default,
45675     serviceMapilio: () => mapilio_default,
45676     serviceMapillary: () => mapillary_default,
45677     serviceNominatim: () => nominatim_default,
45678     serviceNsi: () => nsi_default,
45679     serviceOsm: () => osm_default,
45680     serviceOsmWikibase: () => osm_wikibase_default,
45681     serviceOsmose: () => osmose_default,
45682     servicePanoramax: () => panoramax_default,
45683     serviceStreetside: () => streetside_default,
45684     serviceTaginfo: () => taginfo_default,
45685     serviceVectorTile: () => vector_tile_default,
45686     serviceVegbilder: () => vegbilder_default,
45687     serviceWikidata: () => wikidata_default,
45688     serviceWikipedia: () => wikipedia_default,
45689     services: () => services
45690   });
45691   var services;
45692   var init_services = __esm({
45693     "modules/services/index.js"() {
45694       "use strict";
45695       init_keepRight();
45696       init_osmose();
45697       init_mapillary();
45698       init_maprules();
45699       init_nominatim();
45700       init_nsi();
45701       init_kartaview();
45702       init_vegbilder();
45703       init_osm2();
45704       init_osm_wikibase();
45705       init_streetside();
45706       init_taginfo();
45707       init_vector_tile2();
45708       init_wikidata();
45709       init_wikipedia();
45710       init_mapilio();
45711       init_panoramax();
45712       services = {
45713         geocoder: nominatim_default,
45714         keepRight: keepRight_default,
45715         osmose: osmose_default,
45716         mapillary: mapillary_default,
45717         nsi: nsi_default,
45718         kartaview: kartaview_default,
45719         vegbilder: vegbilder_default,
45720         osm: osm_default,
45721         osmWikibase: osm_wikibase_default,
45722         maprules: maprules_default,
45723         streetside: streetside_default,
45724         taginfo: taginfo_default,
45725         vectorTile: vector_tile_default,
45726         wikidata: wikidata_default,
45727         wikipedia: wikipedia_default,
45728         mapilio: mapilio_default,
45729         panoramax: panoramax_default
45730       };
45731     }
45732   });
45733
45734   // modules/validations/almost_junction.js
45735   var almost_junction_exports = {};
45736   __export(almost_junction_exports, {
45737     validationAlmostJunction: () => validationAlmostJunction
45738   });
45739   function validationAlmostJunction(context) {
45740     const type2 = "almost_junction";
45741     const EXTEND_TH_METERS = 5;
45742     const WELD_TH_METERS = 0.75;
45743     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
45744     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
45745     function isHighway(entity) {
45746       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
45747     }
45748     function isTaggedAsNotContinuing(node) {
45749       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
45750     }
45751     const validation = function checkAlmostJunction(entity, graph) {
45752       if (!isHighway(entity)) return [];
45753       if (entity.isDegenerate()) return [];
45754       const tree = context.history().tree();
45755       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
45756       let issues = [];
45757       extendableNodeInfos.forEach((extendableNodeInfo) => {
45758         issues.push(new validationIssue({
45759           type: type2,
45760           subtype: "highway-highway",
45761           severity: "warning",
45762           message: function(context2) {
45763             const entity1 = context2.hasEntity(this.entityIds[0]);
45764             if (this.entityIds[0] === this.entityIds[2]) {
45765               return entity1 ? _t.append("issues.almost_junction.self.message", {
45766                 feature: utilDisplayLabel(entity1, context2.graph())
45767               }) : "";
45768             } else {
45769               const entity2 = context2.hasEntity(this.entityIds[2]);
45770               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
45771                 feature: utilDisplayLabel(entity1, context2.graph()),
45772                 feature2: utilDisplayLabel(entity2, context2.graph())
45773               }) : "";
45774             }
45775           },
45776           reference: showReference,
45777           entityIds: [
45778             entity.id,
45779             extendableNodeInfo.node.id,
45780             extendableNodeInfo.wid
45781           ],
45782           loc: extendableNodeInfo.node.loc,
45783           hash: JSON.stringify(extendableNodeInfo.node.loc),
45784           data: {
45785             midId: extendableNodeInfo.mid.id,
45786             edge: extendableNodeInfo.edge,
45787             cross_loc: extendableNodeInfo.cross_loc
45788           },
45789           dynamicFixes: makeFixes
45790         }));
45791       });
45792       return issues;
45793       function makeFixes(context2) {
45794         let fixes = [new validationIssueFix({
45795           icon: "iD-icon-abutment",
45796           title: _t.append("issues.fix.connect_features.title"),
45797           onClick: function(context3) {
45798             const annotation = _t("issues.fix.connect_almost_junction.annotation");
45799             const [, endNodeId, crossWayId] = this.issue.entityIds;
45800             const midNode = context3.entity(this.issue.data.midId);
45801             const endNode = context3.entity(endNodeId);
45802             const crossWay = context3.entity(crossWayId);
45803             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
45804             if (nearEndNodes.length > 0) {
45805               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
45806               if (collinear) {
45807                 context3.perform(
45808                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
45809                   annotation
45810                 );
45811                 return;
45812               }
45813             }
45814             const targetEdge = this.issue.data.edge;
45815             const crossLoc = this.issue.data.cross_loc;
45816             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
45817             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
45818             if (closestNodeInfo.distance < WELD_TH_METERS) {
45819               context3.perform(
45820                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
45821                 annotation
45822               );
45823             } else {
45824               context3.perform(
45825                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
45826                 annotation
45827               );
45828             }
45829           }
45830         })];
45831         const node = context2.hasEntity(this.entityIds[1]);
45832         if (node && !node.hasInterestingTags()) {
45833           fixes.push(new validationIssueFix({
45834             icon: "maki-barrier",
45835             title: _t.append("issues.fix.tag_as_disconnected.title"),
45836             onClick: function(context3) {
45837               const nodeID = this.issue.entityIds[1];
45838               const tags = Object.assign({}, context3.entity(nodeID).tags);
45839               tags.noexit = "yes";
45840               context3.perform(
45841                 actionChangeTags(nodeID, tags),
45842                 _t("issues.fix.tag_as_disconnected.annotation")
45843               );
45844             }
45845           }));
45846         }
45847         return fixes;
45848       }
45849       function showReference(selection2) {
45850         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
45851       }
45852       function isExtendableCandidate(node, way) {
45853         const osm = services.osm;
45854         if (osm && !osm.isDataLoaded(node.loc)) {
45855           return false;
45856         }
45857         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
45858           return false;
45859         }
45860         let occurrences = 0;
45861         for (const index in way.nodes) {
45862           if (way.nodes[index] === node.id) {
45863             occurrences += 1;
45864             if (occurrences > 1) {
45865               return false;
45866             }
45867           }
45868         }
45869         return true;
45870       }
45871       function findConnectableEndNodesByExtension(way) {
45872         let results = [];
45873         if (way.isClosed()) return results;
45874         let testNodes;
45875         const indices = [0, way.nodes.length - 1];
45876         indices.forEach((nodeIndex) => {
45877           const nodeID = way.nodes[nodeIndex];
45878           const node = graph.entity(nodeID);
45879           if (!isExtendableCandidate(node, way)) return;
45880           const connectionInfo = canConnectByExtend(way, nodeIndex);
45881           if (!connectionInfo) return;
45882           testNodes = graph.childNodes(way).slice();
45883           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
45884           if (geoHasSelfIntersections(testNodes, nodeID)) return;
45885           results.push(connectionInfo);
45886         });
45887         return results;
45888       }
45889       function findNearbyEndNodes(node, way) {
45890         return [
45891           way.nodes[0],
45892           way.nodes[way.nodes.length - 1]
45893         ].map((d2) => graph.entity(d2)).filter((d2) => {
45894           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
45895         });
45896       }
45897       function findSmallJoinAngle(midNode, tipNode, endNodes) {
45898         let joinTo;
45899         let minAngle = Infinity;
45900         endNodes.forEach((endNode) => {
45901           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
45902           const a22 = geoAngle(midNode, endNode, context.projection) + Math.PI;
45903           const diff = Math.max(a1, a22) - Math.min(a1, a22);
45904           if (diff < minAngle) {
45905             joinTo = endNode;
45906             minAngle = diff;
45907           }
45908         });
45909         if (minAngle <= SIG_ANGLE_TH) return joinTo;
45910         return null;
45911       }
45912       function hasTag(tags, key) {
45913         return tags[key] !== void 0 && tags[key] !== "no";
45914       }
45915       function canConnectWays(way, way2) {
45916         if (way.id === way2.id) return true;
45917         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge"))) return false;
45918         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel"))) return false;
45919         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
45920         if (layer1 !== layer2) return false;
45921         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
45922         if (level1 !== level2) return false;
45923         return true;
45924       }
45925       function canConnectByExtend(way, endNodeIdx) {
45926         const tipNid = way.nodes[endNodeIdx];
45927         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
45928         const tipNode = graph.entity(tipNid);
45929         const midNode = graph.entity(midNid);
45930         const lon = tipNode.loc[0];
45931         const lat = tipNode.loc[1];
45932         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
45933         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
45934         const queryExtent = geoExtent([
45935           [lon - lon_range, lat - lat_range],
45936           [lon + lon_range, lat + lat_range]
45937         ]);
45938         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
45939         const t2 = EXTEND_TH_METERS / edgeLen + 1;
45940         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
45941         const segmentInfos = tree.waySegments(queryExtent, graph);
45942         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
45943           let segmentInfo = segmentInfos[i3];
45944           let way2 = graph.entity(segmentInfo.wayId);
45945           if (!isHighway(way2)) continue;
45946           if (!canConnectWays(way, way2)) continue;
45947           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
45948           if (nAid === tipNid || nBid === tipNid) continue;
45949           let nA = graph.entity(nAid), nB = graph.entity(nBid);
45950           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
45951           if (crossLoc) {
45952             return {
45953               mid: midNode,
45954               node: tipNode,
45955               wid: way2.id,
45956               edge: [nA.id, nB.id],
45957               cross_loc: crossLoc
45958             };
45959           }
45960         }
45961         return null;
45962       }
45963     };
45964     validation.type = type2;
45965     return validation;
45966   }
45967   var init_almost_junction = __esm({
45968     "modules/validations/almost_junction.js"() {
45969       "use strict";
45970       init_geo2();
45971       init_add_midpoint();
45972       init_change_tags();
45973       init_merge_nodes();
45974       init_localizer();
45975       init_utilDisplayLabel();
45976       init_tags();
45977       init_validation();
45978       init_services();
45979     }
45980   });
45981
45982   // modules/validations/close_nodes.js
45983   var close_nodes_exports = {};
45984   __export(close_nodes_exports, {
45985     validationCloseNodes: () => validationCloseNodes
45986   });
45987   function validationCloseNodes(context) {
45988     var type2 = "close_nodes";
45989     var pointThresholdMeters = 0.2;
45990     var validation = function(entity, graph) {
45991       if (entity.type === "node") {
45992         return getIssuesForNode(entity);
45993       } else if (entity.type === "way") {
45994         return getIssuesForWay(entity);
45995       }
45996       return [];
45997       function getIssuesForNode(node) {
45998         var parentWays = graph.parentWays(node);
45999         if (parentWays.length) {
46000           return getIssuesForVertex(node, parentWays);
46001         } else {
46002           return getIssuesForDetachedPoint(node);
46003         }
46004       }
46005       function wayTypeFor(way) {
46006         if (way.tags.boundary && way.tags.boundary !== "no") return "boundary";
46007         if (way.tags.indoor && way.tags.indoor !== "no") return "indoor";
46008         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no") return "building";
46009         if (osmPathHighwayTagValues[way.tags.highway]) return "path";
46010         var parentRelations = graph.parentRelations(way);
46011         for (var i3 in parentRelations) {
46012           var relation = parentRelations[i3];
46013           if (relation.tags.type === "boundary") return "boundary";
46014           if (relation.isMultipolygon()) {
46015             if (relation.tags.indoor && relation.tags.indoor !== "no") return "indoor";
46016             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no") return "building";
46017           }
46018         }
46019         return "other";
46020       }
46021       function shouldCheckWay(way) {
46022         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4) return false;
46023         var bbox2 = way.extent(graph).bbox();
46024         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
46025         if (hypotenuseMeters < 1.5) return false;
46026         return true;
46027       }
46028       function getIssuesForWay(way) {
46029         if (!shouldCheckWay(way)) return [];
46030         var issues = [], nodes = graph.childNodes(way);
46031         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
46032           var node1 = nodes[i3];
46033           var node2 = nodes[i3 + 1];
46034           var issue = getWayIssueIfAny(node1, node2, way);
46035           if (issue) issues.push(issue);
46036         }
46037         return issues;
46038       }
46039       function getIssuesForVertex(node, parentWays) {
46040         var issues = [];
46041         function checkForCloseness(node1, node2, way) {
46042           var issue = getWayIssueIfAny(node1, node2, way);
46043           if (issue) issues.push(issue);
46044         }
46045         for (var i3 = 0; i3 < parentWays.length; i3++) {
46046           var parentWay = parentWays[i3];
46047           if (!shouldCheckWay(parentWay)) continue;
46048           var lastIndex = parentWay.nodes.length - 1;
46049           for (var j3 = 0; j3 < parentWay.nodes.length; j3++) {
46050             if (j3 !== 0) {
46051               if (parentWay.nodes[j3 - 1] === node.id) {
46052                 checkForCloseness(node, graph.entity(parentWay.nodes[j3]), parentWay);
46053               }
46054             }
46055             if (j3 !== lastIndex) {
46056               if (parentWay.nodes[j3 + 1] === node.id) {
46057                 checkForCloseness(graph.entity(parentWay.nodes[j3]), node, parentWay);
46058               }
46059             }
46060           }
46061         }
46062         return issues;
46063       }
46064       function thresholdMetersForWay(way) {
46065         if (!shouldCheckWay(way)) return 0;
46066         var wayType = wayTypeFor(way);
46067         if (wayType === "boundary") return 0;
46068         if (wayType === "indoor") return 0.01;
46069         if (wayType === "building") return 0.05;
46070         if (wayType === "path") return 0.1;
46071         return 0.2;
46072       }
46073       function getIssuesForDetachedPoint(node) {
46074         var issues = [];
46075         var lon = node.loc[0];
46076         var lat = node.loc[1];
46077         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
46078         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
46079         var queryExtent = geoExtent([
46080           [lon - lon_range, lat - lat_range],
46081           [lon + lon_range, lat + lat_range]
46082         ]);
46083         var intersected = context.history().tree().intersects(queryExtent, graph);
46084         for (var j3 = 0; j3 < intersected.length; j3++) {
46085           var nearby = intersected[j3];
46086           if (nearby.id === node.id) continue;
46087           if (nearby.type !== "node" || nearby.geometry(graph) !== "point") continue;
46088           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
46089             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein") continue;
46090             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein") continue;
46091             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
46092             var zAxisDifferentiates = false;
46093             for (var key in zAxisKeys) {
46094               var nodeValue = node.tags[key] || "0";
46095               var nearbyValue = nearby.tags[key] || "0";
46096               if (nodeValue !== nearbyValue) {
46097                 zAxisDifferentiates = true;
46098                 break;
46099               }
46100             }
46101             if (zAxisDifferentiates) continue;
46102             issues.push(new validationIssue({
46103               type: type2,
46104               subtype: "detached",
46105               severity: "warning",
46106               message: function(context2) {
46107                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
46108                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
46109                   feature: utilDisplayLabel(entity2, context2.graph()),
46110                   feature2: utilDisplayLabel(entity22, context2.graph())
46111                 }) : "";
46112               },
46113               reference: showReference,
46114               entityIds: [node.id, nearby.id],
46115               dynamicFixes: function() {
46116                 return [
46117                   new validationIssueFix({
46118                     icon: "iD-operation-disconnect",
46119                     title: _t.append("issues.fix.move_points_apart.title")
46120                   }),
46121                   new validationIssueFix({
46122                     icon: "iD-icon-layers",
46123                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
46124                   })
46125                 ];
46126               }
46127             }));
46128           }
46129         }
46130         return issues;
46131         function showReference(selection2) {
46132           var referenceText = _t("issues.close_nodes.detached.reference");
46133           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
46134         }
46135       }
46136       function getWayIssueIfAny(node1, node2, way) {
46137         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
46138           return null;
46139         }
46140         if (node1.loc !== node2.loc) {
46141           var parentWays1 = graph.parentWays(node1);
46142           var parentWays2 = new Set(graph.parentWays(node2));
46143           var sharedWays = parentWays1.filter(function(parentWay) {
46144             return parentWays2.has(parentWay);
46145           });
46146           var thresholds = sharedWays.map(function(parentWay) {
46147             return thresholdMetersForWay(parentWay);
46148           });
46149           var threshold = Math.min(...thresholds);
46150           var distance = geoSphericalDistance(node1.loc, node2.loc);
46151           if (distance > threshold) return null;
46152         }
46153         return new validationIssue({
46154           type: type2,
46155           subtype: "vertices",
46156           severity: "warning",
46157           message: function(context2) {
46158             var entity2 = context2.hasEntity(this.entityIds[0]);
46159             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
46160           },
46161           reference: showReference,
46162           entityIds: [way.id, node1.id, node2.id],
46163           loc: node1.loc,
46164           dynamicFixes: function() {
46165             return [
46166               new validationIssueFix({
46167                 icon: "iD-icon-plus",
46168                 title: _t.append("issues.fix.merge_points.title"),
46169                 onClick: function(context2) {
46170                   var entityIds = this.issue.entityIds;
46171                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
46172                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
46173                 }
46174               }),
46175               new validationIssueFix({
46176                 icon: "iD-operation-disconnect",
46177                 title: _t.append("issues.fix.move_points_apart.title")
46178               })
46179             ];
46180           }
46181         });
46182         function showReference(selection2) {
46183           var referenceText = _t("issues.close_nodes.reference");
46184           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
46185         }
46186       }
46187     };
46188     validation.type = type2;
46189     return validation;
46190   }
46191   var init_close_nodes = __esm({
46192     "modules/validations/close_nodes.js"() {
46193       "use strict";
46194       init_merge_nodes();
46195       init_utilDisplayLabel();
46196       init_localizer();
46197       init_validation();
46198       init_tags();
46199       init_geo();
46200       init_extent();
46201     }
46202   });
46203
46204   // modules/validations/crossing_ways.js
46205   var crossing_ways_exports = {};
46206   __export(crossing_ways_exports, {
46207     validationCrossingWays: () => validationCrossingWays
46208   });
46209   function validationCrossingWays(context) {
46210     var type2 = "crossing_ways";
46211     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
46212       if (getFeatureType(way, graph) === null) {
46213         var parentRels = graph.parentRelations(way);
46214         for (var i3 = 0; i3 < parentRels.length; i3++) {
46215           var rel = parentRels[i3];
46216           if (getFeatureType(rel, graph) !== null) {
46217             return rel;
46218           }
46219         }
46220       }
46221       return way;
46222     }
46223     function hasTag(tags, key) {
46224       return tags[key] !== void 0 && tags[key] !== "no";
46225     }
46226     function taggedAsIndoor(tags) {
46227       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
46228     }
46229     function allowsBridge(featureType) {
46230       return featureType === "highway" || featureType === "railway" || featureType === "waterway" || featureType === "aeroway";
46231     }
46232     function allowsTunnel(featureType) {
46233       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
46234     }
46235     var ignoredBuildings = {
46236       demolished: true,
46237       dismantled: true,
46238       proposed: true,
46239       razed: true
46240     };
46241     function getFeatureType(entity, graph) {
46242       var geometry = entity.geometry(graph);
46243       if (geometry !== "line" && geometry !== "area") return null;
46244       var tags = entity.tags;
46245       if (tags.aeroway in osmRoutableAerowayTags) return "aeroway";
46246       if (hasTag(tags, "building") && !ignoredBuildings[tags.building]) return "building";
46247       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway]) return "highway";
46248       if (geometry !== "line") return null;
46249       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway]) return "railway";
46250       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway]) return "waterway";
46251       return null;
46252     }
46253     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
46254       var level1 = tags1.level || "0";
46255       var level2 = tags2.level || "0";
46256       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
46257         return true;
46258       }
46259       var layer1 = tags1.layer || "0";
46260       var layer2 = tags2.layer || "0";
46261       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
46262         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge")) return true;
46263         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge")) return true;
46264         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2) return true;
46265       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge")) return true;
46266       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge")) return true;
46267       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
46268         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel")) return true;
46269         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel")) return true;
46270         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2) return true;
46271       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel")) return true;
46272       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel")) return true;
46273       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier") return true;
46274       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier") return true;
46275       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
46276         if (layer1 !== layer2) return true;
46277       }
46278       return false;
46279     }
46280     var highwaysDisallowingFords = {
46281       motorway: true,
46282       motorway_link: true,
46283       trunk: true,
46284       trunk_link: true,
46285       primary: true,
46286       primary_link: true,
46287       secondary: true,
46288       secondary_link: true
46289     };
46290     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
46291       var featureType1 = getFeatureType(entity1, graph);
46292       var featureType2 = getFeatureType(entity2, graph);
46293       var geometry1 = entity1.geometry(graph);
46294       var geometry2 = entity2.geometry(graph);
46295       var bothLines = geometry1 === "line" && geometry2 === "line";
46296       const featureTypes = [featureType1, featureType2].sort().join("-");
46297       if (featureTypes === "aeroway-aeroway") return {};
46298       if (featureTypes === "aeroway-highway") {
46299         const isServiceRoad = entity1.tags.highway === "service" || entity2.tags.highway === "service";
46300         const isPath = entity1.tags.highway in osmPathHighwayTagValues || entity2.tags.highway in osmPathHighwayTagValues;
46301         return isServiceRoad || isPath ? {} : { aeroway: "aircraft_crossing" };
46302       }
46303       if (featureTypes === "aeroway-railway") {
46304         return { aeroway: "aircraft_crossing", railway: "level_crossing" };
46305       }
46306       if (featureTypes === "aeroway-waterway") return null;
46307       if (featureType1 === featureType2) {
46308         if (featureType1 === "highway") {
46309           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
46310           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
46311           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
46312             if (!bothLines) return {};
46313             var roadFeature = entity1IsPath ? entity2 : entity1;
46314             var pathFeature = entity1IsPath ? entity1 : entity2;
46315             if (roadFeature.tags.highway === "track") {
46316               return {};
46317             }
46318             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
46319               return {};
46320             }
46321             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
46322               var tags = { highway: "crossing", crossing: pathFeature.tags.crossing };
46323               if ("crossing:markings" in pathFeature.tags) {
46324                 tags["crossing:markings"] = pathFeature.tags["crossing:markings"];
46325               }
46326               return tags;
46327             }
46328             return { highway: "crossing" };
46329           }
46330           return {};
46331         }
46332         if (featureType1 === "waterway") return {};
46333         if (featureType1 === "railway") return {};
46334       } else {
46335         if (featureTypes.indexOf("highway") !== -1) {
46336           if (featureTypes.indexOf("railway") !== -1) {
46337             if (!bothLines) return {};
46338             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
46339             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
46340               if (isTram) return { railway: "tram_crossing" };
46341               return { railway: "crossing" };
46342             } else {
46343               if (isTram) return { railway: "tram_level_crossing" };
46344               return { railway: "level_crossing" };
46345             }
46346           }
46347           if (featureTypes.indexOf("waterway") !== -1) {
46348             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel")) return null;
46349             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge")) return null;
46350             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
46351               return null;
46352             }
46353             return bothLines ? { ford: "yes" } : {};
46354           }
46355         }
46356       }
46357       return null;
46358     }
46359     function findCrossingsByWay(way1, graph, tree) {
46360       var edgeCrossInfos = [];
46361       if (way1.type !== "way") return edgeCrossInfos;
46362       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
46363       var way1FeatureType = getFeatureType(taggedFeature1, graph);
46364       if (way1FeatureType === null) return edgeCrossInfos;
46365       var checkedSingleCrossingWays = {};
46366       var i3, j3;
46367       var extent;
46368       var n1, n22, nA, nB, nAId, nBId;
46369       var segment1, segment2;
46370       var oneOnly;
46371       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
46372       var way1Nodes = graph.childNodes(way1);
46373       var comparedWays = {};
46374       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
46375         n1 = way1Nodes[i3];
46376         n22 = way1Nodes[i3 + 1];
46377         extent = geoExtent([
46378           [
46379             Math.min(n1.loc[0], n22.loc[0]),
46380             Math.min(n1.loc[1], n22.loc[1])
46381           ],
46382           [
46383             Math.max(n1.loc[0], n22.loc[0]),
46384             Math.max(n1.loc[1], n22.loc[1])
46385           ]
46386         ]);
46387         segmentInfos = tree.waySegments(extent, graph);
46388         for (j3 = 0; j3 < segmentInfos.length; j3++) {
46389           segment2Info = segmentInfos[j3];
46390           if (segment2Info.wayId === way1.id) continue;
46391           if (checkedSingleCrossingWays[segment2Info.wayId]) continue;
46392           comparedWays[segment2Info.wayId] = true;
46393           way2 = graph.hasEntity(segment2Info.wayId);
46394           if (!way2) continue;
46395           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
46396           way2FeatureType = getFeatureType(taggedFeature2, graph);
46397           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
46398             continue;
46399           }
46400           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
46401           nAId = segment2Info.nodes[0];
46402           nBId = segment2Info.nodes[1];
46403           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
46404             continue;
46405           }
46406           nA = graph.hasEntity(nAId);
46407           if (!nA) continue;
46408           nB = graph.hasEntity(nBId);
46409           if (!nB) continue;
46410           segment1 = [n1.loc, n22.loc];
46411           segment2 = [nA.loc, nB.loc];
46412           var point = geoLineIntersection(segment1, segment2);
46413           if (point) {
46414             edgeCrossInfos.push({
46415               wayInfos: [
46416                 {
46417                   way: way1,
46418                   featureType: way1FeatureType,
46419                   edge: [n1.id, n22.id]
46420                 },
46421                 {
46422                   way: way2,
46423                   featureType: way2FeatureType,
46424                   edge: [nA.id, nB.id]
46425                 }
46426               ],
46427               crossPoint: point
46428             });
46429             if (oneOnly) {
46430               checkedSingleCrossingWays[way2.id] = true;
46431               break;
46432             }
46433           }
46434         }
46435       }
46436       return edgeCrossInfos;
46437     }
46438     function waysToCheck(entity, graph) {
46439       var featureType = getFeatureType(entity, graph);
46440       if (!featureType) return [];
46441       if (entity.type === "way") {
46442         return [entity];
46443       } else if (entity.type === "relation") {
46444         return entity.members.reduce(function(array2, member) {
46445           if (member.type === "way" && // only look at geometry ways
46446           (!member.role || member.role === "outer" || member.role === "inner")) {
46447             var entity2 = graph.hasEntity(member.id);
46448             if (entity2 && array2.indexOf(entity2) === -1) {
46449               array2.push(entity2);
46450             }
46451           }
46452           return array2;
46453         }, []);
46454       }
46455       return [];
46456     }
46457     var validation = function checkCrossingWays(entity, graph) {
46458       var tree = context.history().tree();
46459       var ways = waysToCheck(entity, graph);
46460       var issues = [];
46461       var wayIndex, crossingIndex, crossings;
46462       for (wayIndex in ways) {
46463         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
46464         for (crossingIndex in crossings) {
46465           issues.push(createIssue(crossings[crossingIndex], graph));
46466         }
46467       }
46468       return issues;
46469     };
46470     function createIssue(crossing, graph) {
46471       crossing.wayInfos.sort(function(way1Info, way2Info) {
46472         var type1 = way1Info.featureType;
46473         var type22 = way2Info.featureType;
46474         if (type1 === type22) {
46475           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
46476         } else if (type1 === "waterway") {
46477           return true;
46478         } else if (type22 === "waterway") {
46479           return false;
46480         }
46481         return type1 < type22;
46482       });
46483       var entities = crossing.wayInfos.map(function(wayInfo) {
46484         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
46485       });
46486       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
46487       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
46488       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
46489       var featureType1 = crossing.wayInfos[0].featureType;
46490       var featureType2 = crossing.wayInfos[1].featureType;
46491       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
46492       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
46493       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
46494       var subtype = [featureType1, featureType2].sort().join("-");
46495       var crossingTypeID = subtype;
46496       if (isCrossingIndoors) {
46497         crossingTypeID = "indoor-indoor";
46498       } else if (isCrossingTunnels) {
46499         crossingTypeID = "tunnel-tunnel";
46500       } else if (isCrossingBridges) {
46501         crossingTypeID = "bridge-bridge";
46502       }
46503       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
46504         crossingTypeID += "_connectable";
46505       }
46506       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
46507       return new validationIssue({
46508         type: type2,
46509         subtype,
46510         severity: "warning",
46511         message: function(context2) {
46512           var graph2 = context2.graph();
46513           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
46514           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
46515             feature: utilDisplayLabel(entity1, graph2, featureType1 === "building"),
46516             feature2: utilDisplayLabel(entity2, graph2, featureType2 === "building")
46517           }) : "";
46518         },
46519         reference: showReference,
46520         entityIds: entities.map(function(entity) {
46521           return entity.id;
46522         }),
46523         data: {
46524           edges,
46525           featureTypes,
46526           connectionTags
46527         },
46528         hash: uniqueID,
46529         loc: crossing.crossPoint,
46530         dynamicFixes: function(context2) {
46531           var mode = context2.mode();
46532           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1) return [];
46533           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
46534           var selectedFeatureType = this.data.featureTypes[selectedIndex];
46535           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
46536           var fixes = [];
46537           if (connectionTags) {
46538             fixes.push(makeConnectWaysFix(this.data.connectionTags));
46539             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
46540             if (lessLikelyConnectionTags && !isEqual_default(connectionTags, lessLikelyConnectionTags)) {
46541               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
46542             }
46543           }
46544           if (isCrossingIndoors) {
46545             fixes.push(new validationIssueFix({
46546               icon: "iD-icon-layers",
46547               title: _t.append("issues.fix.use_different_levels.title")
46548             }));
46549           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
46550             fixes.push(makeChangeLayerFix("higher"));
46551             fixes.push(makeChangeLayerFix("lower"));
46552           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
46553             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
46554               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
46555             }
46556             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
46557             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
46558               if (selectedFeatureType === "waterway") {
46559                 fixes.push(makeAddBridgeOrTunnelFix("add_a_culvert", "temaki-waste", "tunnel"));
46560               } else {
46561                 fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
46562               }
46563             }
46564           }
46565           fixes.push(new validationIssueFix({
46566             icon: "iD-operation-move",
46567             title: _t.append("issues.fix.reposition_features.title")
46568           }));
46569           return fixes;
46570         }
46571       });
46572       function showReference(selection2) {
46573         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
46574       }
46575     }
46576     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
46577       return new validationIssueFix({
46578         icon: iconName,
46579         title: _t.append("issues.fix." + fixTitleID + ".title"),
46580         onClick: function(context2) {
46581           var mode = context2.mode();
46582           if (!mode || mode.id !== "select") return;
46583           var selectedIDs = mode.selectedIDs();
46584           if (selectedIDs.length !== 1) return;
46585           var selectedWayID = selectedIDs[0];
46586           if (!context2.hasEntity(selectedWayID)) return;
46587           var resultWayIDs = [selectedWayID];
46588           var edge, crossedEdge, crossedWayID;
46589           if (this.issue.entityIds[0] === selectedWayID) {
46590             edge = this.issue.data.edges[0];
46591             crossedEdge = this.issue.data.edges[1];
46592             crossedWayID = this.issue.entityIds[1];
46593           } else {
46594             edge = this.issue.data.edges[1];
46595             crossedEdge = this.issue.data.edges[0];
46596             crossedWayID = this.issue.entityIds[0];
46597           }
46598           var crossingLoc = this.issue.loc;
46599           var projection2 = context2.projection;
46600           var action = function actionAddStructure(graph) {
46601             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
46602             var crossedWay = graph.hasEntity(crossedWayID);
46603             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
46604             if (!structLengthMeters) {
46605               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
46606             }
46607             if (structLengthMeters) {
46608               if (getFeatureType(crossedWay, graph) === "railway") {
46609                 structLengthMeters *= 2;
46610               }
46611             } else {
46612               structLengthMeters = 8;
46613             }
46614             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
46615             var a22 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
46616             var crossingAngle = Math.max(a1, a22) - Math.min(a1, a22);
46617             if (crossingAngle > Math.PI) crossingAngle -= Math.PI;
46618             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
46619             structLengthMeters += 4;
46620             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
46621             function geomToProj(geoPoint) {
46622               return [
46623                 geoLonToMeters(geoPoint[0], geoPoint[1]),
46624                 geoLatToMeters(geoPoint[1])
46625               ];
46626             }
46627             function projToGeom(projPoint) {
46628               var lat = geoMetersToLat(projPoint[1]);
46629               return [
46630                 geoMetersToLon(projPoint[0], lat),
46631                 lat
46632               ];
46633             }
46634             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
46635             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
46636             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
46637             var projectedCrossingLoc = geomToProj(crossingLoc);
46638             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
46639             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
46640               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
46641               return projToGeom([
46642                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
46643                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
46644               ]);
46645             }
46646             var endpointLocGetter1 = function(lengthMeters) {
46647               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
46648             };
46649             var endpointLocGetter2 = function(lengthMeters) {
46650               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
46651             };
46652             var minEdgeLengthMeters = 0.55;
46653             function determineEndpoint(edge2, endNode, locGetter) {
46654               var newNode;
46655               var idealLengthMeters = structLengthMeters / 2;
46656               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
46657               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
46658                 var idealNodeLoc = locGetter(idealLengthMeters);
46659                 newNode = osmNode();
46660                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
46661               } else {
46662                 var edgeCount = 0;
46663                 endNode.parentIntersectionWays(graph).forEach(function(way) {
46664                   way.nodes.forEach(function(nodeID) {
46665                     if (nodeID === endNode.id) {
46666                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
46667                         edgeCount += 1;
46668                       } else {
46669                         edgeCount += 2;
46670                       }
46671                     }
46672                   });
46673                 });
46674                 if (edgeCount >= 3) {
46675                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
46676                   if (insetLength > minEdgeLengthMeters) {
46677                     var insetNodeLoc = locGetter(insetLength);
46678                     newNode = osmNode();
46679                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
46680                   }
46681                 }
46682               }
46683               if (!newNode) newNode = endNode;
46684               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
46685               graph = splitAction(graph);
46686               if (splitAction.getCreatedWayIDs().length) {
46687                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
46688               }
46689               return newNode;
46690             }
46691             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
46692             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
46693             var structureWay = resultWayIDs.map(function(id2) {
46694               return graph.entity(id2);
46695             }).find(function(way) {
46696               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
46697             });
46698             var tags = Object.assign({}, structureWay.tags);
46699             if (bridgeOrTunnel === "bridge") {
46700               tags.bridge = "yes";
46701               tags.layer = "1";
46702             } else {
46703               var tunnelValue = "yes";
46704               if (getFeatureType(structureWay, graph) === "waterway") {
46705                 tunnelValue = "culvert";
46706               }
46707               tags.tunnel = tunnelValue;
46708               tags.layer = "-1";
46709             }
46710             graph = actionChangeTags(structureWay.id, tags)(graph);
46711             return graph;
46712           };
46713           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
46714           context2.enter(modeSelect(context2, resultWayIDs));
46715         }
46716       });
46717     }
46718     function makeConnectWaysFix(connectionTags) {
46719       var fixTitleID = "connect_features";
46720       var fixIcon = "iD-icon-crossing";
46721       if (connectionTags.highway === "crossing") {
46722         fixTitleID = "connect_using_crossing";
46723         fixIcon = "temaki-pedestrian";
46724       }
46725       if (connectionTags.ford) {
46726         fixTitleID = "connect_using_ford";
46727         fixIcon = "roentgen-ford";
46728       }
46729       const fix = new validationIssueFix({
46730         icon: fixIcon,
46731         title: _t.append("issues.fix." + fixTitleID + ".title"),
46732         onClick: function(context2) {
46733           var loc = this.issue.loc;
46734           var edges = this.issue.data.edges;
46735           context2.perform(
46736             function actionConnectCrossingWays(graph) {
46737               var node = osmNode({ loc, tags: connectionTags });
46738               graph = graph.replace(node);
46739               var nodesToMerge = [node.id];
46740               var mergeThresholdInMeters = 0.75;
46741               edges.forEach(function(edge) {
46742                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
46743                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
46744                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
46745                   nodesToMerge.push(nearby.node.id);
46746                 } else {
46747                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
46748                 }
46749               });
46750               if (nodesToMerge.length > 1) {
46751                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
46752               }
46753               return graph;
46754             },
46755             _t("issues.fix.connect_crossing_features.annotation")
46756           );
46757         }
46758       });
46759       fix._connectionTags = connectionTags;
46760       return fix;
46761     }
46762     function makeChangeLayerFix(higherOrLower) {
46763       return new validationIssueFix({
46764         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
46765         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
46766         onClick: function(context2) {
46767           var mode = context2.mode();
46768           if (!mode || mode.id !== "select") return;
46769           var selectedIDs = mode.selectedIDs();
46770           if (selectedIDs.length !== 1) return;
46771           var selectedID = selectedIDs[0];
46772           if (!this.issue.entityIds.some(function(entityId) {
46773             return entityId === selectedID;
46774           })) return;
46775           var entity = context2.hasEntity(selectedID);
46776           if (!entity) return;
46777           var tags = Object.assign({}, entity.tags);
46778           var layer = tags.layer && Number(tags.layer);
46779           if (layer && !isNaN(layer)) {
46780             if (higherOrLower === "higher") {
46781               layer += 1;
46782             } else {
46783               layer -= 1;
46784             }
46785           } else {
46786             if (higherOrLower === "higher") {
46787               layer = 1;
46788             } else {
46789               layer = -1;
46790             }
46791           }
46792           tags.layer = layer.toString();
46793           context2.perform(
46794             actionChangeTags(entity.id, tags),
46795             _t("operations.change_tags.annotation")
46796           );
46797         }
46798       });
46799     }
46800     validation.type = type2;
46801     return validation;
46802   }
46803   var init_crossing_ways = __esm({
46804     "modules/validations/crossing_ways.js"() {
46805       "use strict";
46806       init_lodash();
46807       init_add_midpoint();
46808       init_change_tags();
46809       init_merge_nodes();
46810       init_split();
46811       init_select5();
46812       init_geo2();
46813       init_node2();
46814       init_tags();
46815       init_localizer();
46816       init_utilDisplayLabel();
46817       init_validation();
46818     }
46819   });
46820
46821   // modules/behavior/draw_way.js
46822   var draw_way_exports = {};
46823   __export(draw_way_exports, {
46824     behaviorDrawWay: () => behaviorDrawWay
46825   });
46826   function behaviorDrawWay(context, wayID, mode, startGraph) {
46827     const keybinding = utilKeybinding("drawWay");
46828     var dispatch14 = dispatch_default("rejectedSelfIntersection");
46829     var behavior = behaviorDraw(context);
46830     var _nodeIndex;
46831     var _origWay;
46832     var _wayGeometry;
46833     var _headNodeID;
46834     var _annotation;
46835     var _pointerHasMoved = false;
46836     var _drawNode;
46837     var _didResolveTempEdit = false;
46838     function createDrawNode(loc) {
46839       _drawNode = osmNode({ loc });
46840       context.pauseChangeDispatch();
46841       context.replace(function actionAddDrawNode(graph) {
46842         var way = graph.entity(wayID);
46843         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
46844       }, _annotation);
46845       context.resumeChangeDispatch();
46846       setActiveElements();
46847     }
46848     function removeDrawNode() {
46849       context.pauseChangeDispatch();
46850       context.replace(
46851         function actionDeleteDrawNode(graph) {
46852           var way = graph.entity(wayID);
46853           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
46854         },
46855         _annotation
46856       );
46857       _drawNode = void 0;
46858       context.resumeChangeDispatch();
46859     }
46860     function keydown(d3_event) {
46861       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
46862         if (context.surface().classed("nope")) {
46863           context.surface().classed("nope-suppressed", true);
46864         }
46865         context.surface().classed("nope", false).classed("nope-disabled", true);
46866       }
46867     }
46868     function keyup(d3_event) {
46869       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
46870         if (context.surface().classed("nope-suppressed")) {
46871           context.surface().classed("nope", true);
46872         }
46873         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
46874       }
46875     }
46876     function allowsVertex(d2) {
46877       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
46878     }
46879     function move(d3_event, datum2) {
46880       var loc = context.map().mouseCoordinates();
46881       if (!_drawNode) createDrawNode(loc);
46882       context.surface().classed("nope-disabled", d3_event.altKey);
46883       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
46884       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
46885       if (targetLoc) {
46886         loc = targetLoc;
46887       } else if (targetNodes) {
46888         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
46889         if (choice) {
46890           loc = choice.loc;
46891         }
46892       }
46893       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
46894       _drawNode = context.entity(_drawNode.id);
46895       checkGeometry(
46896         true
46897         /* includeDrawNode */
46898       );
46899     }
46900     function checkGeometry(includeDrawNode) {
46901       var nopeDisabled = context.surface().classed("nope-disabled");
46902       var isInvalid = isInvalidGeometry(includeDrawNode);
46903       if (nopeDisabled) {
46904         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
46905       } else {
46906         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
46907       }
46908     }
46909     function isInvalidGeometry(includeDrawNode) {
46910       var testNode = _drawNode;
46911       var parentWay = context.graph().entity(wayID);
46912       var nodes = context.graph().childNodes(parentWay).slice();
46913       if (includeDrawNode) {
46914         if (parentWay.isClosed()) {
46915           nodes.pop();
46916         }
46917       } else {
46918         if (parentWay.isClosed()) {
46919           if (nodes.length < 3) return false;
46920           if (_drawNode) nodes.splice(-2, 1);
46921           testNode = nodes[nodes.length - 2];
46922         } else {
46923           return false;
46924         }
46925       }
46926       return testNode && geoHasSelfIntersections(nodes, testNode.id);
46927     }
46928     function undone() {
46929       _didResolveTempEdit = true;
46930       context.pauseChangeDispatch();
46931       var nextMode;
46932       if (context.graph() === startGraph) {
46933         nextMode = modeSelect(context, [wayID]);
46934       } else {
46935         context.pop(1);
46936         nextMode = mode;
46937       }
46938       context.perform(actionNoop());
46939       context.pop(1);
46940       context.resumeChangeDispatch();
46941       context.enter(nextMode);
46942     }
46943     function setActiveElements() {
46944       if (!_drawNode) return;
46945       context.surface().selectAll("." + _drawNode.id).classed("active", true);
46946     }
46947     function resetToStartGraph() {
46948       while (context.graph() !== startGraph) {
46949         context.pop();
46950       }
46951     }
46952     var drawWay = function(surface) {
46953       _drawNode = void 0;
46954       _didResolveTempEdit = false;
46955       _origWay = context.entity(wayID);
46956       if (typeof _nodeIndex === "number") {
46957         _headNodeID = _origWay.nodes[_nodeIndex];
46958       } else if (_origWay.isClosed()) {
46959         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
46960       } else {
46961         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
46962       }
46963       _wayGeometry = _origWay.geometry(context.graph());
46964       _annotation = _t(
46965         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
46966       );
46967       _pointerHasMoved = false;
46968       context.pauseChangeDispatch();
46969       context.perform(actionNoop(), _annotation);
46970       context.resumeChangeDispatch();
46971       behavior.hover().initialNodeID(_headNodeID);
46972       behavior.on("move", function() {
46973         _pointerHasMoved = true;
46974         move.apply(this, arguments);
46975       }).on("down", function() {
46976         move.apply(this, arguments);
46977       }).on("downcancel", function() {
46978         if (_drawNode) removeDrawNode();
46979       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
46980       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
46981       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
46982       setActiveElements();
46983       surface.call(behavior);
46984       context.history().on("undone.draw", undone);
46985     };
46986     drawWay.off = function(surface) {
46987       if (!_didResolveTempEdit) {
46988         context.pauseChangeDispatch();
46989         resetToStartGraph();
46990         context.resumeChangeDispatch();
46991       }
46992       _drawNode = void 0;
46993       _nodeIndex = void 0;
46994       context.map().on("drawn.draw", null);
46995       surface.call(behavior.off).selectAll(".active").classed("active", false);
46996       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
46997       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
46998       context.history().on("undone.draw", null);
46999     };
47000     function attemptAdd(d2, loc, doAdd) {
47001       if (_drawNode) {
47002         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
47003         _drawNode = context.entity(_drawNode.id);
47004       } else {
47005         createDrawNode(loc);
47006       }
47007       checkGeometry(
47008         true
47009         /* includeDrawNode */
47010       );
47011       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
47012         if (!_pointerHasMoved) {
47013           removeDrawNode();
47014         }
47015         dispatch14.call("rejectedSelfIntersection", this);
47016         return;
47017       }
47018       context.pauseChangeDispatch();
47019       doAdd();
47020       _didResolveTempEdit = true;
47021       context.resumeChangeDispatch();
47022       context.enter(mode);
47023     }
47024     drawWay.add = function(loc, d2) {
47025       attemptAdd(d2, loc, function() {
47026       });
47027     };
47028     drawWay.addWay = function(loc, edge, d2) {
47029       attemptAdd(d2, loc, function() {
47030         context.replace(
47031           actionAddMidpoint({ loc, edge }, _drawNode),
47032           _annotation
47033         );
47034       });
47035     };
47036     drawWay.addNode = function(node, d2) {
47037       if (node.id === _headNodeID || // or the first node when drawing an area
47038       _origWay.isClosed() && node.id === _origWay.first()) {
47039         drawWay.finish();
47040         return;
47041       }
47042       attemptAdd(d2, node.loc, function() {
47043         context.replace(
47044           function actionReplaceDrawNode(graph) {
47045             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
47046             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
47047           },
47048           _annotation
47049         );
47050       });
47051     };
47052     function getFeatureType(ways) {
47053       if (ways.every((way) => way.isClosed())) return "area";
47054       if (ways.every((way) => !way.isClosed())) return "line";
47055       return "generic";
47056     }
47057     function followMode() {
47058       if (_didResolveTempEdit) return;
47059       try {
47060         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
47061         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
47062         const historyGraph = context.history().graph();
47063         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
47064           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
47065           return;
47066         }
47067         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w3) => w3.id !== wayID);
47068         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w3) => w3.id !== wayID);
47069         const featureType = getFeatureType(lastNodesParents);
47070         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
47071           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
47072           return;
47073         }
47074         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
47075           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
47076           return;
47077         }
47078         const way = lastNodesParents[0];
47079         const indexOfLast = way.nodes.indexOf(lastNodeId);
47080         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
47081         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
47082         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
47083         if (nextNodeIndex === -1) nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
47084         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
47085         drawWay.addNode(nextNode, {
47086           geometry: { type: "Point", coordinates: nextNode.loc },
47087           id: nextNode.id,
47088           properties: { target: true, entity: nextNode }
47089         });
47090       } catch {
47091         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
47092       }
47093     }
47094     keybinding.on(_t("operations.follow.key"), followMode);
47095     select_default2(document).call(keybinding);
47096     drawWay.finish = function() {
47097       checkGeometry(
47098         false
47099         /* includeDrawNode */
47100       );
47101       if (context.surface().classed("nope")) {
47102         dispatch14.call("rejectedSelfIntersection", this);
47103         return;
47104       }
47105       context.pauseChangeDispatch();
47106       context.pop(1);
47107       _didResolveTempEdit = true;
47108       context.resumeChangeDispatch();
47109       var way = context.hasEntity(wayID);
47110       if (!way || way.isDegenerate()) {
47111         drawWay.cancel();
47112         return;
47113       }
47114       window.setTimeout(function() {
47115         context.map().dblclickZoomEnable(true);
47116       }, 1e3);
47117       var isNewFeature = !mode.isContinuing;
47118       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
47119     };
47120     drawWay.cancel = function() {
47121       context.pauseChangeDispatch();
47122       resetToStartGraph();
47123       context.resumeChangeDispatch();
47124       window.setTimeout(function() {
47125         context.map().dblclickZoomEnable(true);
47126       }, 1e3);
47127       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
47128       context.enter(modeBrowse(context));
47129     };
47130     drawWay.nodeIndex = function(val) {
47131       if (!arguments.length) return _nodeIndex;
47132       _nodeIndex = val;
47133       return drawWay;
47134     };
47135     drawWay.activeID = function() {
47136       if (!arguments.length) return _drawNode && _drawNode.id;
47137       return drawWay;
47138     };
47139     return utilRebind(drawWay, dispatch14, "on");
47140   }
47141   var init_draw_way = __esm({
47142     "modules/behavior/draw_way.js"() {
47143       "use strict";
47144       init_src4();
47145       init_src5();
47146       init_presets();
47147       init_localizer();
47148       init_add_midpoint();
47149       init_move_node();
47150       init_noop2();
47151       init_draw();
47152       init_geo2();
47153       init_browse();
47154       init_select5();
47155       init_node2();
47156       init_rebind();
47157       init_util();
47158     }
47159   });
47160
47161   // modules/modes/draw_line.js
47162   var draw_line_exports = {};
47163   __export(draw_line_exports, {
47164     modeDrawLine: () => modeDrawLine
47165   });
47166   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
47167     var mode = {
47168       button,
47169       id: "draw-line"
47170     };
47171     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
47172       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
47173     });
47174     mode.wayID = wayID;
47175     mode.isContinuing = continuing;
47176     mode.enter = function() {
47177       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
47178       context.install(behavior);
47179     };
47180     mode.exit = function() {
47181       context.uninstall(behavior);
47182     };
47183     mode.selectedIDs = function() {
47184       return [wayID];
47185     };
47186     mode.activeID = function() {
47187       return behavior && behavior.activeID() || [];
47188     };
47189     return mode;
47190   }
47191   var init_draw_line = __esm({
47192     "modules/modes/draw_line.js"() {
47193       "use strict";
47194       init_localizer();
47195       init_draw_way();
47196     }
47197   });
47198
47199   // modules/ui/cmd.js
47200   var cmd_exports = {};
47201   __export(cmd_exports, {
47202     uiCmd: () => uiCmd
47203   });
47204   var uiCmd;
47205   var init_cmd = __esm({
47206     "modules/ui/cmd.js"() {
47207       "use strict";
47208       init_localizer();
47209       init_detect();
47210       uiCmd = function(code) {
47211         var detected = utilDetect();
47212         if (detected.os === "mac") {
47213           return code;
47214         }
47215         if (detected.os === "win") {
47216           if (code === "\u2318\u21E7Z") return "Ctrl+Y";
47217         }
47218         var result = "", replacements = {
47219           "\u2318": "Ctrl",
47220           "\u21E7": "Shift",
47221           "\u2325": "Alt",
47222           "\u232B": "Backspace",
47223           "\u2326": "Delete"
47224         };
47225         for (var i3 = 0; i3 < code.length; i3++) {
47226           if (code[i3] in replacements) {
47227             result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
47228           } else {
47229             result += code[i3];
47230           }
47231         }
47232         return result;
47233       };
47234       uiCmd.display = function(code) {
47235         if (code.length !== 1) return code;
47236         var detected = utilDetect();
47237         var mac = detected.os === "mac";
47238         var replacements = {
47239           "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
47240           "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
47241           "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
47242           "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
47243           "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
47244           "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
47245           "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
47246           "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
47247           "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
47248           "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
47249           "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
47250           "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
47251           "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
47252         };
47253         return replacements[code] || code;
47254       };
47255     }
47256   });
47257
47258   // modules/operations/delete.js
47259   var delete_exports = {};
47260   __export(delete_exports, {
47261     operationDelete: () => operationDelete
47262   });
47263   function operationDelete(context, selectedIDs) {
47264     var multi = selectedIDs.length === 1 ? "single" : "multiple";
47265     var action = actionDeleteMultiple(selectedIDs);
47266     var nodes = utilGetAllNodes(selectedIDs, context.graph());
47267     var coords = nodes.map(function(n3) {
47268       return n3.loc;
47269     });
47270     var extent = utilTotalExtent(selectedIDs, context.graph());
47271     var operation2 = function() {
47272       var nextSelectedID;
47273       var nextSelectedLoc;
47274       if (selectedIDs.length === 1) {
47275         var id2 = selectedIDs[0];
47276         var entity = context.entity(id2);
47277         var geometry = entity.geometry(context.graph());
47278         var parents = context.graph().parentWays(entity);
47279         var parent2 = parents[0];
47280         if (geometry === "vertex") {
47281           var nodes2 = parent2.nodes;
47282           var i3 = nodes2.indexOf(id2);
47283           if (i3 === 0) {
47284             i3++;
47285           } else if (i3 === nodes2.length - 1) {
47286             i3--;
47287           } else {
47288             var a4 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
47289             var b3 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
47290             i3 = a4 < b3 ? i3 - 1 : i3 + 1;
47291           }
47292           nextSelectedID = nodes2[i3];
47293           nextSelectedLoc = context.entity(nextSelectedID).loc;
47294         }
47295       }
47296       context.perform(action, operation2.annotation());
47297       context.validator().validate();
47298       if (nextSelectedID && nextSelectedLoc) {
47299         if (context.hasEntity(nextSelectedID)) {
47300           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
47301         } else {
47302           context.map().centerEase(nextSelectedLoc);
47303           context.enter(modeBrowse(context));
47304         }
47305       } else {
47306         context.enter(modeBrowse(context));
47307       }
47308     };
47309     operation2.available = function() {
47310       return true;
47311     };
47312     operation2.disabled = function() {
47313       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
47314         return "too_large";
47315       } else if (someMissing()) {
47316         return "not_downloaded";
47317       } else if (selectedIDs.some(context.hasHiddenConnections)) {
47318         return "connected_to_hidden";
47319       } else if (selectedIDs.some(protectedMember)) {
47320         return "part_of_relation";
47321       } else if (selectedIDs.some(incompleteRelation)) {
47322         return "incomplete_relation";
47323       } else if (selectedIDs.some(hasWikidataTag)) {
47324         return "has_wikidata_tag";
47325       }
47326       return false;
47327       function someMissing() {
47328         if (context.inIntro()) return false;
47329         var osm = context.connection();
47330         if (osm) {
47331           var missing = coords.filter(function(loc) {
47332             return !osm.isDataLoaded(loc);
47333           });
47334           if (missing.length) {
47335             missing.forEach(function(loc) {
47336               context.loadTileAtLoc(loc);
47337             });
47338             return true;
47339           }
47340         }
47341         return false;
47342       }
47343       function hasWikidataTag(id2) {
47344         var entity = context.entity(id2);
47345         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
47346       }
47347       function incompleteRelation(id2) {
47348         var entity = context.entity(id2);
47349         return entity.type === "relation" && !entity.isComplete(context.graph());
47350       }
47351       function protectedMember(id2) {
47352         var entity = context.entity(id2);
47353         if (entity.type !== "way") return false;
47354         var parents = context.graph().parentRelations(entity);
47355         for (var i3 = 0; i3 < parents.length; i3++) {
47356           var parent2 = parents[i3];
47357           var type2 = parent2.tags.type;
47358           var role = parent2.memberById(id2).role || "outer";
47359           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
47360             return true;
47361           }
47362         }
47363         return false;
47364       }
47365     };
47366     operation2.tooltip = function() {
47367       var disable = operation2.disabled();
47368       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
47369     };
47370     operation2.annotation = function() {
47371       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
47372     };
47373     operation2.id = "delete";
47374     operation2.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
47375     operation2.title = _t.append("operations.delete.title");
47376     operation2.behavior = behaviorOperation(context).which(operation2);
47377     return operation2;
47378   }
47379   var init_delete = __esm({
47380     "modules/operations/delete.js"() {
47381       "use strict";
47382       init_localizer();
47383       init_delete_multiple();
47384       init_operation();
47385       init_geo2();
47386       init_browse();
47387       init_select5();
47388       init_cmd();
47389       init_util();
47390     }
47391   });
47392
47393   // modules/validations/disconnected_way.js
47394   var disconnected_way_exports = {};
47395   __export(disconnected_way_exports, {
47396     validationDisconnectedWay: () => validationDisconnectedWay
47397   });
47398   function validationDisconnectedWay() {
47399     var type2 = "disconnected_way";
47400     function isTaggedAsHighway(entity) {
47401       return osmRoutableHighwayTagValues[entity.tags.highway];
47402     }
47403     var validation = function checkDisconnectedWay(entity, graph) {
47404       var routingIslandWays = routingIslandForEntity(entity);
47405       if (!routingIslandWays) return [];
47406       return [new validationIssue({
47407         type: type2,
47408         subtype: "highway",
47409         severity: "warning",
47410         message: function(context) {
47411           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
47412           var label = entity2 && utilDisplayLabel(entity2, context.graph());
47413           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
47414         },
47415         reference: showReference,
47416         entityIds: Array.from(routingIslandWays).map(function(way) {
47417           return way.id;
47418         }),
47419         dynamicFixes: makeFixes
47420       })];
47421       function makeFixes(context) {
47422         var fixes = [];
47423         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
47424         if (singleEntity) {
47425           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
47426             var textDirection = _mainLocalizer.textDirection();
47427             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
47428             if (startFix) fixes.push(startFix);
47429             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
47430             if (endFix) fixes.push(endFix);
47431           }
47432           if (!fixes.length) {
47433             fixes.push(new validationIssueFix({
47434               title: _t.append("issues.fix.connect_feature.title")
47435             }));
47436           }
47437           fixes.push(new validationIssueFix({
47438             icon: "iD-operation-delete",
47439             title: _t.append("issues.fix.delete_feature.title"),
47440             entityIds: [singleEntity.id],
47441             onClick: function(context2) {
47442               var id2 = this.issue.entityIds[0];
47443               var operation2 = operationDelete(context2, [id2]);
47444               if (!operation2.disabled()) {
47445                 operation2();
47446               }
47447             }
47448           }));
47449         } else {
47450           fixes.push(new validationIssueFix({
47451             title: _t.append("issues.fix.connect_features.title")
47452           }));
47453         }
47454         return fixes;
47455       }
47456       function showReference(selection2) {
47457         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
47458       }
47459       function routingIslandForEntity(entity2) {
47460         var routingIsland = /* @__PURE__ */ new Set();
47461         var waysToCheck = [];
47462         function queueParentWays(node) {
47463           graph.parentWays(node).forEach(function(parentWay) {
47464             if (!routingIsland.has(parentWay) && // only check each feature once
47465             isRoutableWay(parentWay, false)) {
47466               routingIsland.add(parentWay);
47467               waysToCheck.push(parentWay);
47468             }
47469           });
47470         }
47471         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
47472           routingIsland.add(entity2);
47473           waysToCheck.push(entity2);
47474         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
47475           routingIsland.add(entity2);
47476           queueParentWays(entity2);
47477         } else {
47478           return null;
47479         }
47480         while (waysToCheck.length) {
47481           var wayToCheck = waysToCheck.pop();
47482           var childNodes = graph.childNodes(wayToCheck);
47483           for (var i3 in childNodes) {
47484             var vertex = childNodes[i3];
47485             if (isConnectedVertex(vertex)) {
47486               return null;
47487             }
47488             if (isRoutableNode(vertex)) {
47489               routingIsland.add(vertex);
47490             }
47491             queueParentWays(vertex);
47492           }
47493         }
47494         return routingIsland;
47495       }
47496       function isConnectedVertex(vertex) {
47497         var osm = services.osm;
47498         if (osm && !osm.isDataLoaded(vertex.loc)) return true;
47499         if (vertex.tags.entrance && vertex.tags.entrance !== "no") return true;
47500         if (vertex.tags.amenity === "parking_entrance") return true;
47501         return false;
47502       }
47503       function isRoutableNode(node) {
47504         if (node.tags.highway === "elevator") return true;
47505         return false;
47506       }
47507       function isRoutableWay(way, ignoreInnerWays) {
47508         if (isTaggedAsHighway(way) || way.tags.route === "ferry") return true;
47509         return graph.parentRelations(way).some(function(parentRelation) {
47510           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
47511           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner")) return true;
47512           return false;
47513         });
47514       }
47515       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
47516         var vertex = graph.hasEntity(vertexID);
47517         if (!vertex || vertex.tags.noexit === "yes") return null;
47518         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
47519         return new validationIssueFix({
47520           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
47521           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
47522           entityIds: [vertexID],
47523           onClick: function(context) {
47524             var wayId = this.issue.entityIds[0];
47525             var way = context.hasEntity(wayId);
47526             var vertexId = this.entityIds[0];
47527             var vertex2 = context.hasEntity(vertexId);
47528             if (!way || !vertex2) return;
47529             var map2 = context.map();
47530             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
47531               map2.zoomToEase(vertex2);
47532             }
47533             context.enter(
47534               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
47535             );
47536           }
47537         });
47538       }
47539     };
47540     validation.type = type2;
47541     return validation;
47542   }
47543   var init_disconnected_way = __esm({
47544     "modules/validations/disconnected_way.js"() {
47545       "use strict";
47546       init_localizer();
47547       init_draw_line();
47548       init_delete();
47549       init_utilDisplayLabel();
47550       init_tags();
47551       init_validation();
47552       init_services();
47553     }
47554   });
47555
47556   // modules/validations/invalid_format.js
47557   var invalid_format_exports = {};
47558   __export(invalid_format_exports, {
47559     validationFormatting: () => validationFormatting
47560   });
47561   function validationFormatting() {
47562     var type2 = "invalid_format";
47563     var validation = function(entity) {
47564       var issues = [];
47565       function isValidEmail(email) {
47566         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
47567         return !email || valid_email.test(email);
47568       }
47569       function showReferenceEmail(selection2) {
47570         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
47571       }
47572       if (entity.tags.email) {
47573         var emails = entity.tags.email.split(";").map(function(s2) {
47574           return s2.trim();
47575         }).filter(function(x2) {
47576           return !isValidEmail(x2);
47577         });
47578         if (emails.length) {
47579           issues.push(new validationIssue({
47580             type: type2,
47581             subtype: "email",
47582             severity: "warning",
47583             message: function(context) {
47584               var entity2 = context.hasEntity(this.entityIds[0]);
47585               return entity2 ? _t.append(
47586                 "issues.invalid_format.email.message" + this.data,
47587                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
47588               ) : "";
47589             },
47590             reference: showReferenceEmail,
47591             entityIds: [entity.id],
47592             hash: emails.join(),
47593             data: emails.length > 1 ? "_multi" : ""
47594           }));
47595         }
47596       }
47597       return issues;
47598     };
47599     validation.type = type2;
47600     return validation;
47601   }
47602   var init_invalid_format = __esm({
47603     "modules/validations/invalid_format.js"() {
47604       "use strict";
47605       init_localizer();
47606       init_utilDisplayLabel();
47607       init_validation();
47608     }
47609   });
47610
47611   // modules/validations/help_request.js
47612   var help_request_exports = {};
47613   __export(help_request_exports, {
47614     validationHelpRequest: () => validationHelpRequest
47615   });
47616   function validationHelpRequest(context) {
47617     var type2 = "help_request";
47618     var validation = function checkFixmeTag(entity) {
47619       if (!entity.tags.fixme) return [];
47620       if (entity.version === void 0) return [];
47621       if (entity.v !== void 0) {
47622         var baseEntity = context.history().base().hasEntity(entity.id);
47623         if (!baseEntity || !baseEntity.tags.fixme) return [];
47624       }
47625       return [new validationIssue({
47626         type: type2,
47627         subtype: "fixme_tag",
47628         severity: "warning",
47629         message: function(context2) {
47630           var entity2 = context2.hasEntity(this.entityIds[0]);
47631           return entity2 ? _t.append("issues.fixme_tag.message", {
47632             feature: utilDisplayLabel(
47633               entity2,
47634               context2.graph(),
47635               true
47636               /* verbose */
47637             )
47638           }) : "";
47639         },
47640         dynamicFixes: function() {
47641           return [
47642             new validationIssueFix({
47643               title: _t.append("issues.fix.address_the_concern.title")
47644             })
47645           ];
47646         },
47647         reference: showReference,
47648         entityIds: [entity.id]
47649       })];
47650       function showReference(selection2) {
47651         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
47652       }
47653     };
47654     validation.type = type2;
47655     return validation;
47656   }
47657   var init_help_request = __esm({
47658     "modules/validations/help_request.js"() {
47659       "use strict";
47660       init_localizer();
47661       init_utilDisplayLabel();
47662       init_validation();
47663     }
47664   });
47665
47666   // modules/validations/impossible_oneway.js
47667   var impossible_oneway_exports = {};
47668   __export(impossible_oneway_exports, {
47669     validationImpossibleOneway: () => validationImpossibleOneway
47670   });
47671   function validationImpossibleOneway() {
47672     const type2 = "impossible_oneway";
47673     const validation = function checkImpossibleOneway(entity, graph) {
47674       if (entity.type !== "way" || entity.geometry(graph) !== "line") return [];
47675       if (entity.isClosed()) return [];
47676       if (!typeForWay(entity)) return [];
47677       if (!entity.isOneWay()) return [];
47678       return [
47679         ...issuesForNode(entity, entity.first()),
47680         ...issuesForNode(entity, entity.last())
47681       ];
47682       function typeForWay(way) {
47683         if (way.geometry(graph) !== "line") return null;
47684         if (osmRoutableHighwayTagValues[way.tags.highway]) return "highway";
47685         if (osmFlowingWaterwayTagValues[way.tags.waterway]) return "waterway";
47686         return null;
47687       }
47688       function nodeOccursMoreThanOnce(way, nodeID) {
47689         let occurrences = 0;
47690         for (const index in way.nodes) {
47691           if (way.nodes[index] === nodeID) {
47692             occurrences++;
47693             if (occurrences > 1) return true;
47694           }
47695         }
47696         return false;
47697       }
47698       function isConnectedViaOtherTypes(way, node) {
47699         var wayType = typeForWay(way);
47700         if (wayType === "highway") {
47701           if (node.tags.entrance && node.tags.entrance !== "no") return true;
47702           if (node.tags.amenity === "parking_entrance") return true;
47703         } else if (wayType === "waterway") {
47704           if (node.id === way.first()) {
47705             if (node.tags.natural === "spring") return true;
47706           } else {
47707             if (node.tags.manhole === "drain") return true;
47708           }
47709         }
47710         return graph.parentWays(node).some(function(parentWay) {
47711           if (parentWay.id === way.id) return false;
47712           if (wayType === "highway") {
47713             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway]) return true;
47714             if (parentWay.tags.route === "ferry") return true;
47715             return graph.parentRelations(parentWay).some(function(parentRelation) {
47716               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
47717               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
47718             });
47719           } else if (wayType === "waterway") {
47720             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline") return true;
47721           }
47722           return false;
47723         });
47724       }
47725       function issuesForNode(way, nodeID) {
47726         const isFirst = nodeID === way.first() ^ way.isOneWayBackwards();
47727         const wayType = typeForWay(way);
47728         if (nodeOccursMoreThanOnce(way, nodeID)) return [];
47729         const osm = services.osm;
47730         if (!osm) return [];
47731         const node = graph.hasEntity(nodeID);
47732         if (!node || !osm.isDataLoaded(node.loc)) return [];
47733         if (isConnectedViaOtherTypes(way, node)) return [];
47734         const attachedWaysOfSameType = graph.parentWays(node).filter((parentWay) => {
47735           if (parentWay.id === way.id) return false;
47736           return typeForWay(parentWay) === wayType;
47737         });
47738         if (wayType === "waterway" && attachedWaysOfSameType.length === 0) return [];
47739         const attachedOneways = attachedWaysOfSameType.filter((attachedWay) => attachedWay.isOneWay());
47740         if (attachedOneways.length < attachedWaysOfSameType.length) return [];
47741         if (attachedOneways.length) {
47742           const connectedEndpointsOkay = attachedOneways.some((attachedOneway) => {
47743             const isAttachedBackwards = attachedOneway.isOneWayBackwards();
47744             if ((isFirst ^ isAttachedBackwards ? attachedOneway.first() : attachedOneway.last()) !== nodeID) {
47745               return true;
47746             }
47747             if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) return true;
47748             return false;
47749           });
47750           if (connectedEndpointsOkay) return [];
47751         }
47752         const placement = isFirst ? "start" : "end";
47753         let messageID = wayType + ".";
47754         let referenceID = wayType + ".";
47755         if (wayType === "waterway") {
47756           messageID += "connected." + placement;
47757           referenceID += "connected";
47758         } else {
47759           messageID += placement;
47760           referenceID += placement;
47761         }
47762         return [new validationIssue({
47763           type: type2,
47764           subtype: wayType,
47765           severity: "warning",
47766           message: function(context) {
47767             var entity2 = context.hasEntity(this.entityIds[0]);
47768             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
47769               feature: utilDisplayLabel(entity2, context.graph())
47770             }) : "";
47771           },
47772           reference: getReference(referenceID),
47773           entityIds: [way.id, node.id],
47774           dynamicFixes: function() {
47775             var fixes = [];
47776             if (attachedOneways.length) {
47777               fixes.push(new validationIssueFix({
47778                 icon: "iD-operation-reverse",
47779                 title: _t.append("issues.fix.reverse_feature.title"),
47780                 entityIds: [way.id],
47781                 onClick: function(context) {
47782                   var id2 = this.issue.entityIds[0];
47783                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
47784                 }
47785               }));
47786             }
47787             if (node.tags.noexit !== "yes") {
47788               var textDirection = _mainLocalizer.textDirection();
47789               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
47790               fixes.push(new validationIssueFix({
47791                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
47792                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
47793                 onClick: function(context) {
47794                   var entityID = this.issue.entityIds[0];
47795                   var vertexID = this.issue.entityIds[1];
47796                   var way2 = context.entity(entityID);
47797                   var vertex = context.entity(vertexID);
47798                   continueDrawing(way2, vertex, context);
47799                 }
47800               }));
47801             }
47802             return fixes;
47803           },
47804           loc: node.loc
47805         })];
47806         function getReference(referenceID2) {
47807           return function showReference(selection2) {
47808             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
47809           };
47810         }
47811       }
47812     };
47813     function continueDrawing(way, vertex, context) {
47814       var map2 = context.map();
47815       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
47816         map2.zoomToEase(vertex);
47817       }
47818       context.enter(
47819         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
47820       );
47821     }
47822     validation.type = type2;
47823     return validation;
47824   }
47825   var init_impossible_oneway = __esm({
47826     "modules/validations/impossible_oneway.js"() {
47827       "use strict";
47828       init_localizer();
47829       init_draw_line();
47830       init_reverse();
47831       init_utilDisplayLabel();
47832       init_tags();
47833       init_validation();
47834       init_services();
47835     }
47836   });
47837
47838   // modules/validations/incompatible_source.js
47839   var incompatible_source_exports = {};
47840   __export(incompatible_source_exports, {
47841     validationIncompatibleSource: () => validationIncompatibleSource
47842   });
47843   function validationIncompatibleSource() {
47844     const type2 = "incompatible_source";
47845     const incompatibleRules = [
47846       {
47847         id: "amap",
47848         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
47849       },
47850       {
47851         id: "baidu",
47852         regex: /(baidu|mapbar|百度)/i
47853       },
47854       {
47855         id: "google",
47856         regex: /google/i,
47857         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
47858       }
47859     ];
47860     const validation = function checkIncompatibleSource(entity) {
47861       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
47862       if (!entitySources) return [];
47863       const entityID = entity.id;
47864       return entitySources.map((source) => {
47865         const matchRule = incompatibleRules.find((rule) => {
47866           if (!rule.regex.test(source)) return false;
47867           if (rule.exceptRegex && rule.exceptRegex.test(source)) return false;
47868           return true;
47869         });
47870         if (!matchRule) return null;
47871         return new validationIssue({
47872           type: type2,
47873           severity: "warning",
47874           message: (context) => {
47875             const entity2 = context.hasEntity(entityID);
47876             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
47877               feature: utilDisplayLabel(
47878                 entity2,
47879                 context.graph(),
47880                 true
47881                 /* verbose */
47882               ),
47883               value: source
47884             }) : "";
47885           },
47886           reference: getReference(matchRule.id),
47887           entityIds: [entityID],
47888           hash: source,
47889           dynamicFixes: () => {
47890             return [
47891               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
47892             ];
47893           }
47894         });
47895       }).filter(Boolean);
47896       function getReference(id2) {
47897         return function showReference(selection2) {
47898           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
47899         };
47900       }
47901     };
47902     validation.type = type2;
47903     return validation;
47904   }
47905   var init_incompatible_source = __esm({
47906     "modules/validations/incompatible_source.js"() {
47907       "use strict";
47908       init_localizer();
47909       init_utilDisplayLabel();
47910       init_validation();
47911     }
47912   });
47913
47914   // modules/validations/maprules.js
47915   var maprules_exports2 = {};
47916   __export(maprules_exports2, {
47917     validationMaprules: () => validationMaprules
47918   });
47919   function validationMaprules() {
47920     var type2 = "maprules";
47921     var validation = function checkMaprules(entity, graph) {
47922       if (!services.maprules) return [];
47923       var rules = services.maprules.validationRules();
47924       var issues = [];
47925       for (var i3 = 0; i3 < rules.length; i3++) {
47926         var rule = rules[i3];
47927         rule.findIssues(entity, graph, issues);
47928       }
47929       return issues;
47930     };
47931     validation.type = type2;
47932     return validation;
47933   }
47934   var init_maprules2 = __esm({
47935     "modules/validations/maprules.js"() {
47936       "use strict";
47937       init_services();
47938     }
47939   });
47940
47941   // modules/validations/mismatched_geometry.js
47942   var mismatched_geometry_exports = {};
47943   __export(mismatched_geometry_exports, {
47944     validationMismatchedGeometry: () => validationMismatchedGeometry
47945   });
47946   function validationMismatchedGeometry() {
47947     var type2 = "mismatched_geometry";
47948     function tagSuggestingLineIsArea(entity) {
47949       if (entity.type !== "way" || entity.isClosed()) return null;
47950       var tagSuggestingArea = entity.tagSuggestingArea();
47951       if (!tagSuggestingArea) {
47952         return null;
47953       }
47954       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
47955       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
47956       if (asLine && asArea && (0, import_fast_deep_equal5.default)(asLine.tags, asArea.tags)) {
47957         return null;
47958       }
47959       if (asLine.isFallback() && asArea.isFallback() && !(0, import_fast_deep_equal5.default)(tagSuggestingArea, { area: "yes" })) {
47960         return null;
47961       }
47962       return tagSuggestingArea;
47963     }
47964     function makeConnectEndpointsFixOnClick(way, graph) {
47965       if (way.nodes.length < 3) return null;
47966       var nodes = graph.childNodes(way), testNodes;
47967       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
47968       if (firstToLastDistanceMeters < 0.75) {
47969         testNodes = nodes.slice();
47970         testNodes.pop();
47971         testNodes.push(testNodes[0]);
47972         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
47973           return function(context) {
47974             var way2 = context.entity(this.issue.entityIds[0]);
47975             context.perform(
47976               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
47977               _t("issues.fix.connect_endpoints.annotation")
47978             );
47979           };
47980         }
47981       }
47982       testNodes = nodes.slice();
47983       testNodes.push(testNodes[0]);
47984       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
47985         return function(context) {
47986           var wayId = this.issue.entityIds[0];
47987           var way2 = context.entity(wayId);
47988           var nodeId = way2.nodes[0];
47989           var index = way2.nodes.length;
47990           context.perform(
47991             actionAddVertex(wayId, nodeId, index),
47992             _t("issues.fix.connect_endpoints.annotation")
47993           );
47994         };
47995       }
47996     }
47997     function lineTaggedAsAreaIssue(entity) {
47998       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
47999       if (!tagSuggestingArea) return null;
48000       var validAsLine = false;
48001       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
48002       if (presetAsLine) {
48003         validAsLine = true;
48004         var key = Object.keys(tagSuggestingArea)[0];
48005         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
48006           validAsLine = false;
48007         }
48008         if (Object.keys(presetAsLine.tags).length === 0) {
48009           validAsLine = false;
48010         }
48011       }
48012       return new validationIssue({
48013         type: type2,
48014         subtype: "area_as_line",
48015         severity: "warning",
48016         message: function(context) {
48017           var entity2 = context.hasEntity(this.entityIds[0]);
48018           return entity2 ? _t.append("issues.tag_suggests_area.message", {
48019             feature: utilDisplayLabel(
48020               entity2,
48021               "area",
48022               true
48023               /* verbose */
48024             ),
48025             tag: utilTagText({ tags: tagSuggestingArea })
48026           }) : "";
48027         },
48028         reference: showReference,
48029         entityIds: [entity.id],
48030         hash: JSON.stringify(tagSuggestingArea),
48031         dynamicFixes: function(context) {
48032           var fixes = [];
48033           var entity2 = context.entity(this.entityIds[0]);
48034           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
48035           if (!validAsLine) {
48036             fixes.push(new validationIssueFix({
48037               title: _t.append("issues.fix.connect_endpoints.title"),
48038               onClick: connectEndsOnClick
48039             }));
48040           }
48041           fixes.push(new validationIssueFix({
48042             icon: "iD-operation-delete",
48043             title: _t.append("issues.fix.remove_tag.title"),
48044             onClick: function(context2) {
48045               var entityId = this.issue.entityIds[0];
48046               var entity3 = context2.entity(entityId);
48047               var tags = Object.assign({}, entity3.tags);
48048               for (var key2 in tagSuggestingArea) {
48049                 delete tags[key2];
48050               }
48051               context2.perform(
48052                 actionChangeTags(entityId, tags),
48053                 _t("issues.fix.remove_tag.annotation")
48054               );
48055             }
48056           }));
48057           return fixes;
48058         }
48059       });
48060       function showReference(selection2) {
48061         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
48062       }
48063     }
48064     function vertexPointIssue(entity, graph) {
48065       if (entity.type !== "node") return null;
48066       if (Object.keys(entity.tags).length === 0) return null;
48067       if (entity.isOnAddressLine(graph)) return null;
48068       var geometry = entity.geometry(graph);
48069       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
48070       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
48071         return new validationIssue({
48072           type: type2,
48073           subtype: "vertex_as_point",
48074           severity: "warning",
48075           message: function(context) {
48076             var entity2 = context.hasEntity(this.entityIds[0]);
48077             return entity2 ? _t.append("issues.vertex_as_point.message", {
48078               feature: utilDisplayLabel(
48079                 entity2,
48080                 "vertex",
48081                 true
48082                 /* verbose */
48083               )
48084             }) : "";
48085           },
48086           reference: function showReference(selection2) {
48087             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
48088           },
48089           entityIds: [entity.id]
48090         });
48091       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
48092         return new validationIssue({
48093           type: type2,
48094           subtype: "point_as_vertex",
48095           severity: "warning",
48096           message: function(context) {
48097             var entity2 = context.hasEntity(this.entityIds[0]);
48098             return entity2 ? _t.append("issues.point_as_vertex.message", {
48099               feature: utilDisplayLabel(
48100                 entity2,
48101                 "point",
48102                 true
48103                 /* verbose */
48104               )
48105             }) : "";
48106           },
48107           reference: function showReference(selection2) {
48108             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
48109           },
48110           entityIds: [entity.id],
48111           dynamicFixes: extractPointDynamicFixes
48112         });
48113       }
48114       return null;
48115     }
48116     function otherMismatchIssue(entity, graph) {
48117       if (!entity.hasInterestingTags()) return null;
48118       if (entity.type !== "node" && entity.type !== "way") return null;
48119       if (entity.type === "node" && entity.isOnAddressLine(graph)) return null;
48120       var sourceGeom = entity.geometry(graph);
48121       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
48122       if (sourceGeom === "area") targetGeoms.unshift("line");
48123       var asSource = _mainPresetIndex.match(entity, graph);
48124       var targetGeom = targetGeoms.find((nodeGeom) => {
48125         const asTarget = _mainPresetIndex.matchTags(
48126           entity.tags,
48127           nodeGeom,
48128           entity.extent(graph).center()
48129         );
48130         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
48131         (0, import_fast_deep_equal5.default)(asSource.tags, asTarget.tags)) return false;
48132         if (asTarget.isFallback()) return false;
48133         var primaryKey = Object.keys(asTarget.tags)[0];
48134         if (primaryKey === "building") return false;
48135         if (asTarget.tags[primaryKey] === "*") return false;
48136         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
48137       });
48138       if (!targetGeom) return null;
48139       var subtype = targetGeom + "_as_" + sourceGeom;
48140       if (targetGeom === "vertex") targetGeom = "point";
48141       if (sourceGeom === "vertex") sourceGeom = "point";
48142       var referenceId = targetGeom + "_as_" + sourceGeom;
48143       var dynamicFixes;
48144       if (targetGeom === "point") {
48145         dynamicFixes = extractPointDynamicFixes;
48146       } else if (sourceGeom === "area" && targetGeom === "line") {
48147         dynamicFixes = lineToAreaDynamicFixes;
48148       }
48149       return new validationIssue({
48150         type: type2,
48151         subtype,
48152         severity: "warning",
48153         message: function(context) {
48154           var entity2 = context.hasEntity(this.entityIds[0]);
48155           return entity2 ? _t.append("issues." + referenceId + ".message", {
48156             feature: utilDisplayLabel(
48157               entity2,
48158               targetGeom,
48159               true
48160               /* verbose */
48161             )
48162           }) : "";
48163         },
48164         reference: function showReference(selection2) {
48165           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
48166         },
48167         entityIds: [entity.id],
48168         dynamicFixes
48169       });
48170     }
48171     function lineToAreaDynamicFixes(context) {
48172       var convertOnClick;
48173       var entityId = this.entityIds[0];
48174       var entity = context.entity(entityId);
48175       var tags = Object.assign({}, entity.tags);
48176       delete tags.area;
48177       if (!osmTagSuggestingArea(tags)) {
48178         convertOnClick = function(context2) {
48179           var entityId2 = this.issue.entityIds[0];
48180           var entity2 = context2.entity(entityId2);
48181           var tags2 = Object.assign({}, entity2.tags);
48182           if (tags2.area) {
48183             delete tags2.area;
48184           }
48185           context2.perform(
48186             actionChangeTags(entityId2, tags2),
48187             _t("issues.fix.convert_to_line.annotation")
48188           );
48189         };
48190       }
48191       return [
48192         new validationIssueFix({
48193           icon: "iD-icon-line",
48194           title: _t.append("issues.fix.convert_to_line.title"),
48195           onClick: convertOnClick
48196         })
48197       ];
48198     }
48199     function extractPointDynamicFixes(context) {
48200       var entityId = this.entityIds[0];
48201       var extractOnClick = null;
48202       if (!context.hasHiddenConnections(entityId)) {
48203         extractOnClick = function(context2) {
48204           var entityId2 = this.issue.entityIds[0];
48205           var action = actionExtract(entityId2, context2.projection);
48206           context2.perform(
48207             action,
48208             _t("operations.extract.annotation", { n: 1 })
48209           );
48210           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
48211         };
48212       }
48213       return [
48214         new validationIssueFix({
48215           icon: "iD-operation-extract",
48216           title: _t.append("issues.fix.extract_point.title"),
48217           onClick: extractOnClick
48218         })
48219       ];
48220     }
48221     function unclosedMultipolygonPartIssues(entity, graph) {
48222       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
48223       !entity.isComplete(graph)) return [];
48224       var sequences = osmJoinWays(entity.members, graph);
48225       var issues = [];
48226       for (var i3 in sequences) {
48227         var sequence = sequences[i3];
48228         if (!sequence.nodes) continue;
48229         var firstNode = sequence.nodes[0];
48230         var lastNode = sequence.nodes[sequence.nodes.length - 1];
48231         if (firstNode === lastNode) continue;
48232         var issue = new validationIssue({
48233           type: type2,
48234           subtype: "unclosed_multipolygon_part",
48235           severity: "warning",
48236           message: function(context) {
48237             var entity2 = context.hasEntity(this.entityIds[0]);
48238             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
48239               feature: utilDisplayLabel(
48240                 entity2,
48241                 context.graph(),
48242                 true
48243                 /* verbose */
48244               )
48245             }) : "";
48246           },
48247           reference: showReference,
48248           loc: sequence.nodes[0].loc,
48249           entityIds: [entity.id],
48250           hash: sequence.map(function(way) {
48251             return way.id;
48252           }).join()
48253         });
48254         issues.push(issue);
48255       }
48256       return issues;
48257       function showReference(selection2) {
48258         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
48259       }
48260     }
48261     var validation = function checkMismatchedGeometry(entity, graph) {
48262       var vertexPoint = vertexPointIssue(entity, graph);
48263       if (vertexPoint) return [vertexPoint];
48264       var lineAsArea = lineTaggedAsAreaIssue(entity);
48265       if (lineAsArea) return [lineAsArea];
48266       var mismatch = otherMismatchIssue(entity, graph);
48267       if (mismatch) return [mismatch];
48268       return unclosedMultipolygonPartIssues(entity, graph);
48269     };
48270     validation.type = type2;
48271     return validation;
48272   }
48273   var import_fast_deep_equal5;
48274   var init_mismatched_geometry = __esm({
48275     "modules/validations/mismatched_geometry.js"() {
48276       "use strict";
48277       import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
48278       init_add_vertex();
48279       init_change_tags();
48280       init_merge_nodes();
48281       init_extract();
48282       init_select5();
48283       init_multipolygon();
48284       init_tags();
48285       init_presets();
48286       init_geo2();
48287       init_localizer();
48288       init_util();
48289       init_utilDisplayLabel();
48290       init_validation();
48291     }
48292   });
48293
48294   // modules/validations/missing_role.js
48295   var missing_role_exports = {};
48296   __export(missing_role_exports, {
48297     validationMissingRole: () => validationMissingRole
48298   });
48299   function validationMissingRole() {
48300     var type2 = "missing_role";
48301     var validation = function checkMissingRole(entity, graph) {
48302       var issues = [];
48303       if (entity.type === "way") {
48304         graph.parentRelations(entity).forEach(function(relation) {
48305           if (!relation.isMultipolygon()) return;
48306           var member = relation.memberById(entity.id);
48307           if (member && isMissingRole(member)) {
48308             issues.push(makeIssue(entity, relation, member));
48309           }
48310         });
48311       } else if (entity.type === "relation" && entity.isMultipolygon()) {
48312         entity.indexedMembers().forEach(function(member) {
48313           var way = graph.hasEntity(member.id);
48314           if (way && isMissingRole(member)) {
48315             issues.push(makeIssue(way, entity, member));
48316           }
48317         });
48318       }
48319       return issues;
48320     };
48321     function isMissingRole(member) {
48322       return !member.role || !member.role.trim().length;
48323     }
48324     function makeIssue(way, relation, member) {
48325       return new validationIssue({
48326         type: type2,
48327         severity: "warning",
48328         message: function(context) {
48329           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
48330           return member2 && relation2 ? _t.append("issues.missing_role.message", {
48331             member: utilDisplayLabel(member2, context.graph()),
48332             relation: utilDisplayLabel(relation2, context.graph())
48333           }) : "";
48334         },
48335         reference: showReference,
48336         entityIds: [relation.id, way.id],
48337         data: {
48338           member
48339         },
48340         hash: member.index.toString(),
48341         dynamicFixes: function() {
48342           return [
48343             makeAddRoleFix("inner"),
48344             makeAddRoleFix("outer"),
48345             new validationIssueFix({
48346               icon: "iD-operation-delete",
48347               title: _t.append("issues.fix.remove_from_relation.title"),
48348               onClick: function(context) {
48349                 context.perform(
48350                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
48351                   _t("operations.delete_member.annotation", {
48352                     n: 1
48353                   })
48354                 );
48355               }
48356             })
48357           ];
48358         }
48359       });
48360       function showReference(selection2) {
48361         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
48362       }
48363     }
48364     function makeAddRoleFix(role) {
48365       return new validationIssueFix({
48366         title: _t.append("issues.fix.set_as_" + role + ".title"),
48367         onClick: function(context) {
48368           var oldMember = this.issue.data.member;
48369           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
48370           context.perform(
48371             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
48372             _t("operations.change_role.annotation", {
48373               n: 1
48374             })
48375           );
48376         }
48377       });
48378     }
48379     validation.type = type2;
48380     return validation;
48381   }
48382   var init_missing_role = __esm({
48383     "modules/validations/missing_role.js"() {
48384       "use strict";
48385       init_change_member();
48386       init_delete_member();
48387       init_localizer();
48388       init_utilDisplayLabel();
48389       init_validation();
48390     }
48391   });
48392
48393   // modules/validations/missing_tag.js
48394   var missing_tag_exports = {};
48395   __export(missing_tag_exports, {
48396     validationMissingTag: () => validationMissingTag
48397   });
48398   function validationMissingTag(context) {
48399     var type2 = "missing_tag";
48400     function hasDescriptiveTags(entity) {
48401       var onlyAttributeKeys = ["description", "name", "note", "start_date", "oneway"];
48402       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k3) {
48403         if (k3 === "area" || !osmIsInterestingTag(k3)) return false;
48404         return !onlyAttributeKeys.some(function(attributeKey) {
48405           return k3 === attributeKey || k3.indexOf(attributeKey + ":") === 0;
48406         });
48407       });
48408       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
48409         return false;
48410       }
48411       return entityDescriptiveKeys.length > 0;
48412     }
48413     function isUnknownRoad(entity) {
48414       return entity.type === "way" && entity.tags.highway === "road";
48415     }
48416     function isUntypedRelation(entity) {
48417       return entity.type === "relation" && !entity.tags.type;
48418     }
48419     var validation = function checkMissingTag(entity, graph) {
48420       var subtype;
48421       var osm = context.connection();
48422       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
48423       if (!isUnloadedNode && // allow untagged nodes that are part of ways
48424       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
48425       !entity.hasParentRelations(graph)) {
48426         if (Object.keys(entity.tags).length === 0) {
48427           subtype = "any";
48428         } else if (!hasDescriptiveTags(entity)) {
48429           subtype = "descriptive";
48430         } else if (isUntypedRelation(entity)) {
48431           subtype = "relation_type";
48432         }
48433       }
48434       if (!subtype && isUnknownRoad(entity)) {
48435         subtype = "highway_classification";
48436       }
48437       if (!subtype) return [];
48438       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
48439       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
48440       var canDelete = entity.version === void 0 || entity.v !== void 0;
48441       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
48442       return [new validationIssue({
48443         type: type2,
48444         subtype,
48445         severity,
48446         message: function(context2) {
48447           var entity2 = context2.hasEntity(this.entityIds[0]);
48448           return entity2 ? _t.append("issues." + messageID + ".message", {
48449             feature: utilDisplayLabel(entity2, context2.graph())
48450           }) : "";
48451         },
48452         reference: showReference,
48453         entityIds: [entity.id],
48454         dynamicFixes: function(context2) {
48455           var fixes = [];
48456           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
48457           fixes.push(new validationIssueFix({
48458             icon: "iD-icon-search",
48459             title: _t.append("issues.fix." + selectFixType + ".title"),
48460             onClick: function(context3) {
48461               context3.ui().sidebar.showPresetList();
48462             }
48463           }));
48464           var deleteOnClick;
48465           var id2 = this.entityIds[0];
48466           var operation2 = operationDelete(context2, [id2]);
48467           var disabledReasonID = operation2.disabled();
48468           if (!disabledReasonID) {
48469             deleteOnClick = function(context3) {
48470               var id3 = this.issue.entityIds[0];
48471               var operation3 = operationDelete(context3, [id3]);
48472               if (!operation3.disabled()) {
48473                 operation3();
48474               }
48475             };
48476           }
48477           fixes.push(
48478             new validationIssueFix({
48479               icon: "iD-operation-delete",
48480               title: _t.append("issues.fix.delete_feature.title"),
48481               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
48482               onClick: deleteOnClick
48483             })
48484           );
48485           return fixes;
48486         }
48487       })];
48488       function showReference(selection2) {
48489         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
48490       }
48491     };
48492     validation.type = type2;
48493     return validation;
48494   }
48495   var init_missing_tag = __esm({
48496     "modules/validations/missing_tag.js"() {
48497       "use strict";
48498       init_delete();
48499       init_tags();
48500       init_localizer();
48501       init_utilDisplayLabel();
48502       init_validation();
48503     }
48504   });
48505
48506   // modules/validations/mutually_exclusive_tags.js
48507   var mutually_exclusive_tags_exports = {};
48508   __export(mutually_exclusive_tags_exports, {
48509     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags
48510   });
48511   function validationMutuallyExclusiveTags() {
48512     const type2 = "mutually_exclusive_tags";
48513     const tagKeyPairs = osmMutuallyExclusiveTagPairs;
48514     const validation = function checkMutuallyExclusiveTags(entity) {
48515       let pairsFounds = tagKeyPairs.filter((pair3) => {
48516         return pair3[0] in entity.tags && pair3[1] in entity.tags;
48517       }).filter((pair3) => {
48518         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");
48519       });
48520       Object.keys(entity.tags).forEach((key) => {
48521         let negative_key = "not:" + key;
48522         if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
48523           pairsFounds.push([negative_key, key, "same_value"]);
48524         }
48525         if (key.match(/^name:[a-z]+/)) {
48526           negative_key = "not:name";
48527           if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
48528             pairsFounds.push([negative_key, key, "same_value"]);
48529           }
48530         }
48531       });
48532       let issues = pairsFounds.map((pair3) => {
48533         const subtype = pair3[2] || "default";
48534         return new validationIssue({
48535           type: type2,
48536           subtype,
48537           severity: "warning",
48538           message: function(context) {
48539             let entity2 = context.hasEntity(this.entityIds[0]);
48540             return entity2 ? _t.append(`issues.${type2}.${subtype}.message`, {
48541               feature: utilDisplayLabel(entity2, context.graph()),
48542               tag1: pair3[0],
48543               tag2: pair3[1]
48544             }) : "";
48545           },
48546           reference: (selection2) => showReference(selection2, pair3, subtype),
48547           entityIds: [entity.id],
48548           dynamicFixes: () => pair3.slice(0, 2).map((tagToRemove) => createIssueFix(tagToRemove))
48549         });
48550       });
48551       function createIssueFix(tagToRemove) {
48552         return new validationIssueFix({
48553           icon: "iD-operation-delete",
48554           title: _t.append("issues.fix.remove_named_tag.title", { tag: tagToRemove }),
48555           onClick: function(context) {
48556             const entityId = this.issue.entityIds[0];
48557             const entity2 = context.entity(entityId);
48558             let tags = Object.assign({}, entity2.tags);
48559             delete tags[tagToRemove];
48560             context.perform(
48561               actionChangeTags(entityId, tags),
48562               _t("issues.fix.remove_named_tag.annotation", { tag: tagToRemove })
48563             );
48564           }
48565         });
48566       }
48567       function showReference(selection2, pair3, subtype) {
48568         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] }));
48569       }
48570       return issues;
48571     };
48572     validation.type = type2;
48573     return validation;
48574   }
48575   var init_mutually_exclusive_tags = __esm({
48576     "modules/validations/mutually_exclusive_tags.js"() {
48577       "use strict";
48578       init_change_tags();
48579       init_localizer();
48580       init_utilDisplayLabel();
48581       init_validation();
48582       init_tags();
48583     }
48584   });
48585
48586   // modules/operations/split.js
48587   var split_exports2 = {};
48588   __export(split_exports2, {
48589     operationSplit: () => operationSplit
48590   });
48591   function operationSplit(context, selectedIDs) {
48592     var _vertexIds = selectedIDs.filter(function(id2) {
48593       return context.graph().geometry(id2) === "vertex";
48594     });
48595     var _selectedWayIds = selectedIDs.filter(function(id2) {
48596       var entity = context.graph().hasEntity(id2);
48597       return entity && entity.type === "way";
48598     });
48599     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
48600     var _action = actionSplit(_vertexIds);
48601     var _ways = [];
48602     var _geometry = "feature";
48603     var _waysAmount = "single";
48604     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
48605     if (_isAvailable) {
48606       if (_selectedWayIds.length) _action.limitWays(_selectedWayIds);
48607       _ways = _action.ways(context.graph());
48608       var geometries = {};
48609       _ways.forEach(function(way) {
48610         geometries[way.geometry(context.graph())] = true;
48611       });
48612       if (Object.keys(geometries).length === 1) {
48613         _geometry = Object.keys(geometries)[0];
48614       }
48615       _waysAmount = _ways.length === 1 ? "single" : "multiple";
48616     }
48617     var operation2 = function() {
48618       var difference2 = context.perform(_action, operation2.annotation());
48619       var idsToSelect = _vertexIds.concat(difference2.extantIDs().filter(function(id2) {
48620         return context.entity(id2).type === "way";
48621       }));
48622       context.enter(modeSelect(context, idsToSelect));
48623     };
48624     operation2.relatedEntityIds = function() {
48625       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
48626     };
48627     operation2.available = function() {
48628       return _isAvailable;
48629     };
48630     operation2.disabled = function() {
48631       var reason = _action.disabled(context.graph());
48632       if (reason) {
48633         return reason;
48634       } else if (selectedIDs.some(context.hasHiddenConnections)) {
48635         return "connected_to_hidden";
48636       }
48637       return false;
48638     };
48639     operation2.tooltip = function() {
48640       var disable = operation2.disabled();
48641       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
48642     };
48643     operation2.annotation = function() {
48644       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
48645     };
48646     operation2.icon = function() {
48647       if (_waysAmount === "multiple") {
48648         return "#iD-operation-split-multiple";
48649       } else {
48650         return "#iD-operation-split";
48651       }
48652     };
48653     operation2.id = "split";
48654     operation2.keys = [_t("operations.split.key")];
48655     operation2.title = _t.append("operations.split.title");
48656     operation2.behavior = behaviorOperation(context).which(operation2);
48657     return operation2;
48658   }
48659   var init_split2 = __esm({
48660     "modules/operations/split.js"() {
48661       "use strict";
48662       init_localizer();
48663       init_split();
48664       init_operation();
48665       init_select5();
48666     }
48667   });
48668
48669   // modules/validations/osm_api_limits.js
48670   var osm_api_limits_exports = {};
48671   __export(osm_api_limits_exports, {
48672     validationOsmApiLimits: () => validationOsmApiLimits
48673   });
48674   function validationOsmApiLimits(context) {
48675     const type2 = "osm_api_limits";
48676     const validation = function checkOsmApiLimits(entity) {
48677       const issues = [];
48678       const osm = context.connection();
48679       if (!osm) return issues;
48680       const maxWayNodes = osm.maxWayNodes();
48681       if (entity.type === "way") {
48682         if (entity.nodes.length > maxWayNodes) {
48683           issues.push(new validationIssue({
48684             type: type2,
48685             subtype: "exceededMaxWayNodes",
48686             severity: "error",
48687             message: function() {
48688               return _t.html("issues.osm_api_limits.max_way_nodes.message");
48689             },
48690             reference: function(selection2) {
48691               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 }));
48692             },
48693             entityIds: [entity.id],
48694             dynamicFixes: splitWayIntoSmallChunks
48695           }));
48696         }
48697       }
48698       return issues;
48699     };
48700     function splitWayIntoSmallChunks() {
48701       const fix = new validationIssueFix({
48702         icon: "iD-operation-split",
48703         title: _t.html("issues.fix.split_way.title"),
48704         entityIds: this.entityIds,
48705         onClick: function(context2) {
48706           const maxWayNodes = context2.connection().maxWayNodes();
48707           const g3 = context2.graph();
48708           const entityId = this.entityIds[0];
48709           const entity = context2.graph().entities[entityId];
48710           const numberOfParts = Math.ceil(entity.nodes.length / maxWayNodes);
48711           let splitVertices;
48712           if (numberOfParts === 2) {
48713             const splitIntersections = entity.nodes.map((nid) => g3.entity(nid)).filter((n3) => g3.parentWays(n3).length > 1).map((n3) => n3.id).filter((nid) => {
48714               const splitIndex = entity.nodes.indexOf(nid);
48715               return splitIndex < maxWayNodes && entity.nodes.length - splitIndex < maxWayNodes;
48716             });
48717             if (splitIntersections.length > 0) {
48718               splitVertices = [
48719                 splitIntersections[Math.floor(splitIntersections.length / 2)]
48720               ];
48721             }
48722           }
48723           if (splitVertices === void 0) {
48724             splitVertices = [...Array(numberOfParts - 1)].map((_3, i3) => entity.nodes[Math.floor(entity.nodes.length * (i3 + 1) / numberOfParts)]);
48725           }
48726           if (entity.isClosed()) {
48727             splitVertices.push(entity.nodes[0]);
48728           }
48729           const operation2 = operationSplit(context2, splitVertices.concat(entityId));
48730           if (!operation2.disabled()) {
48731             operation2();
48732           }
48733         }
48734       });
48735       return [fix];
48736     }
48737     validation.type = type2;
48738     return validation;
48739   }
48740   var init_osm_api_limits = __esm({
48741     "modules/validations/osm_api_limits.js"() {
48742       "use strict";
48743       init_localizer();
48744       init_validation();
48745       init_split2();
48746     }
48747   });
48748
48749   // modules/osm/deprecated.js
48750   var deprecated_exports = {};
48751   __export(deprecated_exports, {
48752     deprecatedTagValuesByKey: () => deprecatedTagValuesByKey,
48753     getDeprecatedTags: () => getDeprecatedTags
48754   });
48755   function getDeprecatedTags(tags, dataDeprecated) {
48756     if (Object.keys(tags).length === 0) return [];
48757     var deprecated = [];
48758     dataDeprecated.forEach((d2) => {
48759       var oldKeys = Object.keys(d2.old);
48760       if (d2.replace) {
48761         var hasExistingValues = Object.keys(d2.replace).some((replaceKey) => {
48762           if (!tags[replaceKey] || d2.old[replaceKey]) return false;
48763           var replaceValue = d2.replace[replaceKey];
48764           if (replaceValue === "*") return false;
48765           if (replaceValue === tags[replaceKey]) return false;
48766           return true;
48767         });
48768         if (hasExistingValues) return;
48769       }
48770       var matchesDeprecatedTags = oldKeys.every((oldKey) => {
48771         if (!tags[oldKey]) return false;
48772         if (d2.old[oldKey] === "*") return true;
48773         if (d2.old[oldKey] === tags[oldKey]) return true;
48774         var vals = tags[oldKey].split(";").filter(Boolean);
48775         if (vals.length === 0) {
48776           return false;
48777         } else if (vals.length > 1) {
48778           return vals.indexOf(d2.old[oldKey]) !== -1;
48779         } else {
48780           if (tags[oldKey] === d2.old[oldKey]) {
48781             if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
48782               var replaceKeys = Object.keys(d2.replace);
48783               return !replaceKeys.every((replaceKey) => {
48784                 return tags[replaceKey] === d2.replace[replaceKey];
48785               });
48786             } else {
48787               return true;
48788             }
48789           }
48790         }
48791         return false;
48792       });
48793       if (matchesDeprecatedTags) {
48794         deprecated.push(d2);
48795       }
48796     });
48797     return deprecated;
48798   }
48799   function deprecatedTagValuesByKey(dataDeprecated) {
48800     if (!_deprecatedTagValuesByKey) {
48801       _deprecatedTagValuesByKey = {};
48802       dataDeprecated.forEach((d2) => {
48803         var oldKeys = Object.keys(d2.old);
48804         if (oldKeys.length === 1) {
48805           var oldKey = oldKeys[0];
48806           var oldValue = d2.old[oldKey];
48807           if (oldValue !== "*") {
48808             if (!_deprecatedTagValuesByKey[oldKey]) {
48809               _deprecatedTagValuesByKey[oldKey] = [oldValue];
48810             } else {
48811               _deprecatedTagValuesByKey[oldKey].push(oldValue);
48812             }
48813           }
48814         }
48815       });
48816     }
48817     return _deprecatedTagValuesByKey;
48818   }
48819   var _deprecatedTagValuesByKey;
48820   var init_deprecated = __esm({
48821     "modules/osm/deprecated.js"() {
48822       "use strict";
48823     }
48824   });
48825
48826   // modules/validations/outdated_tags.js
48827   var outdated_tags_exports = {};
48828   __export(outdated_tags_exports, {
48829     validationOutdatedTags: () => validationOutdatedTags
48830   });
48831   function validationOutdatedTags() {
48832     const type2 = "outdated_tags";
48833     let _waitingForDeprecated = true;
48834     let _dataDeprecated;
48835     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
48836     }).finally(() => _waitingForDeprecated = false);
48837     function oldTagIssues(entity, graph) {
48838       if (!entity.hasInterestingTags()) return [];
48839       let preset = _mainPresetIndex.match(entity, graph);
48840       if (!preset) return [];
48841       const oldTags = Object.assign({}, entity.tags);
48842       if (preset.replacement) {
48843         const newPreset = _mainPresetIndex.item(preset.replacement);
48844         graph = actionChangePreset(
48845           entity.id,
48846           preset,
48847           newPreset,
48848           true
48849           /* skip field defaults */
48850         )(graph);
48851         entity = graph.entity(entity.id);
48852         preset = newPreset;
48853       }
48854       const nsi = services.nsi;
48855       let waitingForNsi = false;
48856       let nsiResult;
48857       if (nsi) {
48858         waitingForNsi = nsi.status() === "loading";
48859         if (!waitingForNsi) {
48860           const loc = entity.extent(graph).center();
48861           nsiResult = nsi.upgradeTags(oldTags, loc);
48862         }
48863       }
48864       const nsiDiff = nsiResult ? utilTagDiff(oldTags, nsiResult.newTags) : [];
48865       let deprecatedTags;
48866       if (_dataDeprecated) {
48867         deprecatedTags = getDeprecatedTags(entity.tags, _dataDeprecated);
48868         if (entity.type === "way" && entity.isClosed() && entity.tags.traffic_calming === "island" && !entity.tags.highway) {
48869           deprecatedTags.push({
48870             old: { traffic_calming: "island" },
48871             replace: { "area:highway": "traffic_island" }
48872           });
48873         }
48874         if (deprecatedTags.length) {
48875           deprecatedTags.forEach((tag) => {
48876             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
48877           });
48878           entity = graph.entity(entity.id);
48879         }
48880       }
48881       let newTags = Object.assign({}, entity.tags);
48882       if (preset.tags !== preset.addTags) {
48883         Object.keys(preset.addTags).filter((k3) => {
48884           return !(nsiResult == null ? void 0 : nsiResult.newTags[k3]);
48885         }).forEach((k3) => {
48886           if (!newTags[k3]) {
48887             if (preset.addTags[k3] === "*") {
48888               newTags[k3] = "yes";
48889             } else if (preset.addTags[k3]) {
48890               newTags[k3] = preset.addTags[k3];
48891             }
48892           }
48893         });
48894       }
48895       const deprecationDiff = utilTagDiff(oldTags, newTags);
48896       const deprecationDiffContext = Object.keys(oldTags).filter((key) => deprecatedTags == null ? void 0 : deprecatedTags.some((deprecated) => {
48897         var _a4;
48898         return ((_a4 = deprecated.replace) == null ? void 0 : _a4[key]) !== void 0;
48899       })).filter((key) => newTags[key] === oldTags[key]).map((key) => ({
48900         type: "~",
48901         key,
48902         oldVal: oldTags[key],
48903         newVal: newTags[key],
48904         display: "&nbsp; " + key + "=" + oldTags[key]
48905       }));
48906       let issues = [];
48907       issues.provisional = _waitingForDeprecated || waitingForNsi;
48908       if (deprecationDiff.length) {
48909         const isOnlyAddingTags = !deprecationDiff.some((d2) => d2.type === "-");
48910         const prefix = isOnlyAddingTags ? "incomplete." : "";
48911         issues.push(new validationIssue({
48912           type: type2,
48913           subtype: isOnlyAddingTags ? "incomplete_tags" : "deprecated_tags",
48914           severity: "warning",
48915           message: (context) => {
48916             const currEntity = context.hasEntity(entity.id);
48917             if (!currEntity) return "";
48918             const feature3 = utilDisplayLabel(
48919               currEntity,
48920               context.graph(),
48921               /* verbose */
48922               true
48923             );
48924             return _t.append(`issues.outdated_tags.${prefix}message`, { feature: feature3 });
48925           },
48926           reference: (selection2) => showReference(
48927             selection2,
48928             _t.append(`issues.outdated_tags.${prefix}reference`),
48929             [...deprecationDiff, ...deprecationDiffContext]
48930           ),
48931           entityIds: [entity.id],
48932           hash: utilHashcode(JSON.stringify(deprecationDiff)),
48933           dynamicFixes: () => {
48934             let fixes = [
48935               new validationIssueFix({
48936                 title: _t.append("issues.fix.upgrade_tags.title"),
48937                 onClick: (context) => {
48938                   context.perform((graph2) => doUpgrade(graph2, deprecationDiff), _t("issues.fix.upgrade_tags.annotation"));
48939                 }
48940               })
48941             ];
48942             return fixes;
48943           }
48944         }));
48945       }
48946       if (nsiDiff.length) {
48947         const isOnlyAddingTags = nsiDiff.every((d2) => d2.type === "+");
48948         issues.push(new validationIssue({
48949           type: type2,
48950           subtype: "noncanonical_brand",
48951           severity: "warning",
48952           message: (context) => {
48953             const currEntity = context.hasEntity(entity.id);
48954             if (!currEntity) return "";
48955             const feature3 = utilDisplayLabel(
48956               currEntity,
48957               context.graph(),
48958               /* verbose */
48959               true
48960             );
48961             return isOnlyAddingTags ? _t.append("issues.outdated_tags.noncanonical_brand.message_incomplete", { feature: feature3 }) : _t.append("issues.outdated_tags.noncanonical_brand.message", { feature: feature3 });
48962           },
48963           reference: (selection2) => showReference(
48964             selection2,
48965             _t.append("issues.outdated_tags.noncanonical_brand.reference"),
48966             nsiDiff
48967           ),
48968           entityIds: [entity.id],
48969           hash: utilHashcode(JSON.stringify(nsiDiff)),
48970           dynamicFixes: () => {
48971             let fixes = [
48972               new validationIssueFix({
48973                 title: _t.append("issues.fix.upgrade_tags.title"),
48974                 onClick: (context) => {
48975                   context.perform((graph2) => doUpgrade(graph2, nsiDiff), _t("issues.fix.upgrade_tags.annotation"));
48976                 }
48977               }),
48978               new validationIssueFix({
48979                 title: _t.append("issues.fix.tag_as_not.title", { name: nsiResult.matched.displayName }),
48980                 onClick: (context) => {
48981                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
48982                 }
48983               })
48984             ];
48985             return fixes;
48986           }
48987         }));
48988       }
48989       return issues;
48990       function doUpgrade(graph2, diff) {
48991         const currEntity = graph2.hasEntity(entity.id);
48992         if (!currEntity) return graph2;
48993         let newTags2 = Object.assign({}, currEntity.tags);
48994         diff.forEach((diff2) => {
48995           if (diff2.type === "-") {
48996             delete newTags2[diff2.key];
48997           } else if (diff2.type === "+") {
48998             newTags2[diff2.key] = diff2.newVal;
48999           }
49000         });
49001         return actionChangeTags(currEntity.id, newTags2)(graph2);
49002       }
49003       function addNotTag(graph2) {
49004         const currEntity = graph2.hasEntity(entity.id);
49005         if (!currEntity) return graph2;
49006         const item = nsiResult && nsiResult.matched;
49007         if (!item) return graph2;
49008         let newTags2 = Object.assign({}, currEntity.tags);
49009         const wd = item.mainTag;
49010         const notwd = `not:${wd}`;
49011         const qid = item.tags[wd];
49012         newTags2[notwd] = qid;
49013         if (newTags2[wd] === qid) {
49014           const wp = item.mainTag.replace("wikidata", "wikipedia");
49015           delete newTags2[wd];
49016           delete newTags2[wp];
49017         }
49018         return actionChangeTags(currEntity.id, newTags2)(graph2);
49019       }
49020       function showReference(selection2, reference, tagDiff) {
49021         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
49022         enter.append("div").attr("class", "issue-reference").call(reference);
49023         enter.append("strong").call(_t.append("issues.suggested"));
49024         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
49025           const klass = "tagDiff-cell";
49026           switch (d2.type) {
49027             case "+":
49028               return `${klass} tagDiff-cell-add`;
49029             case "-":
49030               return `${klass} tagDiff-cell-remove`;
49031             default:
49032               return `${klass} tagDiff-cell-unchanged`;
49033           }
49034         }).html((d2) => d2.display);
49035       }
49036     }
49037     let validation = oldTagIssues;
49038     validation.type = type2;
49039     return validation;
49040   }
49041   var init_outdated_tags = __esm({
49042     "modules/validations/outdated_tags.js"() {
49043       "use strict";
49044       init_localizer();
49045       init_change_preset();
49046       init_change_tags();
49047       init_upgrade_tags();
49048       init_core();
49049       init_presets();
49050       init_services();
49051       init_util();
49052       init_utilDisplayLabel();
49053       init_validation();
49054       init_deprecated();
49055     }
49056   });
49057
49058   // modules/validations/private_data.js
49059   var private_data_exports = {};
49060   __export(private_data_exports, {
49061     validationPrivateData: () => validationPrivateData
49062   });
49063   function validationPrivateData() {
49064     var type2 = "private_data";
49065     var privateBuildingValues = {
49066       detached: true,
49067       farm: true,
49068       house: true,
49069       houseboat: true,
49070       residential: true,
49071       semidetached_house: true,
49072       static_caravan: true
49073     };
49074     var publicKeys = {
49075       amenity: true,
49076       craft: true,
49077       historic: true,
49078       leisure: true,
49079       office: true,
49080       shop: true,
49081       tourism: true
49082     };
49083     var personalTags = {
49084       "contact:email": true,
49085       "contact:fax": true,
49086       "contact:phone": true,
49087       email: true,
49088       fax: true,
49089       phone: true
49090     };
49091     var validation = function checkPrivateData(entity) {
49092       var tags = entity.tags;
49093       if (!tags.building || !privateBuildingValues[tags.building]) return [];
49094       var keepTags = {};
49095       for (var k3 in tags) {
49096         if (publicKeys[k3]) return [];
49097         if (!personalTags[k3]) {
49098           keepTags[k3] = tags[k3];
49099         }
49100       }
49101       var tagDiff = utilTagDiff(tags, keepTags);
49102       if (!tagDiff.length) return [];
49103       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
49104       return [new validationIssue({
49105         type: type2,
49106         severity: "warning",
49107         message: showMessage,
49108         reference: showReference,
49109         entityIds: [entity.id],
49110         dynamicFixes: function() {
49111           return [
49112             new validationIssueFix({
49113               icon: "iD-operation-delete",
49114               title: _t.append("issues.fix." + fixID + ".title"),
49115               onClick: function(context) {
49116                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
49117               }
49118             })
49119           ];
49120         }
49121       })];
49122       function doUpgrade(graph) {
49123         var currEntity = graph.hasEntity(entity.id);
49124         if (!currEntity) return graph;
49125         var newTags = Object.assign({}, currEntity.tags);
49126         tagDiff.forEach(function(diff) {
49127           if (diff.type === "-") {
49128             delete newTags[diff.key];
49129           } else if (diff.type === "+") {
49130             newTags[diff.key] = diff.newVal;
49131           }
49132         });
49133         return actionChangeTags(currEntity.id, newTags)(graph);
49134       }
49135       function showMessage(context) {
49136         var currEntity = context.hasEntity(this.entityIds[0]);
49137         if (!currEntity) return "";
49138         return _t.append(
49139           "issues.private_data.contact.message",
49140           { feature: utilDisplayLabel(currEntity, context.graph()) }
49141         );
49142       }
49143       function showReference(selection2) {
49144         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
49145         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
49146         enter.append("strong").call(_t.append("issues.suggested"));
49147         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) {
49148           var klass = d2.type === "+" ? "add" : "remove";
49149           return "tagDiff-cell tagDiff-cell-" + klass;
49150         }).html(function(d2) {
49151           return d2.display;
49152         });
49153       }
49154     };
49155     validation.type = type2;
49156     return validation;
49157   }
49158   var init_private_data = __esm({
49159     "modules/validations/private_data.js"() {
49160       "use strict";
49161       init_change_tags();
49162       init_localizer();
49163       init_util();
49164       init_utilDisplayLabel();
49165       init_validation();
49166     }
49167   });
49168
49169   // modules/validations/suspicious_name.js
49170   var suspicious_name_exports = {};
49171   __export(suspicious_name_exports, {
49172     validationSuspiciousName: () => validationSuspiciousName
49173   });
49174   function validationSuspiciousName(context) {
49175     const type2 = "suspicious_name";
49176     const keysToTestForGenericValues = [
49177       "aerialway",
49178       "aeroway",
49179       "amenity",
49180       "building",
49181       "craft",
49182       "highway",
49183       "leisure",
49184       "railway",
49185       "man_made",
49186       "office",
49187       "shop",
49188       "tourism",
49189       "waterway"
49190     ];
49191     const ignoredPresets = /* @__PURE__ */ new Set([
49192       "amenity/place_of_worship/christian/jehovahs_witness",
49193       "__test__ignored_preset"
49194       // for unit tests
49195     ]);
49196     let _waitingForNsi = false;
49197     function isGenericMatchInNsi(tags) {
49198       const nsi = services.nsi;
49199       if (nsi) {
49200         _waitingForNsi = nsi.status() === "loading";
49201         if (!_waitingForNsi) {
49202           return nsi.isGenericName(tags);
49203         }
49204       }
49205       return false;
49206     }
49207     function nameMatchesRawTag(lowercaseName, tags) {
49208       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
49209         let key = keysToTestForGenericValues[i3];
49210         let val = tags[key];
49211         if (val) {
49212           val = val.toLowerCase();
49213           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
49214             return true;
49215           }
49216         }
49217       }
49218       return false;
49219     }
49220     function nameMatchesPresetName(name, preset) {
49221       if (!preset) return false;
49222       if (ignoredPresets.has(preset.id)) return false;
49223       name = name.toLowerCase();
49224       return name === preset.name().toLowerCase() || preset.aliases().some((alias) => name === alias.toLowerCase());
49225     }
49226     function isGenericName(name, tags, preset) {
49227       name = name.toLowerCase();
49228       return nameMatchesRawTag(name, tags) || nameMatchesPresetName(name, preset) || isGenericMatchInNsi(tags);
49229     }
49230     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
49231       return new validationIssue({
49232         type: type2,
49233         subtype: "generic_name",
49234         severity: "warning",
49235         message: function(context2) {
49236           let entity = context2.hasEntity(this.entityIds[0]);
49237           if (!entity) return "";
49238           let preset = _mainPresetIndex.match(entity, context2.graph());
49239           let langName = langCode && _mainLocalizer.languageName(langCode);
49240           return _t.append(
49241             "issues.generic_name.message" + (langName ? "_language" : ""),
49242             { feature: preset.name(), name: genericName, language: langName }
49243           );
49244         },
49245         reference: showReference,
49246         entityIds: [entityId],
49247         hash: `${nameKey}=${genericName}`,
49248         dynamicFixes: function() {
49249           return [
49250             new validationIssueFix({
49251               icon: "iD-operation-delete",
49252               title: _t.append("issues.fix.remove_the_name.title"),
49253               onClick: function(context2) {
49254                 let entityId2 = this.issue.entityIds[0];
49255                 let entity = context2.entity(entityId2);
49256                 let tags = Object.assign({}, entity.tags);
49257                 delete tags[nameKey];
49258                 context2.perform(
49259                   actionChangeTags(entityId2, tags),
49260                   _t("issues.fix.remove_generic_name.annotation")
49261                 );
49262               }
49263             })
49264           ];
49265         }
49266       });
49267       function showReference(selection2) {
49268         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
49269       }
49270     }
49271     let validation = function checkGenericName(entity) {
49272       const tags = entity.tags;
49273       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
49274       if (hasWikidata) return [];
49275       let issues = [];
49276       const preset = _mainPresetIndex.match(entity, context.graph());
49277       for (let key in tags) {
49278         const m3 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
49279         if (!m3) continue;
49280         const langCode = m3.length >= 2 ? m3[1] : null;
49281         const value = tags[key];
49282         if (isGenericName(value, tags, preset)) {
49283           issues.provisional = _waitingForNsi;
49284           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
49285         }
49286       }
49287       return issues;
49288     };
49289     validation.type = type2;
49290     return validation;
49291   }
49292   var init_suspicious_name = __esm({
49293     "modules/validations/suspicious_name.js"() {
49294       "use strict";
49295       init_change_tags();
49296       init_presets();
49297       init_services();
49298       init_localizer();
49299       init_validation();
49300     }
49301   });
49302
49303   // modules/validations/unsquare_way.js
49304   var unsquare_way_exports = {};
49305   __export(unsquare_way_exports, {
49306     validationUnsquareWay: () => validationUnsquareWay
49307   });
49308   function validationUnsquareWay(context) {
49309     var type2 = "unsquare_way";
49310     var DEFAULT_DEG_THRESHOLD = 5;
49311     var epsilon3 = 0.05;
49312     var nodeThreshold = 10;
49313     function isBuilding(entity, graph) {
49314       if (entity.type !== "way" || entity.geometry(graph) !== "area") return false;
49315       return entity.tags.building && entity.tags.building !== "no";
49316     }
49317     var validation = function checkUnsquareWay(entity, graph) {
49318       if (!isBuilding(entity, graph)) return [];
49319       if (entity.tags.nonsquare === "yes") return [];
49320       var isClosed = entity.isClosed();
49321       if (!isClosed) return [];
49322       var nodes = graph.childNodes(entity).slice();
49323       if (nodes.length > nodeThreshold + 1) return [];
49324       var osm = services.osm;
49325       if (!osm || nodes.some(function(node) {
49326         return !osm.isDataLoaded(node.loc);
49327       })) return [];
49328       var hasConnectedSquarableWays = nodes.some(function(node) {
49329         return graph.parentWays(node).some(function(way) {
49330           if (way.id === entity.id) return false;
49331           if (isBuilding(way, graph)) return true;
49332           return graph.parentRelations(way).some(function(parentRelation) {
49333             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
49334           });
49335         });
49336       });
49337       if (hasConnectedSquarableWays) return [];
49338       var storedDegreeThreshold = corePreferences("validate-square-degrees");
49339       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
49340       var points = nodes.map(function(node) {
49341         return context.projection(node.loc);
49342       });
49343       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true)) return [];
49344       var autoArgs;
49345       if (!entity.tags.wikidata) {
49346         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
49347         autoAction.transitionable = false;
49348         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
49349       }
49350       return [new validationIssue({
49351         type: type2,
49352         subtype: "building",
49353         severity: "warning",
49354         message: function(context2) {
49355           var entity2 = context2.hasEntity(this.entityIds[0]);
49356           return entity2 ? _t.append("issues.unsquare_way.message", {
49357             feature: utilDisplayLabel(entity2, context2.graph())
49358           }) : "";
49359         },
49360         reference: showReference,
49361         entityIds: [entity.id],
49362         hash: degreeThreshold,
49363         dynamicFixes: function() {
49364           return [
49365             new validationIssueFix({
49366               icon: "iD-operation-orthogonalize",
49367               title: _t.append("issues.fix.square_feature.title"),
49368               autoArgs,
49369               onClick: function(context2, completionHandler) {
49370                 var entityId = this.issue.entityIds[0];
49371                 context2.perform(
49372                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
49373                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
49374                 );
49375                 window.setTimeout(function() {
49376                   completionHandler();
49377                 }, 175);
49378               }
49379             })
49380             /*
49381             new validationIssueFix({
49382                 title: t.append('issues.fix.tag_as_unsquare.title'),
49383                 onClick: function(context) {
49384                     var entityId = this.issue.entityIds[0];
49385                     var entity = context.entity(entityId);
49386                     var tags = Object.assign({}, entity.tags);  // shallow copy
49387                     tags.nonsquare = 'yes';
49388                     context.perform(
49389                         actionChangeTags(entityId, tags),
49390                         t('issues.fix.tag_as_unsquare.annotation')
49391                     );
49392                 }
49393             })
49394             */
49395           ];
49396         }
49397       })];
49398       function showReference(selection2) {
49399         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
49400       }
49401     };
49402     validation.type = type2;
49403     return validation;
49404   }
49405   var init_unsquare_way = __esm({
49406     "modules/validations/unsquare_way.js"() {
49407       "use strict";
49408       init_preferences();
49409       init_localizer();
49410       init_orthogonalize();
49411       init_ortho();
49412       init_utilDisplayLabel();
49413       init_validation();
49414       init_services();
49415     }
49416   });
49417
49418   // modules/validations/index.js
49419   var validations_exports = {};
49420   __export(validations_exports, {
49421     validationAlmostJunction: () => validationAlmostJunction,
49422     validationCloseNodes: () => validationCloseNodes,
49423     validationCrossingWays: () => validationCrossingWays,
49424     validationDisconnectedWay: () => validationDisconnectedWay,
49425     validationFormatting: () => validationFormatting,
49426     validationHelpRequest: () => validationHelpRequest,
49427     validationImpossibleOneway: () => validationImpossibleOneway,
49428     validationIncompatibleSource: () => validationIncompatibleSource,
49429     validationMaprules: () => validationMaprules,
49430     validationMismatchedGeometry: () => validationMismatchedGeometry,
49431     validationMissingRole: () => validationMissingRole,
49432     validationMissingTag: () => validationMissingTag,
49433     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
49434     validationOsmApiLimits: () => validationOsmApiLimits,
49435     validationOutdatedTags: () => validationOutdatedTags,
49436     validationPrivateData: () => validationPrivateData,
49437     validationSuspiciousName: () => validationSuspiciousName,
49438     validationUnsquareWay: () => validationUnsquareWay
49439   });
49440   var init_validations = __esm({
49441     "modules/validations/index.js"() {
49442       "use strict";
49443       init_almost_junction();
49444       init_close_nodes();
49445       init_crossing_ways();
49446       init_disconnected_way();
49447       init_invalid_format();
49448       init_help_request();
49449       init_impossible_oneway();
49450       init_incompatible_source();
49451       init_maprules2();
49452       init_mismatched_geometry();
49453       init_missing_role();
49454       init_missing_tag();
49455       init_mutually_exclusive_tags();
49456       init_osm_api_limits();
49457       init_outdated_tags();
49458       init_private_data();
49459       init_suspicious_name();
49460       init_unsquare_way();
49461     }
49462   });
49463
49464   // modules/core/validator.js
49465   var validator_exports = {};
49466   __export(validator_exports, {
49467     coreValidator: () => coreValidator
49468   });
49469   function coreValidator(context) {
49470     let dispatch14 = dispatch_default("validated", "focusedIssue");
49471     const validator = {};
49472     let _rules = {};
49473     let _disabledRules = {};
49474     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
49475     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
49476     let _baseCache = validationCache("base");
49477     let _headCache = validationCache("head");
49478     let _completeDiff = {};
49479     let _headIsCurrent = false;
49480     let _deferredRIC = {};
49481     let _deferredST = /* @__PURE__ */ new Set();
49482     let _headPromise;
49483     const RETRY = 5e3;
49484     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
49485     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
49486     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
49487     function parseHashParam(param) {
49488       let result = [];
49489       let rules = (param || "").split(",");
49490       rules.forEach((rule) => {
49491         rule = rule.trim();
49492         const parts = rule.split("/", 2);
49493         const type2 = parts[0];
49494         const subtype = parts[1] || "*";
49495         if (!type2 || !subtype) return;
49496         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
49497       });
49498       return result;
49499       function makeRegExp(str) {
49500         const escaped = str.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
49501         return new RegExp("^" + escaped + "$");
49502       }
49503     }
49504     validator.init = () => {
49505       Object.values(validations_exports).forEach((validation) => {
49506         if (typeof validation !== "function") return;
49507         const fn = validation(context);
49508         const key = fn.type;
49509         _rules[key] = fn;
49510       });
49511       let disabledRules = corePreferences("validate-disabledRules");
49512       if (disabledRules) {
49513         disabledRules.split(",").forEach((k3) => _disabledRules[k3] = true);
49514       }
49515     };
49516     function reset(resetIgnored) {
49517       _baseCache.queue = [];
49518       _headCache.queue = [];
49519       Object.keys(_deferredRIC).forEach((key) => {
49520         window.cancelIdleCallback(key);
49521         _deferredRIC[key]();
49522       });
49523       _deferredRIC = {};
49524       _deferredST.forEach(window.clearTimeout);
49525       _deferredST.clear();
49526       if (resetIgnored) _ignoredIssueIDs.clear();
49527       _resolvedIssueIDs.clear();
49528       _baseCache = validationCache("base");
49529       _headCache = validationCache("head");
49530       _completeDiff = {};
49531       _headIsCurrent = false;
49532     }
49533     validator.reset = () => {
49534       reset(true);
49535     };
49536     validator.resetIgnoredIssues = () => {
49537       _ignoredIssueIDs.clear();
49538       dispatch14.call("validated");
49539     };
49540     validator.revalidateUnsquare = () => {
49541       revalidateUnsquare(_headCache);
49542       revalidateUnsquare(_baseCache);
49543       dispatch14.call("validated");
49544     };
49545     function revalidateUnsquare(cache) {
49546       const checkUnsquareWay = _rules.unsquare_way;
49547       if (!cache.graph || typeof checkUnsquareWay !== "function") return;
49548       cache.uncacheIssuesOfType("unsquare_way");
49549       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");
49550       buildings.forEach((entity) => {
49551         const detected = checkUnsquareWay(entity, cache.graph);
49552         if (!detected.length) return;
49553         cache.cacheIssues(detected);
49554       });
49555     }
49556     validator.getIssues = (options) => {
49557       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options);
49558       const view = context.map().extent();
49559       let seen = /* @__PURE__ */ new Set();
49560       let results = [];
49561       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
49562         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
49563           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
49564           if (opts.what === "edited" && !userModified) return;
49565           if (!filter2(issue)) return;
49566           seen.add(issue.id);
49567           results.push(issue);
49568         });
49569       }
49570       if (opts.what === "all") {
49571         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
49572           if (!filter2(issue)) return;
49573           seen.add(issue.id);
49574           results.push(issue);
49575         });
49576       }
49577       return results;
49578       function filter2(issue) {
49579         if (!issue) return false;
49580         if (seen.has(issue.id)) return false;
49581         if (_resolvedIssueIDs.has(issue.id)) return false;
49582         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type]) return false;
49583         if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false;
49584         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id)) return false;
49585         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id)) return false;
49586         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2))) return false;
49587         if (opts.where === "visible") {
49588           const extent = issue.extent(context.graph());
49589           if (!view.intersects(extent)) return false;
49590         }
49591         return true;
49592       }
49593     };
49594     validator.getResolvedIssues = () => {
49595       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
49596     };
49597     validator.focusIssue = (issue) => {
49598       const graph = context.graph();
49599       let selectID;
49600       let focusCenter;
49601       const issueExtent = issue.extent(graph);
49602       if (issueExtent) {
49603         focusCenter = issueExtent.center();
49604       }
49605       if (issue.entityIds && issue.entityIds.length) {
49606         selectID = issue.entityIds[0];
49607         if (selectID && selectID.charAt(0) === "r") {
49608           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
49609           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
49610           if (!nodeID) {
49611             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
49612             if (wayID) {
49613               nodeID = graph.entity(wayID).first();
49614             }
49615           }
49616           if (nodeID) {
49617             focusCenter = graph.entity(nodeID).loc;
49618           }
49619         }
49620       }
49621       if (focusCenter) {
49622         const setZoom = Math.max(context.map().zoom(), 19);
49623         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
49624       }
49625       if (selectID) {
49626         window.setTimeout(() => {
49627           context.enter(modeSelect(context, [selectID]));
49628           dispatch14.call("focusedIssue", this, issue);
49629         }, 250);
49630       }
49631     };
49632     validator.getIssuesBySeverity = (options) => {
49633       let groups = utilArrayGroupBy(validator.getIssues(options), "severity");
49634       groups.error = groups.error || [];
49635       groups.warning = groups.warning || [];
49636       return groups;
49637     };
49638     validator.getSharedEntityIssues = (entityIDs, options) => {
49639       const orderedIssueTypes = [
49640         // Show some issue types in a particular order:
49641         "missing_tag",
49642         "missing_role",
49643         // - missing data first
49644         "outdated_tags",
49645         "mismatched_geometry",
49646         // - identity issues
49647         "crossing_ways",
49648         "almost_junction",
49649         // - geometry issues where fixing them might solve connectivity issues
49650         "disconnected_way",
49651         "impossible_oneway"
49652         // - finally connectivity issues
49653       ];
49654       const allIssues = validator.getIssues(options);
49655       const forEntityIDs = new Set(entityIDs);
49656       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
49657         if (issue1.type === issue2.type) {
49658           return issue1.id < issue2.id ? -1 : 1;
49659         }
49660         const index1 = orderedIssueTypes.indexOf(issue1.type);
49661         const index2 = orderedIssueTypes.indexOf(issue2.type);
49662         if (index1 !== -1 && index2 !== -1) {
49663           return index1 - index2;
49664         } else if (index1 === -1 && index2 === -1) {
49665           return issue1.type < issue2.type ? -1 : 1;
49666         } else {
49667           return index1 !== -1 ? -1 : 1;
49668         }
49669       });
49670     };
49671     validator.getEntityIssues = (entityID, options) => {
49672       return validator.getSharedEntityIssues([entityID], options);
49673     };
49674     validator.getRuleKeys = () => {
49675       return Object.keys(_rules);
49676     };
49677     validator.isRuleEnabled = (key) => {
49678       return !_disabledRules[key];
49679     };
49680     validator.toggleRule = (key) => {
49681       if (_disabledRules[key]) {
49682         delete _disabledRules[key];
49683       } else {
49684         _disabledRules[key] = true;
49685       }
49686       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
49687       validator.validate();
49688     };
49689     validator.disableRules = (keys2) => {
49690       _disabledRules = {};
49691       keys2.forEach((k3) => _disabledRules[k3] = true);
49692       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
49693       validator.validate();
49694     };
49695     validator.ignoreIssue = (issueID) => {
49696       _ignoredIssueIDs.add(issueID);
49697     };
49698     validator.validate = () => {
49699       const baseGraph = context.history().base();
49700       if (!_headCache.graph) _headCache.graph = baseGraph;
49701       if (!_baseCache.graph) _baseCache.graph = baseGraph;
49702       const prevGraph = _headCache.graph;
49703       const currGraph = context.graph();
49704       if (currGraph === prevGraph) {
49705         _headIsCurrent = true;
49706         dispatch14.call("validated");
49707         return Promise.resolve();
49708       }
49709       if (_headPromise) {
49710         _headIsCurrent = false;
49711         return _headPromise;
49712       }
49713       _headCache.graph = currGraph;
49714       _completeDiff = context.history().difference().complete();
49715       const incrementalDiff = coreDifference(prevGraph, currGraph);
49716       const diff = Object.keys(incrementalDiff.complete());
49717       const entityIDs = _headCache.withAllRelatedEntities(diff);
49718       if (!entityIDs.size) {
49719         dispatch14.call("validated");
49720         return Promise.resolve();
49721       }
49722       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));
49723       addConnectedWays(currGraph);
49724       addConnectedWays(prevGraph);
49725       Object.values({ ...incrementalDiff.created(), ...incrementalDiff.deleted() }).filter((e3) => e3.type === "relation").flatMap((r2) => r2.members).forEach((m3) => entityIDs.add(m3.id));
49726       Object.values(incrementalDiff.modified()).filter((e3) => e3.type === "relation").map((r2) => ({ baseEntity: prevGraph.entity(r2.id), headEntity: r2 })).forEach(({ baseEntity, headEntity }) => {
49727         const bm = baseEntity.members.map((m3) => m3.id);
49728         const hm = headEntity.members.map((m3) => m3.id);
49729         const symDiff = utilArrayDifference(utilArrayUnion(bm, hm), utilArrayIntersection(bm, hm));
49730         symDiff.forEach((id2) => entityIDs.add(id2));
49731       });
49732       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
49733       }).then(() => {
49734         _headPromise = null;
49735         if (!_headIsCurrent) {
49736           validator.validate();
49737         }
49738       });
49739       return _headPromise;
49740     };
49741     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
49742       reset(false);
49743       validator.validate();
49744     });
49745     context.on("exit.validator", validator.validate);
49746     context.history().on("merge.validator", (entities) => {
49747       if (!entities) return;
49748       const baseGraph = context.history().base();
49749       if (!_headCache.graph) _headCache.graph = baseGraph;
49750       if (!_baseCache.graph) _baseCache.graph = baseGraph;
49751       let entityIDs = entities.map((entity) => entity.id);
49752       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
49753       validateEntitiesAsync(entityIDs, _baseCache);
49754     });
49755     function validateEntity(entity, graph) {
49756       let result = { issues: [], provisional: false };
49757       Object.keys(_rules).forEach(runValidation);
49758       return result;
49759       function runValidation(key) {
49760         const fn = _rules[key];
49761         if (typeof fn !== "function") {
49762           console.error("no such validation rule = " + key);
49763           return;
49764         }
49765         let detected = fn(entity, graph);
49766         if (detected.provisional) {
49767           result.provisional = true;
49768         }
49769         detected = detected.filter(applySeverityOverrides);
49770         result.issues = result.issues.concat(detected);
49771         function applySeverityOverrides(issue) {
49772           const type2 = issue.type;
49773           const subtype = issue.subtype || "";
49774           let i3;
49775           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
49776             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
49777               issue.severity = "error";
49778               return true;
49779             }
49780           }
49781           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
49782             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
49783               issue.severity = "warning";
49784               return true;
49785             }
49786           }
49787           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
49788             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
49789               return false;
49790             }
49791           }
49792           return true;
49793         }
49794       }
49795     }
49796     function updateResolvedIssues(entityIDs) {
49797       entityIDs.forEach((entityID) => {
49798         const baseIssues = _baseCache.issuesByEntityID[entityID];
49799         if (!baseIssues) return;
49800         baseIssues.forEach((issueID) => {
49801           const issue = _baseCache.issuesByIssueID[issueID];
49802           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
49803           if (userModified && !_headCache.issuesByIssueID[issueID]) {
49804             _resolvedIssueIDs.add(issueID);
49805           } else {
49806             _resolvedIssueIDs.delete(issueID);
49807           }
49808         });
49809       });
49810     }
49811     function validateEntitiesAsync(entityIDs, cache) {
49812       const jobs = Array.from(entityIDs).map((entityID) => {
49813         if (cache.queuedEntityIDs.has(entityID)) return null;
49814         cache.queuedEntityIDs.add(entityID);
49815         cache.uncacheEntityID(entityID);
49816         return () => {
49817           cache.queuedEntityIDs.delete(entityID);
49818           const graph = cache.graph;
49819           if (!graph) return;
49820           const entity = graph.hasEntity(entityID);
49821           if (!entity) return;
49822           const result = validateEntity(entity, graph);
49823           if (result.provisional) {
49824             cache.provisionalEntityIDs.add(entityID);
49825           }
49826           cache.cacheIssues(result.issues);
49827         };
49828       }).filter(Boolean);
49829       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
49830       if (cache.queuePromise) return cache.queuePromise;
49831       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
49832       }).finally(() => cache.queuePromise = null);
49833       return cache.queuePromise;
49834     }
49835     function revalidateProvisionalEntities(cache) {
49836       if (!cache.provisionalEntityIDs.size) return;
49837       const handle = window.setTimeout(() => {
49838         _deferredST.delete(handle);
49839         if (!cache.provisionalEntityIDs.size) return;
49840         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
49841       }, RETRY);
49842       _deferredST.add(handle);
49843     }
49844     function processQueue(cache) {
49845       if (!cache.queue.length) return Promise.resolve();
49846       const chunk = cache.queue.pop();
49847       return new Promise((resolvePromise, rejectPromise) => {
49848         const handle = window.requestIdleCallback(() => {
49849           delete _deferredRIC[handle];
49850           chunk.forEach((job) => job());
49851           resolvePromise();
49852         });
49853         _deferredRIC[handle] = rejectPromise;
49854       }).then(() => {
49855         if (cache.queue.length % 25 === 0) dispatch14.call("validated");
49856       }).then(() => processQueue(cache));
49857     }
49858     return utilRebind(validator, dispatch14, "on");
49859   }
49860   function validationCache(which) {
49861     let cache = {
49862       which,
49863       graph: null,
49864       queue: [],
49865       queuePromise: null,
49866       queuedEntityIDs: /* @__PURE__ */ new Set(),
49867       provisionalEntityIDs: /* @__PURE__ */ new Set(),
49868       issuesByIssueID: {},
49869       // issue.id -> issue
49870       issuesByEntityID: {}
49871       // entity.id -> Set(issue.id)
49872     };
49873     cache.cacheIssue = (issue) => {
49874       (issue.entityIds || []).forEach((entityID) => {
49875         if (!cache.issuesByEntityID[entityID]) {
49876           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
49877         }
49878         cache.issuesByEntityID[entityID].add(issue.id);
49879       });
49880       cache.issuesByIssueID[issue.id] = issue;
49881     };
49882     cache.uncacheIssue = (issue) => {
49883       (issue.entityIds || []).forEach((entityID) => {
49884         if (cache.issuesByEntityID[entityID]) {
49885           cache.issuesByEntityID[entityID].delete(issue.id);
49886         }
49887       });
49888       delete cache.issuesByIssueID[issue.id];
49889     };
49890     cache.cacheIssues = (issues) => {
49891       issues.forEach(cache.cacheIssue);
49892     };
49893     cache.uncacheIssues = (issues) => {
49894       issues.forEach(cache.uncacheIssue);
49895     };
49896     cache.uncacheIssuesOfType = (type2) => {
49897       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
49898       cache.uncacheIssues(issuesOfType);
49899     };
49900     cache.uncacheEntityID = (entityID) => {
49901       const entityIssueIDs = cache.issuesByEntityID[entityID];
49902       if (entityIssueIDs) {
49903         entityIssueIDs.forEach((issueID) => {
49904           const issue = cache.issuesByIssueID[issueID];
49905           if (issue) {
49906             cache.uncacheIssue(issue);
49907           } else {
49908             delete cache.issuesByIssueID[issueID];
49909           }
49910         });
49911       }
49912       delete cache.issuesByEntityID[entityID];
49913       cache.provisionalEntityIDs.delete(entityID);
49914     };
49915     cache.withAllRelatedEntities = (entityIDs) => {
49916       let result = /* @__PURE__ */ new Set();
49917       (entityIDs || []).forEach((entityID) => {
49918         result.add(entityID);
49919         const entityIssueIDs = cache.issuesByEntityID[entityID];
49920         if (entityIssueIDs) {
49921           entityIssueIDs.forEach((issueID) => {
49922             const issue = cache.issuesByIssueID[issueID];
49923             if (issue) {
49924               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
49925             } else {
49926               delete cache.issuesByIssueID[issueID];
49927             }
49928           });
49929         }
49930       });
49931       return result;
49932     };
49933     return cache;
49934   }
49935   var init_validator = __esm({
49936     "modules/core/validator.js"() {
49937       "use strict";
49938       init_src4();
49939       init_preferences();
49940       init_difference();
49941       init_extent();
49942       init_select5();
49943       init_util();
49944       init_validations();
49945     }
49946   });
49947
49948   // modules/core/uploader.js
49949   var uploader_exports = {};
49950   __export(uploader_exports, {
49951     coreUploader: () => coreUploader
49952   });
49953   function coreUploader(context) {
49954     var dispatch14 = dispatch_default(
49955       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
49956       "saveStarted",
49957       // dispatched as soon as a call to `save` has been deemed legitimate
49958       "saveEnded",
49959       // dispatched after the result event has been dispatched
49960       "willAttemptUpload",
49961       // dispatched before the actual upload call occurs, if it will
49962       "progressChanged",
49963       // Each save results in one of these outcomes:
49964       "resultNoChanges",
49965       // upload wasn't attempted since there were no edits
49966       "resultErrors",
49967       // upload failed due to errors
49968       "resultConflicts",
49969       // upload failed due to data conflicts
49970       "resultSuccess"
49971       // upload completed without errors
49972     );
49973     var _isSaving = false;
49974     let _anyConflictsAutomaticallyResolved = false;
49975     var _conflicts = [];
49976     var _errors = [];
49977     var _origChanges;
49978     var _discardTags = {};
49979     _mainFileFetcher.get("discarded").then(function(d2) {
49980       _discardTags = d2;
49981     }).catch(function() {
49982     });
49983     const uploader = {};
49984     uploader.isSaving = function() {
49985       return _isSaving;
49986     };
49987     uploader.save = function(changeset, tryAgain, checkConflicts) {
49988       if (_isSaving && !tryAgain) {
49989         return;
49990       }
49991       var osm = context.connection();
49992       if (!osm) return;
49993       if (!osm.authenticated()) {
49994         osm.authenticate(function(err) {
49995           if (!err) {
49996             uploader.save(changeset, tryAgain, checkConflicts);
49997           }
49998         });
49999         return;
50000       }
50001       if (!_isSaving) {
50002         _isSaving = true;
50003         dispatch14.call("saveStarted", this);
50004       }
50005       var history = context.history();
50006       _anyConflictsAutomaticallyResolved = false;
50007       _conflicts = [];
50008       _errors = [];
50009       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
50010       if (!tryAgain) {
50011         history.perform(actionNoop());
50012       }
50013       if (!checkConflicts) {
50014         upload(changeset);
50015       } else {
50016         performFullConflictCheck(changeset);
50017       }
50018     };
50019     function performFullConflictCheck(changeset) {
50020       var osm = context.connection();
50021       if (!osm) return;
50022       var history = context.history();
50023       var localGraph = context.graph();
50024       var remoteGraph = coreGraph(history.base(), true);
50025       var summary = history.difference().summary();
50026       var _toCheck = [];
50027       for (var i3 = 0; i3 < summary.length; i3++) {
50028         var item = summary[i3];
50029         if (item.changeType === "modified") {
50030           _toCheck.push(item.entity.id);
50031         }
50032       }
50033       var _toLoad = withChildNodes(_toCheck, localGraph);
50034       var _loaded = {};
50035       var _toLoadCount = 0;
50036       var _toLoadTotal = _toLoad.length;
50037       if (_toCheck.length) {
50038         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
50039         _toLoad.forEach(function(id2) {
50040           _loaded[id2] = false;
50041         });
50042         osm.loadMultiple(_toLoad, loaded);
50043       } else {
50044         upload(changeset);
50045       }
50046       return;
50047       function withChildNodes(ids, graph) {
50048         var s2 = new Set(ids);
50049         ids.forEach(function(id2) {
50050           var entity = graph.entity(id2);
50051           if (entity.type !== "way") return;
50052           graph.childNodes(entity).forEach(function(child) {
50053             if (child.version !== void 0) {
50054               s2.add(child.id);
50055             }
50056           });
50057         });
50058         return Array.from(s2);
50059       }
50060       function loaded(err, result) {
50061         if (_errors.length) return;
50062         if (err) {
50063           _errors.push({
50064             msg: err.message || err.responseText,
50065             details: [_t("save.status_code", { code: err.status })]
50066           });
50067           didResultInErrors();
50068         } else {
50069           var loadMore = [];
50070           result.data.forEach(function(entity) {
50071             remoteGraph.replace(entity);
50072             _loaded[entity.id] = true;
50073             _toLoad = _toLoad.filter(function(val) {
50074               return val !== entity.id;
50075             });
50076             if (!entity.visible) return;
50077             var i4, id2;
50078             if (entity.type === "way") {
50079               for (i4 = 0; i4 < entity.nodes.length; i4++) {
50080                 id2 = entity.nodes[i4];
50081                 if (_loaded[id2] === void 0) {
50082                   _loaded[id2] = false;
50083                   loadMore.push(id2);
50084                 }
50085               }
50086             } else if (entity.type === "relation" && entity.isMultipolygon()) {
50087               for (i4 = 0; i4 < entity.members.length; i4++) {
50088                 id2 = entity.members[i4].id;
50089                 if (_loaded[id2] === void 0) {
50090                   _loaded[id2] = false;
50091                   loadMore.push(id2);
50092                 }
50093               }
50094             }
50095           });
50096           _toLoadCount += result.data.length;
50097           _toLoadTotal += loadMore.length;
50098           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
50099           if (loadMore.length) {
50100             _toLoad.push.apply(_toLoad, loadMore);
50101             osm.loadMultiple(loadMore, loaded);
50102           }
50103           if (!_toLoad.length) {
50104             detectConflicts();
50105             upload(changeset);
50106           }
50107         }
50108       }
50109       function detectConflicts() {
50110         function choice(id2, text, action) {
50111           return {
50112             id: id2,
50113             text,
50114             action: function() {
50115               history.replace(action);
50116             }
50117           };
50118         }
50119         function formatUser(d2) {
50120           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
50121         }
50122         function entityName(entity) {
50123           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
50124         }
50125         function sameVersions(local, remote) {
50126           if (local.version !== remote.version) return false;
50127           if (local.type === "way") {
50128             var children2 = utilArrayUnion(local.nodes, remote.nodes);
50129             for (var i4 = 0; i4 < children2.length; i4++) {
50130               var a4 = localGraph.hasEntity(children2[i4]);
50131               var b3 = remoteGraph.hasEntity(children2[i4]);
50132               if (a4 && b3 && a4.version !== b3.version) return false;
50133             }
50134           }
50135           return true;
50136         }
50137         _toCheck.forEach(function(id2) {
50138           var local = localGraph.entity(id2);
50139           var remote = remoteGraph.entity(id2);
50140           if (sameVersions(local, remote)) return;
50141           var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
50142           history.replace(merge3);
50143           var mergeConflicts = merge3.conflicts();
50144           if (!mergeConflicts.length) {
50145             _anyConflictsAutomaticallyResolved = true;
50146             return;
50147           }
50148           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
50149           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
50150           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
50151           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
50152           _conflicts.push({
50153             id: id2,
50154             name: entityName(local),
50155             details: mergeConflicts,
50156             chosen: 1,
50157             choices: [
50158               choice(id2, keepMine, forceLocal),
50159               choice(id2, keepTheirs, forceRemote)
50160             ]
50161           });
50162         });
50163       }
50164     }
50165     async function upload(changeset) {
50166       var osm = context.connection();
50167       if (!osm) {
50168         _errors.push({ msg: "No OSM Service" });
50169       }
50170       if (_conflicts.length) {
50171         didResultInConflicts(changeset);
50172       } else if (_errors.length) {
50173         didResultInErrors();
50174       } else {
50175         if (_anyConflictsAutomaticallyResolved) {
50176           changeset.tags.merge_conflict_resolved = "automatically";
50177           await osm.updateChangesetTags(changeset);
50178         }
50179         var history = context.history();
50180         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
50181         if (changes.modified.length || changes.created.length || changes.deleted.length) {
50182           dispatch14.call("willAttemptUpload", this);
50183           osm.putChangeset(changeset, changes, uploadCallback);
50184         } else {
50185           didResultInNoChanges();
50186         }
50187       }
50188     }
50189     function uploadCallback(err, changeset) {
50190       if (err) {
50191         if (err.status === 409) {
50192           uploader.save(changeset, true, true);
50193         } else {
50194           _errors.push({
50195             msg: err.message || err.responseText,
50196             details: [_t("save.status_code", { code: err.status })]
50197           });
50198           didResultInErrors();
50199         }
50200       } else {
50201         didResultInSuccess(changeset);
50202       }
50203     }
50204     function didResultInNoChanges() {
50205       dispatch14.call("resultNoChanges", this);
50206       endSave();
50207       context.flush();
50208     }
50209     function didResultInErrors() {
50210       context.history().pop();
50211       dispatch14.call("resultErrors", this, _errors);
50212       endSave();
50213     }
50214     function didResultInConflicts(changeset) {
50215       changeset.tags.merge_conflict_resolved = "manually";
50216       context.connection().updateChangesetTags(changeset);
50217       _conflicts.sort(function(a4, b3) {
50218         return b3.id.localeCompare(a4.id);
50219       });
50220       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
50221       endSave();
50222     }
50223     function didResultInSuccess(changeset) {
50224       context.history().clearSaved();
50225       dispatch14.call("resultSuccess", this, changeset);
50226       window.setTimeout(function() {
50227         endSave();
50228         context.flush();
50229       }, 2500);
50230     }
50231     function endSave() {
50232       _isSaving = false;
50233       dispatch14.call("saveEnded", this);
50234     }
50235     uploader.cancelConflictResolution = function() {
50236       context.history().pop();
50237     };
50238     uploader.processResolvedConflicts = function(changeset) {
50239       var history = context.history();
50240       for (var i3 = 0; i3 < _conflicts.length; i3++) {
50241         if (_conflicts[i3].chosen === 1) {
50242           var entity = context.hasEntity(_conflicts[i3].id);
50243           if (entity && entity.type === "way") {
50244             var children2 = utilArrayUniq(entity.nodes);
50245             for (var j3 = 0; j3 < children2.length; j3++) {
50246               history.replace(actionRevert(children2[j3]));
50247             }
50248           }
50249           history.replace(actionRevert(_conflicts[i3].id));
50250         }
50251       }
50252       uploader.save(changeset, true, false);
50253     };
50254     uploader.reset = function() {
50255     };
50256     return utilRebind(uploader, dispatch14, "on");
50257   }
50258   var init_uploader = __esm({
50259     "modules/core/uploader.js"() {
50260       "use strict";
50261       init_src4();
50262       init_lodash();
50263       init_file_fetcher();
50264       init_discard_tags();
50265       init_merge_remote_changes();
50266       init_noop2();
50267       init_revert();
50268       init_graph();
50269       init_localizer();
50270       init_util();
50271     }
50272   });
50273
50274   // modules/modes/draw_area.js
50275   var draw_area_exports = {};
50276   __export(draw_area_exports, {
50277     modeDrawArea: () => modeDrawArea
50278   });
50279   function modeDrawArea(context, wayID, startGraph, button) {
50280     var mode = {
50281       button,
50282       id: "draw-area"
50283     };
50284     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
50285       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
50286     });
50287     mode.wayID = wayID;
50288     mode.enter = function() {
50289       context.install(behavior);
50290     };
50291     mode.exit = function() {
50292       context.uninstall(behavior);
50293     };
50294     mode.selectedIDs = function() {
50295       return [wayID];
50296     };
50297     mode.activeID = function() {
50298       return behavior && behavior.activeID() || [];
50299     };
50300     return mode;
50301   }
50302   var init_draw_area = __esm({
50303     "modules/modes/draw_area.js"() {
50304       "use strict";
50305       init_localizer();
50306       init_draw_way();
50307     }
50308   });
50309
50310   // modules/modes/add_area.js
50311   var add_area_exports = {};
50312   __export(add_area_exports, {
50313     modeAddArea: () => modeAddArea
50314   });
50315   function modeAddArea(context, mode) {
50316     mode.id = "add-area";
50317     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
50318     function defaultTags(loc) {
50319       var defaultTags2 = { area: "yes" };
50320       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
50321       return defaultTags2;
50322     }
50323     function actionClose(wayId) {
50324       return function(graph) {
50325         return graph.replace(graph.entity(wayId).close());
50326       };
50327     }
50328     function start2(loc) {
50329       var startGraph = context.graph();
50330       var node = osmNode({ loc });
50331       var way = osmWay({ tags: defaultTags(loc) });
50332       context.perform(
50333         actionAddEntity(node),
50334         actionAddEntity(way),
50335         actionAddVertex(way.id, node.id),
50336         actionClose(way.id)
50337       );
50338       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
50339     }
50340     function startFromWay(loc, edge) {
50341       var startGraph = context.graph();
50342       var node = osmNode({ loc });
50343       var way = osmWay({ tags: defaultTags(loc) });
50344       context.perform(
50345         actionAddEntity(node),
50346         actionAddEntity(way),
50347         actionAddVertex(way.id, node.id),
50348         actionClose(way.id),
50349         actionAddMidpoint({ loc, edge }, node)
50350       );
50351       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
50352     }
50353     function startFromNode(node) {
50354       var startGraph = context.graph();
50355       var way = osmWay({ tags: defaultTags(node.loc) });
50356       context.perform(
50357         actionAddEntity(way),
50358         actionAddVertex(way.id, node.id),
50359         actionClose(way.id)
50360       );
50361       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
50362     }
50363     mode.enter = function() {
50364       context.install(behavior);
50365     };
50366     mode.exit = function() {
50367       context.uninstall(behavior);
50368     };
50369     return mode;
50370   }
50371   var init_add_area = __esm({
50372     "modules/modes/add_area.js"() {
50373       "use strict";
50374       init_add_entity();
50375       init_add_midpoint();
50376       init_add_vertex();
50377       init_add_way();
50378       init_draw_area();
50379       init_osm();
50380     }
50381   });
50382
50383   // modules/modes/add_line.js
50384   var add_line_exports = {};
50385   __export(add_line_exports, {
50386     modeAddLine: () => modeAddLine
50387   });
50388   function modeAddLine(context, mode) {
50389     mode.id = "add-line";
50390     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
50391     function defaultTags(loc) {
50392       var defaultTags2 = {};
50393       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
50394       return defaultTags2;
50395     }
50396     function start2(loc) {
50397       var startGraph = context.graph();
50398       var node = osmNode({ loc });
50399       var way = osmWay({ tags: defaultTags(loc) });
50400       context.perform(
50401         actionAddEntity(node),
50402         actionAddEntity(way),
50403         actionAddVertex(way.id, node.id)
50404       );
50405       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
50406     }
50407     function startFromWay(loc, edge) {
50408       var startGraph = context.graph();
50409       var node = osmNode({ loc });
50410       var way = osmWay({ tags: defaultTags(loc) });
50411       context.perform(
50412         actionAddEntity(node),
50413         actionAddEntity(way),
50414         actionAddVertex(way.id, node.id),
50415         actionAddMidpoint({ loc, edge }, node)
50416       );
50417       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
50418     }
50419     function startFromNode(node) {
50420       var startGraph = context.graph();
50421       var way = osmWay({ tags: defaultTags(node.loc) });
50422       context.perform(
50423         actionAddEntity(way),
50424         actionAddVertex(way.id, node.id)
50425       );
50426       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
50427     }
50428     mode.enter = function() {
50429       context.install(behavior);
50430     };
50431     mode.exit = function() {
50432       context.uninstall(behavior);
50433     };
50434     return mode;
50435   }
50436   var init_add_line = __esm({
50437     "modules/modes/add_line.js"() {
50438       "use strict";
50439       init_add_entity();
50440       init_add_midpoint();
50441       init_add_vertex();
50442       init_add_way();
50443       init_draw_line();
50444       init_osm();
50445     }
50446   });
50447
50448   // modules/modes/add_point.js
50449   var add_point_exports = {};
50450   __export(add_point_exports, {
50451     modeAddPoint: () => modeAddPoint
50452   });
50453   function modeAddPoint(context, mode) {
50454     mode.id = "add-point";
50455     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
50456     function defaultTags(loc) {
50457       var defaultTags2 = {};
50458       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
50459       return defaultTags2;
50460     }
50461     function add(loc) {
50462       var node = osmNode({ loc, tags: defaultTags(loc) });
50463       context.perform(
50464         actionAddEntity(node),
50465         _t("operations.add.annotation.point")
50466       );
50467       enterSelectMode(node);
50468     }
50469     function addWay(loc, edge) {
50470       var node = osmNode({ tags: defaultTags(loc) });
50471       context.perform(
50472         actionAddMidpoint({ loc, edge }, node),
50473         _t("operations.add.annotation.vertex")
50474       );
50475       enterSelectMode(node);
50476     }
50477     function enterSelectMode(node) {
50478       context.enter(
50479         modeSelect(context, [node.id]).newFeature(true)
50480       );
50481     }
50482     function addNode(node) {
50483       const _defaultTags = defaultTags(node.loc);
50484       if (Object.keys(_defaultTags).length === 0) {
50485         enterSelectMode(node);
50486         return;
50487       }
50488       var tags = Object.assign({}, node.tags);
50489       for (var key in _defaultTags) {
50490         tags[key] = _defaultTags[key];
50491       }
50492       context.perform(
50493         actionChangeTags(node.id, tags),
50494         _t("operations.add.annotation.point")
50495       );
50496       enterSelectMode(node);
50497     }
50498     function cancel() {
50499       context.enter(modeBrowse(context));
50500     }
50501     mode.enter = function() {
50502       context.install(behavior);
50503     };
50504     mode.exit = function() {
50505       context.uninstall(behavior);
50506     };
50507     return mode;
50508   }
50509   var init_add_point = __esm({
50510     "modules/modes/add_point.js"() {
50511       "use strict";
50512       init_localizer();
50513       init_draw();
50514       init_browse();
50515       init_select5();
50516       init_node2();
50517       init_add_entity();
50518       init_change_tags();
50519       init_add_midpoint();
50520     }
50521   });
50522
50523   // modules/behavior/drag.js
50524   var drag_exports = {};
50525   __export(drag_exports, {
50526     behaviorDrag: () => behaviorDrag
50527   });
50528   function behaviorDrag() {
50529     var dispatch14 = dispatch_default("start", "move", "end");
50530     var _tolerancePx = 1;
50531     var _penTolerancePx = 4;
50532     var _origin = null;
50533     var _selector = "";
50534     var _targetNode;
50535     var _targetEntity;
50536     var _surface;
50537     var _pointerId;
50538     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
50539     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
50540     var d3_event_userSelectSuppress = function() {
50541       var selection2 = selection_default();
50542       var select = selection2.style(d3_event_userSelectProperty);
50543       selection2.style(d3_event_userSelectProperty, "none");
50544       return function() {
50545         selection2.style(d3_event_userSelectProperty, select);
50546       };
50547     };
50548     function pointerdown(d3_event) {
50549       if (_pointerId) return;
50550       _pointerId = d3_event.pointerId || "mouse";
50551       _targetNode = this;
50552       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
50553       var offset;
50554       var startOrigin = pointerLocGetter(d3_event);
50555       var started = false;
50556       var selectEnable = d3_event_userSelectSuppress();
50557       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
50558       if (_origin) {
50559         offset = _origin.call(_targetNode, _targetEntity);
50560         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
50561       } else {
50562         offset = [0, 0];
50563       }
50564       d3_event.stopPropagation();
50565       function pointermove(d3_event2) {
50566         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
50567         var p2 = pointerLocGetter(d3_event2);
50568         if (!started) {
50569           var dist = geoVecLength(startOrigin, p2);
50570           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
50571           if (dist < tolerance) return;
50572           started = true;
50573           dispatch14.call("start", this, d3_event2, _targetEntity);
50574         } else {
50575           startOrigin = p2;
50576           d3_event2.stopPropagation();
50577           d3_event2.preventDefault();
50578           var dx = p2[0] - startOrigin[0];
50579           var dy = p2[1] - startOrigin[1];
50580           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
50581         }
50582       }
50583       function pointerup(d3_event2) {
50584         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
50585         _pointerId = null;
50586         if (started) {
50587           dispatch14.call("end", this, d3_event2, _targetEntity);
50588           d3_event2.preventDefault();
50589         }
50590         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
50591         selectEnable();
50592       }
50593     }
50594     function behavior(selection2) {
50595       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
50596       var delegate = pointerdown;
50597       if (_selector) {
50598         delegate = function(d3_event) {
50599           var root3 = this;
50600           var target = d3_event.target;
50601           for (; target && target !== root3; target = target.parentNode) {
50602             var datum2 = target.__data__;
50603             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
50604             if (_targetEntity && target[matchesSelector](_selector)) {
50605               return pointerdown.call(target, d3_event);
50606             }
50607           }
50608         };
50609       }
50610       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
50611     }
50612     behavior.off = function(selection2) {
50613       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
50614     };
50615     behavior.selector = function(_3) {
50616       if (!arguments.length) return _selector;
50617       _selector = _3;
50618       return behavior;
50619     };
50620     behavior.origin = function(_3) {
50621       if (!arguments.length) return _origin;
50622       _origin = _3;
50623       return behavior;
50624     };
50625     behavior.cancel = function() {
50626       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
50627       return behavior;
50628     };
50629     behavior.targetNode = function(_3) {
50630       if (!arguments.length) return _targetNode;
50631       _targetNode = _3;
50632       return behavior;
50633     };
50634     behavior.targetEntity = function(_3) {
50635       if (!arguments.length) return _targetEntity;
50636       _targetEntity = _3;
50637       return behavior;
50638     };
50639     behavior.surface = function(_3) {
50640       if (!arguments.length) return _surface;
50641       _surface = _3;
50642       return behavior;
50643     };
50644     return utilRebind(behavior, dispatch14, "on");
50645   }
50646   var init_drag2 = __esm({
50647     "modules/behavior/drag.js"() {
50648       "use strict";
50649       init_src4();
50650       init_src5();
50651       init_geo2();
50652       init_osm();
50653       init_rebind();
50654       init_util();
50655     }
50656   });
50657
50658   // modules/modes/drag_node.js
50659   var drag_node_exports = {};
50660   __export(drag_node_exports, {
50661     modeDragNode: () => modeDragNode
50662   });
50663   function modeDragNode(context) {
50664     var mode = {
50665       id: "drag-node",
50666       button: "browse"
50667     };
50668     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
50669     var edit = behaviorEdit(context);
50670     var _nudgeInterval;
50671     var _restoreSelectedIDs = [];
50672     var _wasMidpoint = false;
50673     var _isCancelled = false;
50674     var _activeEntity;
50675     var _startLoc;
50676     var _lastLoc;
50677     function startNudge(d3_event, entity, nudge) {
50678       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
50679       _nudgeInterval = window.setInterval(function() {
50680         context.map().pan(nudge);
50681         doMove(d3_event, entity, nudge);
50682       }, 50);
50683     }
50684     function stopNudge() {
50685       if (_nudgeInterval) {
50686         window.clearInterval(_nudgeInterval);
50687         _nudgeInterval = null;
50688       }
50689     }
50690     function moveAnnotation(entity) {
50691       return _t("operations.move.annotation." + entity.geometry(context.graph()));
50692     }
50693     function connectAnnotation(nodeEntity, targetEntity) {
50694       var nodeGeometry = nodeEntity.geometry(context.graph());
50695       var targetGeometry = targetEntity.geometry(context.graph());
50696       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
50697         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
50698         var targetParentWayIDs = context.graph().parentWays(targetEntity);
50699         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
50700         if (sharedParentWays.length !== 0) {
50701           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
50702             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
50703           }
50704           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
50705         }
50706       }
50707       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
50708     }
50709     function shouldSnapToNode(target) {
50710       if (!_activeEntity) return false;
50711       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
50712     }
50713     function origin(entity) {
50714       return context.projection(entity.loc);
50715     }
50716     function keydown(d3_event) {
50717       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
50718         if (context.surface().classed("nope")) {
50719           context.surface().classed("nope-suppressed", true);
50720         }
50721         context.surface().classed("nope", false).classed("nope-disabled", true);
50722       }
50723     }
50724     function keyup(d3_event) {
50725       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
50726         if (context.surface().classed("nope-suppressed")) {
50727           context.surface().classed("nope", true);
50728         }
50729         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
50730       }
50731     }
50732     function start2(d3_event, entity) {
50733       _wasMidpoint = entity.type === "midpoint";
50734       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
50735       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
50736       if (_isCancelled) {
50737         if (hasHidden) {
50738           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
50739         }
50740         return drag.cancel();
50741       }
50742       if (_wasMidpoint) {
50743         var midpoint = entity;
50744         entity = osmNode();
50745         context.perform(actionAddMidpoint(midpoint, entity));
50746         entity = context.entity(entity.id);
50747         var vertex = context.surface().selectAll("." + entity.id);
50748         drag.targetNode(vertex.node()).targetEntity(entity);
50749       } else {
50750         context.perform(actionNoop());
50751       }
50752       _activeEntity = entity;
50753       _startLoc = entity.loc;
50754       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
50755       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
50756       context.enter(mode);
50757     }
50758     function datum2(d3_event) {
50759       if (!d3_event || d3_event.altKey) {
50760         return {};
50761       } else {
50762         var d2 = d3_event.target.__data__;
50763         return d2 && d2.properties && d2.properties.target ? d2 : {};
50764       }
50765     }
50766     function doMove(d3_event, entity, nudge) {
50767       nudge = nudge || [0, 0];
50768       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
50769       var currMouse = geoVecSubtract(currPoint, nudge);
50770       var loc = context.projection.invert(currMouse);
50771       var target, edge;
50772       if (!_nudgeInterval) {
50773         var d2 = datum2(d3_event);
50774         target = d2 && d2.properties && d2.properties.entity;
50775         var targetLoc = target && target.loc;
50776         var targetNodes = d2 && d2.properties && d2.properties.nodes;
50777         if (targetLoc) {
50778           if (shouldSnapToNode(target)) {
50779             loc = targetLoc;
50780           }
50781         } else if (targetNodes) {
50782           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
50783           if (edge) {
50784             loc = edge.loc;
50785           }
50786         }
50787       }
50788       context.replace(
50789         actionMoveNode(entity.id, loc)
50790       );
50791       var isInvalid = false;
50792       if (target) {
50793         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
50794       }
50795       if (!isInvalid) {
50796         isInvalid = hasInvalidGeometry(entity, context.graph());
50797       }
50798       var nope = context.surface().classed("nope");
50799       if (isInvalid === "relation" || isInvalid === "restriction") {
50800         if (!nope) {
50801           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
50802             "operations.connect." + isInvalid,
50803             { relation: _mainPresetIndex.item("type/restriction").name() }
50804           ))();
50805         }
50806       } else if (isInvalid) {
50807         var errorID = isInvalid === "line" ? "lines" : "areas";
50808         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
50809       } else {
50810         if (nope) {
50811           context.ui().flash.duration(1).label("")();
50812         }
50813       }
50814       var nopeDisabled = context.surface().classed("nope-disabled");
50815       if (nopeDisabled) {
50816         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
50817       } else {
50818         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
50819       }
50820       _lastLoc = loc;
50821     }
50822     function hasRelationConflict(entity, target, edge, graph) {
50823       var testGraph = graph.update();
50824       if (edge) {
50825         var midpoint = osmNode();
50826         var action = actionAddMidpoint({
50827           loc: edge.loc,
50828           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
50829         }, midpoint);
50830         testGraph = action(testGraph);
50831         target = midpoint;
50832       }
50833       var ids = [entity.id, target.id];
50834       return actionConnect(ids).disabled(testGraph);
50835     }
50836     function hasInvalidGeometry(entity, graph) {
50837       var parents = graph.parentWays(entity);
50838       var i3, j3, k3;
50839       for (i3 = 0; i3 < parents.length; i3++) {
50840         var parent2 = parents[i3];
50841         var nodes = [];
50842         var activeIndex = null;
50843         var relations = graph.parentRelations(parent2);
50844         for (j3 = 0; j3 < relations.length; j3++) {
50845           if (!relations[j3].isMultipolygon()) continue;
50846           var rings = osmJoinWays(relations[j3].members, graph);
50847           for (k3 = 0; k3 < rings.length; k3++) {
50848             nodes = rings[k3].nodes;
50849             if (nodes.find(function(n3) {
50850               return n3.id === entity.id;
50851             })) {
50852               activeIndex = k3;
50853               if (geoHasSelfIntersections(nodes, entity.id)) {
50854                 return "multipolygonMember";
50855               }
50856             }
50857             rings[k3].coords = nodes.map(function(n3) {
50858               return n3.loc;
50859             });
50860           }
50861           for (k3 = 0; k3 < rings.length; k3++) {
50862             if (k3 === activeIndex) continue;
50863             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k3].nodes, entity.id)) {
50864               return "multipolygonRing";
50865             }
50866           }
50867         }
50868         if (activeIndex === null) {
50869           nodes = parent2.nodes.map(function(nodeID) {
50870             return graph.entity(nodeID);
50871           });
50872           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
50873             return parent2.geometry(graph);
50874           }
50875         }
50876       }
50877       return false;
50878     }
50879     function move(d3_event, entity, point) {
50880       if (_isCancelled) return;
50881       d3_event.stopPropagation();
50882       context.surface().classed("nope-disabled", d3_event.altKey);
50883       _lastLoc = context.projection.invert(point);
50884       doMove(d3_event, entity);
50885       var nudge = geoViewportEdge(point, context.map().dimensions());
50886       if (nudge) {
50887         startNudge(d3_event, entity, nudge);
50888       } else {
50889         stopNudge();
50890       }
50891     }
50892     function end(d3_event, entity) {
50893       if (_isCancelled) return;
50894       var wasPoint = entity.geometry(context.graph()) === "point";
50895       var d2 = datum2(d3_event);
50896       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
50897       var target = d2 && d2.properties && d2.properties.entity;
50898       if (nope) {
50899         context.perform(
50900           _actionBounceBack(entity.id, _startLoc)
50901         );
50902       } else if (target && target.type === "way") {
50903         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
50904         context.replace(
50905           actionAddMidpoint({
50906             loc: choice.loc,
50907             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
50908           }, entity),
50909           connectAnnotation(entity, target)
50910         );
50911       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
50912         context.replace(
50913           actionConnect([target.id, entity.id]),
50914           connectAnnotation(entity, target)
50915         );
50916       } else if (_wasMidpoint) {
50917         context.replace(
50918           actionNoop(),
50919           _t("operations.add.annotation.vertex")
50920         );
50921       } else {
50922         context.replace(
50923           actionNoop(),
50924           moveAnnotation(entity)
50925         );
50926       }
50927       if (wasPoint) {
50928         context.enter(modeSelect(context, [entity.id]));
50929       } else {
50930         var reselection = _restoreSelectedIDs.filter(function(id2) {
50931           return context.graph().hasEntity(id2);
50932         });
50933         if (reselection.length) {
50934           context.enter(modeSelect(context, reselection));
50935         } else {
50936           context.enter(modeBrowse(context));
50937         }
50938       }
50939     }
50940     function _actionBounceBack(nodeID, toLoc) {
50941       var moveNode = actionMoveNode(nodeID, toLoc);
50942       var action = function(graph, t2) {
50943         if (t2 === 1) context.pop();
50944         return moveNode(graph, t2);
50945       };
50946       action.transitionable = true;
50947       return action;
50948     }
50949     function cancel() {
50950       drag.cancel();
50951       context.enter(modeBrowse(context));
50952     }
50953     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);
50954     mode.enter = function() {
50955       context.install(hover);
50956       context.install(edit);
50957       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
50958       context.history().on("undone.drag-node", cancel);
50959     };
50960     mode.exit = function() {
50961       context.ui().sidebar.hover.cancel();
50962       context.uninstall(hover);
50963       context.uninstall(edit);
50964       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
50965       context.history().on("undone.drag-node", null);
50966       _activeEntity = null;
50967       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
50968       stopNudge();
50969     };
50970     mode.selectedIDs = function() {
50971       if (!arguments.length) return _activeEntity ? [_activeEntity.id] : [];
50972       return mode;
50973     };
50974     mode.activeID = function() {
50975       if (!arguments.length) return _activeEntity && _activeEntity.id;
50976       return mode;
50977     };
50978     mode.restoreSelectedIDs = function(_3) {
50979       if (!arguments.length) return _restoreSelectedIDs;
50980       _restoreSelectedIDs = _3;
50981       return mode;
50982     };
50983     mode.behavior = drag;
50984     return mode;
50985   }
50986   var init_drag_node = __esm({
50987     "modules/modes/drag_node.js"() {
50988       "use strict";
50989       init_src5();
50990       init_presets();
50991       init_localizer();
50992       init_add_midpoint();
50993       init_connect();
50994       init_move_node();
50995       init_noop2();
50996       init_drag2();
50997       init_edit();
50998       init_hover();
50999       init_geo2();
51000       init_browse();
51001       init_select5();
51002       init_osm();
51003       init_util();
51004     }
51005   });
51006
51007   // modules/modes/drag_note.js
51008   var drag_note_exports = {};
51009   __export(drag_note_exports, {
51010     modeDragNote: () => modeDragNote
51011   });
51012   function modeDragNote(context) {
51013     var mode = {
51014       id: "drag-note",
51015       button: "browse"
51016     };
51017     var edit = behaviorEdit(context);
51018     var _nudgeInterval;
51019     var _lastLoc;
51020     var _note;
51021     function startNudge(d3_event, nudge) {
51022       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
51023       _nudgeInterval = window.setInterval(function() {
51024         context.map().pan(nudge);
51025         doMove(d3_event, nudge);
51026       }, 50);
51027     }
51028     function stopNudge() {
51029       if (_nudgeInterval) {
51030         window.clearInterval(_nudgeInterval);
51031         _nudgeInterval = null;
51032       }
51033     }
51034     function origin(note) {
51035       return context.projection(note.loc);
51036     }
51037     function start2(d3_event, note) {
51038       _note = note;
51039       var osm = services.osm;
51040       if (osm) {
51041         _note = osm.getNote(_note.id);
51042       }
51043       context.surface().selectAll(".note-" + _note.id).classed("active", true);
51044       context.perform(actionNoop());
51045       context.enter(mode);
51046       context.selectedNoteID(_note.id);
51047     }
51048     function move(d3_event, entity, point) {
51049       d3_event.stopPropagation();
51050       _lastLoc = context.projection.invert(point);
51051       doMove(d3_event);
51052       var nudge = geoViewportEdge(point, context.map().dimensions());
51053       if (nudge) {
51054         startNudge(d3_event, nudge);
51055       } else {
51056         stopNudge();
51057       }
51058     }
51059     function doMove(d3_event, nudge) {
51060       nudge = nudge || [0, 0];
51061       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
51062       var currMouse = geoVecSubtract(currPoint, nudge);
51063       var loc = context.projection.invert(currMouse);
51064       _note = _note.move(loc);
51065       var osm = services.osm;
51066       if (osm) {
51067         osm.replaceNote(_note);
51068       }
51069       context.replace(actionNoop());
51070     }
51071     function end() {
51072       context.replace(actionNoop());
51073       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
51074     }
51075     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);
51076     mode.enter = function() {
51077       context.install(edit);
51078     };
51079     mode.exit = function() {
51080       context.ui().sidebar.hover.cancel();
51081       context.uninstall(edit);
51082       context.surface().selectAll(".active").classed("active", false);
51083       stopNudge();
51084     };
51085     mode.behavior = drag;
51086     return mode;
51087   }
51088   var init_drag_note = __esm({
51089     "modules/modes/drag_note.js"() {
51090       "use strict";
51091       init_services();
51092       init_noop2();
51093       init_drag2();
51094       init_edit();
51095       init_geo2();
51096       init_select_note();
51097     }
51098   });
51099
51100   // modules/ui/data_header.js
51101   var data_header_exports = {};
51102   __export(data_header_exports, {
51103     uiDataHeader: () => uiDataHeader
51104   });
51105   function uiDataHeader() {
51106     var _datum;
51107     function dataHeader(selection2) {
51108       var header = selection2.selectAll(".data-header").data(
51109         _datum ? [_datum] : [],
51110         function(d2) {
51111           return d2.__featurehash__;
51112         }
51113       );
51114       header.exit().remove();
51115       var headerEnter = header.enter().append("div").attr("class", "data-header");
51116       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
51117       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
51118       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
51119     }
51120     dataHeader.datum = function(val) {
51121       if (!arguments.length) return _datum;
51122       _datum = val;
51123       return this;
51124     };
51125     return dataHeader;
51126   }
51127   var init_data_header = __esm({
51128     "modules/ui/data_header.js"() {
51129       "use strict";
51130       init_localizer();
51131       init_icon();
51132     }
51133   });
51134
51135   // modules/ui/combobox.js
51136   var combobox_exports = {};
51137   __export(combobox_exports, {
51138     uiCombobox: () => uiCombobox
51139   });
51140   function uiCombobox(context, klass) {
51141     var dispatch14 = dispatch_default("accept", "cancel", "update");
51142     var container = context.container();
51143     var _suggestions = [];
51144     var _data = [];
51145     var _fetched = {};
51146     var _selected = null;
51147     var _canAutocomplete = true;
51148     var _caseSensitive = false;
51149     var _cancelFetch = false;
51150     var _minItems = 2;
51151     var _tDown = 0;
51152     var _mouseEnterHandler, _mouseLeaveHandler;
51153     var _fetcher = function(val, cb) {
51154       cb(_data.filter(function(d2) {
51155         var terms = d2.terms || [];
51156         terms.push(d2.value);
51157         if (d2.key) {
51158           terms.push(d2.key);
51159         }
51160         return terms.some(function(term) {
51161           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
51162         });
51163       }));
51164     };
51165     var combobox = function(input, attachTo) {
51166       if (!input || input.empty()) return;
51167       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() {
51168         var parent2 = this.parentNode;
51169         var sibling = this.nextSibling;
51170         select_default2(parent2).selectAll(".combobox-caret").filter(function(d2) {
51171           return d2 === input.node();
51172         }).data([input.node()]).enter().insert("div", function() {
51173           return sibling;
51174         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
51175           d3_event.preventDefault();
51176           input.node().focus();
51177           mousedown(d3_event);
51178         }).on("mouseup.combo-caret", function(d3_event) {
51179           d3_event.preventDefault();
51180           mouseup(d3_event);
51181         });
51182       });
51183       function mousedown(d3_event) {
51184         if (d3_event.button !== 0) return;
51185         if (input.classed("disabled")) return;
51186         _tDown = +/* @__PURE__ */ new Date();
51187         var start2 = input.property("selectionStart");
51188         var end = input.property("selectionEnd");
51189         if (start2 !== end) {
51190           var val = utilGetSetValue(input);
51191           input.node().setSelectionRange(val.length, val.length);
51192           return;
51193         }
51194         input.on("mouseup.combo-input", mouseup);
51195       }
51196       function mouseup(d3_event) {
51197         input.on("mouseup.combo-input", null);
51198         if (d3_event.button !== 0) return;
51199         if (input.classed("disabled")) return;
51200         if (input.node() !== document.activeElement) return;
51201         var start2 = input.property("selectionStart");
51202         var end = input.property("selectionEnd");
51203         if (start2 !== end) return;
51204         var combo = container.selectAll(".combobox");
51205         if (combo.empty() || combo.datum() !== input.node()) {
51206           var tOrig = _tDown;
51207           window.setTimeout(function() {
51208             if (tOrig !== _tDown) return;
51209             fetchComboData("", function() {
51210               show();
51211               render();
51212             });
51213           }, 250);
51214         } else {
51215           hide();
51216         }
51217       }
51218       function focus() {
51219         fetchComboData("");
51220       }
51221       function blur() {
51222         _comboHideTimerID = window.setTimeout(hide, 75);
51223       }
51224       function show() {
51225         hide();
51226         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) {
51227           d3_event.preventDefault();
51228         });
51229         container.on("scroll.combo-scroll", render, true);
51230       }
51231       function hide() {
51232         _hide(container);
51233       }
51234       function keydown(d3_event) {
51235         var shown = !container.selectAll(".combobox").empty();
51236         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
51237         switch (d3_event.keyCode) {
51238           case 8:
51239           // ⌫ Backspace
51240           case 46:
51241             d3_event.stopPropagation();
51242             _selected = null;
51243             render();
51244             input.on("input.combo-input", function() {
51245               var start2 = input.property("selectionStart");
51246               input.node().setSelectionRange(start2, start2);
51247               input.on("input.combo-input", change);
51248               change(false);
51249             });
51250             break;
51251           case 9:
51252             accept(d3_event);
51253             break;
51254           case 13:
51255             d3_event.preventDefault();
51256             d3_event.stopPropagation();
51257             accept(d3_event);
51258             break;
51259           case 38:
51260             if (tagName === "textarea" && !shown) return;
51261             d3_event.preventDefault();
51262             if (tagName === "input" && !shown) {
51263               show();
51264             }
51265             nav(-1);
51266             break;
51267           case 40:
51268             if (tagName === "textarea" && !shown) return;
51269             d3_event.preventDefault();
51270             if (tagName === "input" && !shown) {
51271               show();
51272             }
51273             nav(1);
51274             break;
51275         }
51276       }
51277       function keyup(d3_event) {
51278         switch (d3_event.keyCode) {
51279           case 27:
51280             cancel();
51281             break;
51282         }
51283       }
51284       function change(doAutoComplete) {
51285         if (doAutoComplete === void 0) doAutoComplete = true;
51286         fetchComboData(value(), function(skipAutosuggest) {
51287           _selected = null;
51288           var val = input.property("value");
51289           if (_suggestions.length) {
51290             if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
51291               _selected = tryAutocomplete();
51292             }
51293             if (!_selected) {
51294               _selected = val;
51295             }
51296           }
51297           if (val.length) {
51298             var combo = container.selectAll(".combobox");
51299             if (combo.empty()) {
51300               show();
51301             }
51302           } else {
51303             hide();
51304           }
51305           render();
51306         });
51307       }
51308       function nav(dir) {
51309         if (_suggestions.length) {
51310           var index = -1;
51311           for (var i3 = 0; i3 < _suggestions.length; i3++) {
51312             if (_selected && _suggestions[i3].value === _selected) {
51313               index = i3;
51314               break;
51315             }
51316           }
51317           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
51318           _selected = _suggestions[index].value;
51319           utilGetSetValue(input, _selected);
51320           dispatch14.call("update");
51321         }
51322         render();
51323         ensureVisible();
51324       }
51325       function ensureVisible() {
51326         var _a4;
51327         var combo = container.selectAll(".combobox");
51328         if (combo.empty()) return;
51329         var containerRect = container.node().getBoundingClientRect();
51330         var comboRect = combo.node().getBoundingClientRect();
51331         if (comboRect.bottom > containerRect.bottom) {
51332           var node = attachTo ? attachTo.node() : input.node();
51333           node.scrollIntoView({ behavior: "instant", block: "center" });
51334           render();
51335         }
51336         var selected = combo.selectAll(".combobox-option.selected").node();
51337         if (selected) {
51338           (_a4 = selected.scrollIntoView) == null ? void 0 : _a4.call(selected, { behavior: "smooth", block: "nearest" });
51339         }
51340       }
51341       function value() {
51342         var value2 = input.property("value");
51343         var start2 = input.property("selectionStart");
51344         var end = input.property("selectionEnd");
51345         if (start2 && end) {
51346           value2 = value2.substring(0, start2);
51347         }
51348         return value2;
51349       }
51350       function fetchComboData(v3, cb) {
51351         _cancelFetch = false;
51352         _fetcher.call(input, v3, function(results, skipAutosuggest) {
51353           if (_cancelFetch) return;
51354           _suggestions = results;
51355           results.forEach(function(d2) {
51356             _fetched[d2.value] = d2;
51357           });
51358           if (cb) {
51359             cb(skipAutosuggest);
51360           }
51361         });
51362       }
51363       function tryAutocomplete() {
51364         if (!_canAutocomplete) return;
51365         var val = _caseSensitive ? value() : value().toLowerCase();
51366         if (!val) return;
51367         if (isFinite(val)) return;
51368         const suggestionValues = [];
51369         _suggestions.forEach((s2) => {
51370           suggestionValues.push(s2.value);
51371           if (s2.key && s2.key !== s2.value) {
51372             suggestionValues.push(s2.key);
51373           }
51374         });
51375         var bestIndex = -1;
51376         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
51377           var suggestion = suggestionValues[i3];
51378           var compare2 = _caseSensitive ? suggestion : suggestion.toLowerCase();
51379           if (compare2 === val) {
51380             bestIndex = i3;
51381             break;
51382           } else if (bestIndex === -1 && compare2.indexOf(val) === 0) {
51383             bestIndex = i3;
51384           }
51385         }
51386         if (bestIndex !== -1) {
51387           var bestVal = suggestionValues[bestIndex];
51388           input.property("value", bestVal);
51389           input.node().setSelectionRange(val.length, bestVal.length);
51390           dispatch14.call("update");
51391           return bestVal;
51392         }
51393       }
51394       function render() {
51395         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
51396           hide();
51397           return;
51398         }
51399         var shown = !container.selectAll(".combobox").empty();
51400         if (!shown) return;
51401         var combo = container.selectAll(".combobox");
51402         var options = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
51403           return d2.value;
51404         });
51405         options.exit().remove();
51406         options.enter().append("a").attr("class", function(d2) {
51407           return "combobox-option " + (d2.klass || "");
51408         }).attr("title", function(d2) {
51409           return d2.title;
51410         }).each(function(d2) {
51411           if (d2.display) {
51412             d2.display(select_default2(this));
51413           } else {
51414             select_default2(this).text(d2.value);
51415           }
51416         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options).classed("selected", function(d2) {
51417           return d2.value === _selected || d2.key === _selected;
51418         }).on("click.combo-option", accept).order();
51419         var node = attachTo ? attachTo.node() : input.node();
51420         var containerRect = container.node().getBoundingClientRect();
51421         var rect = node.getBoundingClientRect();
51422         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
51423       }
51424       function accept(d3_event, d2) {
51425         _cancelFetch = true;
51426         var thiz = input.node();
51427         if (d2) {
51428           utilGetSetValue(input, d2.value);
51429           utilTriggerEvent(input, "change");
51430         }
51431         var val = utilGetSetValue(input);
51432         thiz.setSelectionRange(val.length, val.length);
51433         if (!d2) {
51434           d2 = _fetched[val];
51435         }
51436         dispatch14.call("accept", thiz, d2, val);
51437         hide();
51438       }
51439       function cancel() {
51440         _cancelFetch = true;
51441         var thiz = input.node();
51442         var val = utilGetSetValue(input);
51443         var start2 = input.property("selectionStart");
51444         var end = input.property("selectionEnd");
51445         val = val.slice(0, start2) + val.slice(end);
51446         utilGetSetValue(input, val);
51447         thiz.setSelectionRange(val.length, val.length);
51448         dispatch14.call("cancel", thiz);
51449         hide();
51450       }
51451     };
51452     combobox.canAutocomplete = function(val) {
51453       if (!arguments.length) return _canAutocomplete;
51454       _canAutocomplete = val;
51455       return combobox;
51456     };
51457     combobox.caseSensitive = function(val) {
51458       if (!arguments.length) return _caseSensitive;
51459       _caseSensitive = val;
51460       return combobox;
51461     };
51462     combobox.data = function(val) {
51463       if (!arguments.length) return _data;
51464       _data = val;
51465       return combobox;
51466     };
51467     combobox.fetcher = function(val) {
51468       if (!arguments.length) return _fetcher;
51469       _fetcher = val;
51470       return combobox;
51471     };
51472     combobox.minItems = function(val) {
51473       if (!arguments.length) return _minItems;
51474       _minItems = val;
51475       return combobox;
51476     };
51477     combobox.itemsMouseEnter = function(val) {
51478       if (!arguments.length) return _mouseEnterHandler;
51479       _mouseEnterHandler = val;
51480       return combobox;
51481     };
51482     combobox.itemsMouseLeave = function(val) {
51483       if (!arguments.length) return _mouseLeaveHandler;
51484       _mouseLeaveHandler = val;
51485       return combobox;
51486     };
51487     return utilRebind(combobox, dispatch14, "on");
51488   }
51489   function _hide(container) {
51490     if (_comboHideTimerID) {
51491       window.clearTimeout(_comboHideTimerID);
51492       _comboHideTimerID = void 0;
51493     }
51494     container.selectAll(".combobox").remove();
51495     container.on("scroll.combo-scroll", null);
51496   }
51497   var _comboHideTimerID;
51498   var init_combobox = __esm({
51499     "modules/ui/combobox.js"() {
51500       "use strict";
51501       init_src4();
51502       init_src5();
51503       init_util();
51504       uiCombobox.off = function(input, context) {
51505         _hide(context.container());
51506         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);
51507         context.container().on("scroll.combo-scroll", null);
51508       };
51509     }
51510   });
51511
51512   // modules/ui/toggle.js
51513   var toggle_exports = {};
51514   __export(toggle_exports, {
51515     uiToggle: () => uiToggle
51516   });
51517   function uiToggle(show, callback) {
51518     return function(selection2) {
51519       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
51520         select_default2(this).classed("hide", !show).style("opacity", null);
51521         if (callback) callback.apply(this);
51522       });
51523     };
51524   }
51525   var init_toggle = __esm({
51526     "modules/ui/toggle.js"() {
51527       "use strict";
51528       init_src5();
51529     }
51530   });
51531
51532   // modules/ui/disclosure.js
51533   var disclosure_exports = {};
51534   __export(disclosure_exports, {
51535     uiDisclosure: () => uiDisclosure
51536   });
51537   function uiDisclosure(context, key, expandedDefault) {
51538     var dispatch14 = dispatch_default("toggled");
51539     var _expanded;
51540     var _label = utilFunctor("");
51541     var _updatePreference = true;
51542     var _content = function() {
51543     };
51544     var disclosure = function(selection2) {
51545       if (_expanded === void 0 || _expanded === null) {
51546         var preference = corePreferences("disclosure." + key + ".expanded");
51547         _expanded = preference === null ? !!expandedDefault : preference === "true";
51548       }
51549       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
51550       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"));
51551       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
51552       hideToggle = hideToggleEnter.merge(hideToggle);
51553       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
51554       const label = _label();
51555       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
51556       if (typeof label !== "function") {
51557         labelSelection.text(_label());
51558       } else {
51559         labelSelection.text("").call(label);
51560       }
51561       hideToggle.selectAll(".hide-toggle-icon").attr(
51562         "xlink:href",
51563         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
51564       );
51565       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
51566       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
51567       if (_expanded) {
51568         wrap2.call(_content);
51569       }
51570       function toggle(d3_event) {
51571         d3_event.preventDefault();
51572         _expanded = !_expanded;
51573         if (_updatePreference) {
51574           corePreferences("disclosure." + key + ".expanded", _expanded);
51575         }
51576         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
51577         hideToggle.selectAll(".hide-toggle-icon").attr(
51578           "xlink:href",
51579           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
51580         );
51581         wrap2.call(uiToggle(_expanded));
51582         if (_expanded) {
51583           wrap2.call(_content);
51584         }
51585         dispatch14.call("toggled", this, _expanded);
51586       }
51587     };
51588     disclosure.label = function(val) {
51589       if (!arguments.length) return _label;
51590       _label = utilFunctor(val);
51591       return disclosure;
51592     };
51593     disclosure.expanded = function(val) {
51594       if (!arguments.length) return _expanded;
51595       _expanded = val;
51596       return disclosure;
51597     };
51598     disclosure.updatePreference = function(val) {
51599       if (!arguments.length) return _updatePreference;
51600       _updatePreference = val;
51601       return disclosure;
51602     };
51603     disclosure.content = function(val) {
51604       if (!arguments.length) return _content;
51605       _content = val;
51606       return disclosure;
51607     };
51608     return utilRebind(disclosure, dispatch14, "on");
51609   }
51610   var init_disclosure = __esm({
51611     "modules/ui/disclosure.js"() {
51612       "use strict";
51613       init_src4();
51614       init_preferences();
51615       init_icon();
51616       init_util();
51617       init_rebind();
51618       init_toggle();
51619       init_localizer();
51620     }
51621   });
51622
51623   // modules/ui/section.js
51624   var section_exports = {};
51625   __export(section_exports, {
51626     uiSection: () => uiSection
51627   });
51628   function uiSection(id2, context) {
51629     var _classes = utilFunctor("");
51630     var _shouldDisplay;
51631     var _content;
51632     var _disclosure;
51633     var _label;
51634     var _expandedByDefault = utilFunctor(true);
51635     var _disclosureContent;
51636     var _disclosureExpanded;
51637     var _containerSelection = select_default2(null);
51638     var section = {
51639       id: id2
51640     };
51641     section.classes = function(val) {
51642       if (!arguments.length) return _classes;
51643       _classes = utilFunctor(val);
51644       return section;
51645     };
51646     section.label = function(val) {
51647       if (!arguments.length) return _label;
51648       _label = utilFunctor(val);
51649       return section;
51650     };
51651     section.expandedByDefault = function(val) {
51652       if (!arguments.length) return _expandedByDefault;
51653       _expandedByDefault = utilFunctor(val);
51654       return section;
51655     };
51656     section.shouldDisplay = function(val) {
51657       if (!arguments.length) return _shouldDisplay;
51658       _shouldDisplay = utilFunctor(val);
51659       return section;
51660     };
51661     section.content = function(val) {
51662       if (!arguments.length) return _content;
51663       _content = val;
51664       return section;
51665     };
51666     section.disclosureContent = function(val) {
51667       if (!arguments.length) return _disclosureContent;
51668       _disclosureContent = val;
51669       return section;
51670     };
51671     section.disclosureExpanded = function(val) {
51672       if (!arguments.length) return _disclosureExpanded;
51673       _disclosureExpanded = val;
51674       return section;
51675     };
51676     section.render = function(selection2) {
51677       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
51678       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
51679       _containerSelection = sectionEnter.merge(_containerSelection);
51680       _containerSelection.call(renderContent);
51681     };
51682     section.reRender = function() {
51683       _containerSelection.call(renderContent);
51684     };
51685     section.selection = function() {
51686       return _containerSelection;
51687     };
51688     section.disclosure = function() {
51689       return _disclosure;
51690     };
51691     function renderContent(selection2) {
51692       if (_shouldDisplay) {
51693         var shouldDisplay = _shouldDisplay();
51694         selection2.classed("hide", !shouldDisplay);
51695         if (!shouldDisplay) {
51696           selection2.html("");
51697           return;
51698         }
51699       }
51700       if (_disclosureContent) {
51701         if (!_disclosure) {
51702           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
51703         }
51704         if (_disclosureExpanded !== void 0) {
51705           _disclosure.expanded(_disclosureExpanded);
51706           _disclosureExpanded = void 0;
51707         }
51708         selection2.call(_disclosure);
51709         return;
51710       }
51711       if (_content) {
51712         selection2.call(_content);
51713       }
51714     }
51715     return section;
51716   }
51717   var init_section = __esm({
51718     "modules/ui/section.js"() {
51719       "use strict";
51720       init_src5();
51721       init_disclosure();
51722       init_util();
51723     }
51724   });
51725
51726   // modules/ui/tag_reference.js
51727   var tag_reference_exports = {};
51728   __export(tag_reference_exports, {
51729     uiTagReference: () => uiTagReference
51730   });
51731   function uiTagReference(what) {
51732     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
51733     var tagReference = {};
51734     var _button = select_default2(null);
51735     var _body = select_default2(null);
51736     var _loaded;
51737     var _showing;
51738     function load() {
51739       if (!wikibase) return;
51740       _button.classed("tag-reference-loading", true);
51741       wikibase.getDocs(what, gotDocs);
51742     }
51743     function gotDocs(err, docs) {
51744       _body.html("");
51745       if (!docs || !docs.title) {
51746         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
51747         done();
51748         return;
51749       }
51750       if (docs.imageURL) {
51751         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.title).attr("src", docs.imageURL).on("load", function() {
51752           done();
51753         }).on("error", function() {
51754           select_default2(this).remove();
51755           done();
51756         });
51757       } else {
51758         done();
51759       }
51760       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
51761       if (docs.description) {
51762         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").call(docs.description);
51763       } else {
51764         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
51765       }
51766       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"));
51767       if (docs.wiki) {
51768         _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));
51769       }
51770       if (what.key === "comment") {
51771         _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"));
51772       }
51773     }
51774     function done() {
51775       _loaded = true;
51776       _button.classed("tag-reference-loading", false);
51777       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
51778       _showing = true;
51779       _button.selectAll("svg.icon use").each(function() {
51780         var iconUse = select_default2(this);
51781         if (iconUse.attr("href") === "#iD-icon-info") {
51782           iconUse.attr("href", "#iD-icon-info-filled");
51783         }
51784       });
51785     }
51786     function hide() {
51787       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
51788         _body.classed("expanded", false);
51789       });
51790       _showing = false;
51791       _button.selectAll("svg.icon use").each(function() {
51792         var iconUse = select_default2(this);
51793         if (iconUse.attr("href") === "#iD-icon-info-filled") {
51794           iconUse.attr("href", "#iD-icon-info");
51795         }
51796       });
51797     }
51798     tagReference.button = function(selection2, klass, iconName) {
51799       _button = selection2.selectAll(".tag-reference-button").data([0]);
51800       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
51801       _button.on("click", function(d3_event) {
51802         d3_event.stopPropagation();
51803         d3_event.preventDefault();
51804         this.blur();
51805         if (_showing) {
51806           hide();
51807         } else if (_loaded) {
51808           done();
51809         } else {
51810           load();
51811         }
51812       });
51813     };
51814     tagReference.body = function(selection2) {
51815       var itemID = what.qid || what.key + "-" + (what.value || "");
51816       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
51817         return d2;
51818       });
51819       _body.exit().remove();
51820       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
51821       if (_showing === false) {
51822         hide();
51823       }
51824     };
51825     tagReference.showing = function(val) {
51826       if (!arguments.length) return _showing;
51827       _showing = val;
51828       return tagReference;
51829     };
51830     return tagReference;
51831   }
51832   var init_tag_reference = __esm({
51833     "modules/ui/tag_reference.js"() {
51834       "use strict";
51835       init_src5();
51836       init_localizer();
51837       init_services();
51838       init_icon();
51839     }
51840   });
51841
51842   // modules/ui/sections/raw_tag_editor.js
51843   var raw_tag_editor_exports = {};
51844   __export(raw_tag_editor_exports, {
51845     uiSectionRawTagEditor: () => uiSectionRawTagEditor
51846   });
51847   function uiSectionRawTagEditor(id2, context) {
51848     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
51849       var count = Object.keys(_tags).filter(function(d2) {
51850         return d2;
51851       }).length;
51852       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
51853     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
51854     var taginfo = services.taginfo;
51855     var dispatch14 = dispatch_default("change");
51856     var availableViews = [
51857       { id: "list", icon: "#fas-th-list" },
51858       { id: "text", icon: "#fas-i-cursor" }
51859     ];
51860     let _discardTags = {};
51861     _mainFileFetcher.get("discarded").then((d2) => {
51862       _discardTags = d2;
51863     }).catch(() => {
51864     });
51865     var _tagView = corePreferences("raw-tag-editor-view") || "list";
51866     var _readOnlyTags = [];
51867     var _orderedKeys = [];
51868     var _pendingChange = null;
51869     var _state;
51870     var _presets;
51871     var _tags;
51872     var _entityIDs;
51873     var _didInteract = false;
51874     function interacted() {
51875       _didInteract = true;
51876     }
51877     function renderDisclosureContent(wrap2) {
51878       _orderedKeys = _orderedKeys.filter(function(key) {
51879         return _tags[key] !== void 0;
51880       });
51881       var all = Object.keys(_tags).sort();
51882       var missingKeys = utilArrayDifference(all, _orderedKeys);
51883       for (var i3 in missingKeys) {
51884         _orderedKeys.push(missingKeys[i3]);
51885       }
51886       var rowData = _orderedKeys.map(function(key, i4) {
51887         return { index: i4, key, value: _tags[key] };
51888       });
51889       rowData.push({ index: rowData.length, key: "", value: "" });
51890       var options = wrap2.selectAll(".raw-tag-options").data([0]);
51891       options.exit().remove();
51892       var optionsEnter = options.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
51893       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
51894         return d2.id;
51895       }).enter();
51896       optionEnter.append("button").attr("class", function(d2) {
51897         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
51898       }).attr("aria-selected", function(d2) {
51899         return _tagView === d2.id;
51900       }).attr("role", "tab").attr("title", function(d2) {
51901         return _t("icons." + d2.id);
51902       }).on("click", function(d3_event, d2) {
51903         _tagView = d2.id;
51904         corePreferences("raw-tag-editor-view", d2.id);
51905         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
51906           return datum2 === d2;
51907         }).attr("aria-selected", function(datum2) {
51908           return datum2 === d2;
51909         });
51910         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
51911         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
51912       }).each(function(d2) {
51913         select_default2(this).call(svgIcon(d2.icon));
51914       });
51915       var textData = rowsToText(rowData);
51916       var textarea = wrap2.selectAll(".tag-text").data([0]);
51917       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);
51918       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
51919       var list = wrap2.selectAll(".tag-list").data([0]);
51920       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
51921       var items = list.selectAll(".tag-row").data(rowData, function(d2) {
51922         return d2.key;
51923       });
51924       items.exit().each(unbind).remove();
51925       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
51926       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
51927       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);
51928       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);
51929       innerWrap.append("button").attr("tabindex", -1).attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
51930       items = items.merge(itemsEnter).sort(function(a4, b3) {
51931         return a4.index - b3.index;
51932       });
51933       items.classed("add-tag", (d2) => d2.key === "").each(function(d2) {
51934         var row = select_default2(this);
51935         var key = row.select("input.key");
51936         var value = row.select("input.value");
51937         if (_entityIDs && taginfo && _state !== "hover") {
51938           bindTypeahead(key, value);
51939         }
51940         var referenceOptions = { key: d2.key };
51941         if (typeof d2.value === "string") {
51942           referenceOptions.value = d2.value;
51943         }
51944         var reference = uiTagReference(referenceOptions, context);
51945         if (_state === "hover") {
51946           reference.showing(false);
51947         }
51948         row.select(".inner-wrap").call(reference.button).select(".tag-reference-button").attr("tabindex", -1).classed("disabled", (d4) => d4.key === "");
51949         row.call(reference.body);
51950         row.select("button.remove");
51951       });
51952       items.selectAll("input.key").attr("title", function(d2) {
51953         return d2.key;
51954       }).attr("readonly", function(d2) {
51955         return isReadOnly(d2) || null;
51956       }).call(
51957         utilGetSetValue,
51958         (d2) => d2.key,
51959         (_3, newKey) => _pendingChange === null || isEmpty_default(_pendingChange) || _pendingChange[newKey]
51960         // if there are pending changes: skip untouched keys
51961       );
51962       items.selectAll("input.value").attr("title", function(d2) {
51963         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
51964       }).classed("mixed", function(d2) {
51965         return Array.isArray(d2.value);
51966       }).attr("placeholder", function(d2) {
51967         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
51968       }).attr("readonly", function(d2) {
51969         return isReadOnly(d2) || null;
51970       }).call(
51971         utilGetSetValue,
51972         (d2) => {
51973           if (_pendingChange !== null && !isEmpty_default(_pendingChange) && !_pendingChange[d2.value]) {
51974             return null;
51975           }
51976           return typeof d2.value === "string" ? d2.value : "";
51977         },
51978         (_3, newValue) => newValue !== null
51979       );
51980       items.selectAll("button.remove").classed("disabled", (d2) => d2.key === "").on(
51981         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
51982         // 'click' fires too late - #5878
51983         (d3_event, d2) => {
51984           if (d3_event.button !== 0) return;
51985           removeTag(d3_event, d2);
51986         }
51987       );
51988     }
51989     function isReadOnly(d2) {
51990       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
51991         if (d2.key.match(_readOnlyTags[i3]) !== null) {
51992           return true;
51993         }
51994       }
51995       return false;
51996     }
51997     function setTextareaHeight() {
51998       if (_tagView !== "text") return;
51999       var selection2 = select_default2(this);
52000       var matches = selection2.node().value.match(/\n/g);
52001       var lineCount = 2 + Number(matches && matches.length);
52002       var lineHeight = 20;
52003       selection2.style("height", lineCount * lineHeight + "px");
52004     }
52005     function stringify3(s2) {
52006       const stringified = JSON.stringify(s2).slice(1, -1);
52007       if (stringified !== s2) {
52008         return `"${stringified}"`;
52009       } else {
52010         return s2;
52011       }
52012     }
52013     function unstringify(s2) {
52014       const isQuoted = s2.length > 1 && s2.charAt(0) === '"' && s2.charAt(s2.length - 1) === '"';
52015       if (isQuoted) {
52016         try {
52017           return JSON.parse(s2);
52018         } catch {
52019           return s2;
52020         }
52021       } else {
52022         return s2;
52023       }
52024     }
52025     function rowsToText(rows) {
52026       var str = rows.filter(function(row) {
52027         return row.key && row.key.trim() !== "";
52028       }).map(function(row) {
52029         var rawVal = row.value;
52030         if (typeof rawVal !== "string") rawVal = "*";
52031         var val = rawVal ? stringify3(rawVal) : "";
52032         return stringify3(row.key) + "=" + val;
52033       }).join("\n");
52034       if (_state !== "hover" && str.length) {
52035         return str + "\n";
52036       }
52037       return str;
52038     }
52039     function textChanged() {
52040       var newText = this.value.trim();
52041       var newTags = {};
52042       newText.split("\n").forEach(function(row) {
52043         var m3 = row.match(/^\s*([^=]+)=(.*)$/);
52044         if (m3 !== null) {
52045           var k3 = context.cleanTagKey(unstringify(m3[1].trim()));
52046           var v3 = context.cleanTagValue(unstringify(m3[2].trim()));
52047           newTags[k3] = v3;
52048         }
52049       });
52050       var tagDiff = utilTagDiff(_tags, newTags);
52051       _pendingChange = _pendingChange || {};
52052       tagDiff.forEach(function(change) {
52053         if (isReadOnly({ key: change.key })) return;
52054         if (change.newVal === "*" && typeof change.oldVal !== "string") return;
52055         if (change.type === "-") {
52056           _pendingChange[change.key] = void 0;
52057         } else if (change.type === "+") {
52058           _pendingChange[change.key] = change.newVal || "";
52059         }
52060       });
52061       if (isEmpty_default(_pendingChange)) {
52062         _pendingChange = null;
52063         section.reRender();
52064         return;
52065       }
52066       scheduleChange();
52067     }
52068     function bindTypeahead(key, value) {
52069       if (isReadOnly(key.datum())) return;
52070       if (Array.isArray(value.datum().value)) {
52071         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
52072           var keyString = utilGetSetValue(key);
52073           if (!_tags[keyString]) return;
52074           var data = _tags[keyString].map(function(tagValue) {
52075             if (!tagValue) {
52076               return {
52077                 value: " ",
52078                 title: _t("inspector.empty"),
52079                 display: (selection2) => selection2.text("").classed("virtual-option", true).call(_t.append("inspector.empty"))
52080               };
52081             }
52082             return {
52083               value: tagValue,
52084               title: tagValue
52085             };
52086           });
52087           callback(data);
52088         }));
52089         return;
52090       }
52091       var geometry = context.graph().geometry(_entityIDs[0]);
52092       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
52093         taginfo.keys({
52094           debounce: true,
52095           geometry,
52096           query: value2
52097         }, function(err, data) {
52098           if (!err) {
52099             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()));
52100             callback(sort(value2, filtered));
52101           }
52102         });
52103       }));
52104       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
52105         taginfo.values({
52106           debounce: true,
52107           key: utilGetSetValue(key),
52108           geometry,
52109           query: value2
52110         }, function(err, data) {
52111           if (!err) {
52112             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
52113             callback(sort(value2, filtered));
52114           }
52115         });
52116       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
52117       function sort(value2, data) {
52118         var sameletter = [];
52119         var other = [];
52120         for (var i3 = 0; i3 < data.length; i3++) {
52121           if (data[i3].value.substring(0, value2.length) === value2) {
52122             sameletter.push(data[i3]);
52123           } else {
52124             other.push(data[i3]);
52125           }
52126         }
52127         return sameletter.concat(other);
52128       }
52129     }
52130     function unbind() {
52131       var row = select_default2(this);
52132       row.selectAll("input.key").call(uiCombobox.off, context);
52133       row.selectAll("input.value").call(uiCombobox.off, context);
52134     }
52135     function keyChange(d3_event, d2) {
52136       if (select_default2(this).attr("readonly")) return;
52137       var kOld = d2.key;
52138       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0) return;
52139       var kNew = context.cleanTagKey(this.value.trim());
52140       if (isReadOnly({ key: kNew })) {
52141         this.value = kOld;
52142         return;
52143       }
52144       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
52145         this.value = kOld;
52146         section.selection().selectAll(".tag-list input.value").each(function(d4) {
52147           if (d4.key === kNew) {
52148             var input = select_default2(this).node();
52149             input.focus();
52150             input.select();
52151           }
52152         });
52153         return;
52154       }
52155       _pendingChange = _pendingChange || {};
52156       if (kOld) {
52157         if (kOld === kNew) return;
52158         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
52159         _pendingChange[kOld] = void 0;
52160       } else {
52161         let row = this.parentNode.parentNode;
52162         let inputVal = select_default2(row).selectAll("input.value");
52163         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
52164         _pendingChange[kNew] = vNew;
52165         utilGetSetValue(inputVal, vNew);
52166       }
52167       var existingKeyIndex = _orderedKeys.indexOf(kOld);
52168       if (existingKeyIndex !== -1) _orderedKeys[existingKeyIndex] = kNew;
52169       d2.key = kNew;
52170       this.value = kNew;
52171       scheduleChange();
52172     }
52173     function valueChange(d3_event, d2) {
52174       if (isReadOnly(d2)) return;
52175       if (typeof d2.value !== "string" && !this.value) return;
52176       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0) return;
52177       _pendingChange = _pendingChange || {};
52178       _pendingChange[d2.key] = context.cleanTagValue(this.value);
52179       scheduleChange();
52180     }
52181     function removeTag(d3_event, d2) {
52182       if (isReadOnly(d2)) return;
52183       _orderedKeys = _orderedKeys.filter(function(key) {
52184         return key !== d2.key;
52185       });
52186       _pendingChange = _pendingChange || {};
52187       _pendingChange[d2.key] = void 0;
52188       scheduleChange();
52189     }
52190     function scheduleChange() {
52191       if (!_pendingChange) return;
52192       for (const key in _pendingChange) {
52193         _tags[key] = _pendingChange[key];
52194       }
52195       dispatch14.call("change", this, _entityIDs, _pendingChange);
52196       _pendingChange = null;
52197     }
52198     section.state = function(val) {
52199       if (!arguments.length) return _state;
52200       if (_state !== val) {
52201         _orderedKeys = [];
52202         _state = val;
52203       }
52204       return section;
52205     };
52206     section.presets = function(val) {
52207       if (!arguments.length) return _presets;
52208       _presets = val;
52209       if (_presets && _presets.length && _presets[0].isFallback()) {
52210         section.disclosureExpanded(true);
52211       } else if (!_didInteract) {
52212         section.disclosureExpanded(null);
52213       }
52214       return section;
52215     };
52216     section.tags = function(val) {
52217       if (!arguments.length) return _tags;
52218       _tags = val;
52219       return section;
52220     };
52221     section.entityIDs = function(val) {
52222       if (!arguments.length) return _entityIDs;
52223       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
52224         _entityIDs = val;
52225         _orderedKeys = [];
52226       }
52227       return section;
52228     };
52229     section.readOnlyTags = function(val) {
52230       if (!arguments.length) return _readOnlyTags;
52231       _readOnlyTags = val;
52232       return section;
52233     };
52234     return utilRebind(section, dispatch14, "on");
52235   }
52236   var init_raw_tag_editor = __esm({
52237     "modules/ui/sections/raw_tag_editor.js"() {
52238       "use strict";
52239       init_src4();
52240       init_src5();
52241       init_lodash();
52242       init_services();
52243       init_icon();
52244       init_combobox();
52245       init_section();
52246       init_tag_reference();
52247       init_preferences();
52248       init_localizer();
52249       init_array3();
52250       init_util();
52251       init_tags();
52252       init_core();
52253     }
52254   });
52255
52256   // modules/ui/data_editor.js
52257   var data_editor_exports = {};
52258   __export(data_editor_exports, {
52259     uiDataEditor: () => uiDataEditor
52260   });
52261   function uiDataEditor(context) {
52262     var dataHeader = uiDataHeader();
52263     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
52264     var _datum;
52265     function dataEditor(selection2) {
52266       var header = selection2.selectAll(".header").data([0]);
52267       var headerEnter = header.enter().append("div").attr("class", "header fillL");
52268       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
52269         context.enter(modeBrowse(context));
52270       }).call(svgIcon("#iD-icon-close"));
52271       headerEnter.append("h2").call(_t.append("map_data.title"));
52272       var body = selection2.selectAll(".body").data([0]);
52273       body = body.enter().append("div").attr("class", "body").merge(body);
52274       var editor = body.selectAll(".data-editor").data([0]);
52275       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
52276       var rte = body.selectAll(".raw-tag-editor").data([0]);
52277       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
52278         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
52279       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
52280     }
52281     dataEditor.datum = function(val) {
52282       if (!arguments.length) return _datum;
52283       _datum = val;
52284       return this;
52285     };
52286     return dataEditor;
52287   }
52288   var init_data_editor = __esm({
52289     "modules/ui/data_editor.js"() {
52290       "use strict";
52291       init_localizer();
52292       init_browse();
52293       init_icon();
52294       init_data_header();
52295       init_raw_tag_editor();
52296     }
52297   });
52298
52299   // modules/modes/select_data.js
52300   var select_data_exports = {};
52301   __export(select_data_exports, {
52302     modeSelectData: () => modeSelectData
52303   });
52304   function modeSelectData(context, selectedDatum) {
52305     var mode = {
52306       id: "select-data",
52307       button: "browse"
52308     };
52309     var keybinding = utilKeybinding("select-data");
52310     var dataEditor = uiDataEditor(context);
52311     var behaviors = [
52312       behaviorBreathe(context),
52313       behaviorHover(context),
52314       behaviorSelect(context),
52315       behaviorLasso(context),
52316       modeDragNode(context).behavior,
52317       modeDragNote(context).behavior
52318     ];
52319     function selectData(d3_event, drawn) {
52320       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
52321       if (selection2.empty()) {
52322         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
52323         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
52324           context.enter(modeBrowse(context));
52325         }
52326       } else {
52327         selection2.classed("selected", true);
52328       }
52329     }
52330     function esc() {
52331       if (context.container().select(".combobox").size()) return;
52332       context.enter(modeBrowse(context));
52333     }
52334     mode.zoomToSelected = function() {
52335       var extent = geoExtent(bounds_default(selectedDatum));
52336       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
52337     };
52338     mode.enter = function() {
52339       behaviors.forEach(context.install);
52340       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
52341       select_default2(document).call(keybinding);
52342       selectData();
52343       var sidebar = context.ui().sidebar;
52344       sidebar.show(dataEditor.datum(selectedDatum));
52345       var extent = geoExtent(bounds_default(selectedDatum));
52346       sidebar.expand(sidebar.intersects(extent));
52347       context.map().on("drawn.select-data", selectData);
52348     };
52349     mode.exit = function() {
52350       behaviors.forEach(context.uninstall);
52351       select_default2(document).call(keybinding.unbind);
52352       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
52353       context.map().on("drawn.select-data", null);
52354       context.ui().sidebar.hide();
52355     };
52356     return mode;
52357   }
52358   var init_select_data = __esm({
52359     "modules/modes/select_data.js"() {
52360       "use strict";
52361       init_src2();
52362       init_src5();
52363       init_breathe();
52364       init_hover();
52365       init_lasso2();
52366       init_select4();
52367       init_localizer();
52368       init_geo2();
52369       init_browse();
52370       init_drag_node();
52371       init_drag_note();
52372       init_data_editor();
52373       init_util();
52374     }
52375   });
52376
52377   // modules/ui/keepRight_details.js
52378   var keepRight_details_exports = {};
52379   __export(keepRight_details_exports, {
52380     uiKeepRightDetails: () => uiKeepRightDetails
52381   });
52382   function uiKeepRightDetails(context) {
52383     let _qaItem;
52384     function issueDetail(d2) {
52385       const { itemType, parentIssueType } = d2;
52386       const unknown = { html: _t.html("inspector.unknown") };
52387       let replacements = d2.replacements || {};
52388       replacements.default = unknown;
52389       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
52390         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
52391       } else {
52392         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
52393       }
52394     }
52395     function keepRightDetails(selection2) {
52396       const details = selection2.selectAll(".error-details").data(
52397         _qaItem ? [_qaItem] : [],
52398         (d2) => `${d2.id}-${d2.status || 0}`
52399       );
52400       details.exit().remove();
52401       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
52402       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
52403       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
52404       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
52405       let relatedEntities = [];
52406       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
52407         const link2 = select_default2(this);
52408         const isObjectLink = link2.classed("error_object_link");
52409         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
52410         const entity = context.hasEntity(entityID);
52411         relatedEntities.push(entityID);
52412         link2.on("mouseenter", () => {
52413           utilHighlightEntities([entityID], true, context);
52414         }).on("mouseleave", () => {
52415           utilHighlightEntities([entityID], false, context);
52416         }).on("click", (d3_event) => {
52417           d3_event.preventDefault();
52418           utilHighlightEntities([entityID], false, context);
52419           const osmlayer = context.layers().layer("osm");
52420           if (!osmlayer.enabled()) {
52421             osmlayer.enabled(true);
52422           }
52423           context.map().centerZoomEase(_qaItem.loc, 20);
52424           if (entity) {
52425             context.enter(modeSelect(context, [entityID]));
52426           } else {
52427             context.loadEntity(entityID, (err, result) => {
52428               if (err) return;
52429               const entity2 = result.data.find((e3) => e3.id === entityID);
52430               if (entity2) context.enter(modeSelect(context, [entityID]));
52431             });
52432           }
52433         });
52434         if (entity) {
52435           let name = utilDisplayName(entity);
52436           if (!name && !isObjectLink) {
52437             const preset = _mainPresetIndex.match(entity, context.graph());
52438             name = preset && !preset.isFallback() && preset.name();
52439           }
52440           if (name) {
52441             this.innerText = name;
52442           }
52443         }
52444       });
52445       context.features().forceVisible(relatedEntities);
52446       context.map().pan([0, 0]);
52447     }
52448     keepRightDetails.issue = function(val) {
52449       if (!arguments.length) return _qaItem;
52450       _qaItem = val;
52451       return keepRightDetails;
52452     };
52453     return keepRightDetails;
52454   }
52455   var init_keepRight_details = __esm({
52456     "modules/ui/keepRight_details.js"() {
52457       "use strict";
52458       init_src5();
52459       init_presets();
52460       init_select5();
52461       init_localizer();
52462       init_util();
52463     }
52464   });
52465
52466   // modules/ui/keepRight_header.js
52467   var keepRight_header_exports = {};
52468   __export(keepRight_header_exports, {
52469     uiKeepRightHeader: () => uiKeepRightHeader
52470   });
52471   function uiKeepRightHeader() {
52472     let _qaItem;
52473     function issueTitle(d2) {
52474       const { itemType, parentIssueType } = d2;
52475       const unknown = _t.html("inspector.unknown");
52476       let replacements = d2.replacements || {};
52477       replacements.default = { html: unknown };
52478       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
52479         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
52480       } else {
52481         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
52482       }
52483     }
52484     function keepRightHeader(selection2) {
52485       const header = selection2.selectAll(".qa-header").data(
52486         _qaItem ? [_qaItem] : [],
52487         (d2) => `${d2.id}-${d2.status || 0}`
52488       );
52489       header.exit().remove();
52490       const headerEnter = header.enter().append("div").attr("class", "qa-header");
52491       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
52492       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"));
52493       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
52494     }
52495     keepRightHeader.issue = function(val) {
52496       if (!arguments.length) return _qaItem;
52497       _qaItem = val;
52498       return keepRightHeader;
52499     };
52500     return keepRightHeader;
52501   }
52502   var init_keepRight_header = __esm({
52503     "modules/ui/keepRight_header.js"() {
52504       "use strict";
52505       init_icon();
52506       init_localizer();
52507     }
52508   });
52509
52510   // modules/ui/view_on_keepRight.js
52511   var view_on_keepRight_exports = {};
52512   __export(view_on_keepRight_exports, {
52513     uiViewOnKeepRight: () => uiViewOnKeepRight
52514   });
52515   function uiViewOnKeepRight() {
52516     let _qaItem;
52517     function viewOnKeepRight(selection2) {
52518       let url;
52519       if (services.keepRight && _qaItem instanceof QAItem) {
52520         url = services.keepRight.issueURL(_qaItem);
52521       }
52522       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
52523       link2.exit().remove();
52524       const linkEnter = link2.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
52525       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
52526     }
52527     viewOnKeepRight.what = function(val) {
52528       if (!arguments.length) return _qaItem;
52529       _qaItem = val;
52530       return viewOnKeepRight;
52531     };
52532     return viewOnKeepRight;
52533   }
52534   var init_view_on_keepRight = __esm({
52535     "modules/ui/view_on_keepRight.js"() {
52536       "use strict";
52537       init_localizer();
52538       init_services();
52539       init_icon();
52540       init_osm();
52541     }
52542   });
52543
52544   // modules/ui/keepRight_editor.js
52545   var keepRight_editor_exports = {};
52546   __export(keepRight_editor_exports, {
52547     uiKeepRightEditor: () => uiKeepRightEditor
52548   });
52549   function uiKeepRightEditor(context) {
52550     const dispatch14 = dispatch_default("change");
52551     const qaDetails = uiKeepRightDetails(context);
52552     const qaHeader = uiKeepRightHeader(context);
52553     let _qaItem;
52554     function keepRightEditor(selection2) {
52555       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
52556       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
52557       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
52558       let body = selection2.selectAll(".body").data([0]);
52559       body = body.enter().append("div").attr("class", "body").merge(body);
52560       const editor = body.selectAll(".qa-editor").data([0]);
52561       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
52562       const footer = selection2.selectAll(".footer").data([0]);
52563       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
52564     }
52565     function keepRightSaveSection(selection2) {
52566       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52567       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
52568       let saveSection = selection2.selectAll(".qa-save").data(
52569         isShown ? [_qaItem] : [],
52570         (d2) => `${d2.id}-${d2.status || 0}`
52571       );
52572       saveSection.exit().remove();
52573       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
52574       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
52575       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);
52576       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
52577       function changeInput() {
52578         const input = select_default2(this);
52579         let val = input.property("value").trim();
52580         if (val === _qaItem.comment) {
52581           val = void 0;
52582         }
52583         _qaItem = _qaItem.update({ newComment: val });
52584         const qaService = services.keepRight;
52585         if (qaService) {
52586           qaService.replaceItem(_qaItem);
52587         }
52588         saveSection.call(qaSaveButtons);
52589       }
52590     }
52591     function qaSaveButtons(selection2) {
52592       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52593       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
52594       buttonSection.exit().remove();
52595       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
52596       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
52597       buttonEnter.append("button").attr("class", "button close-button action");
52598       buttonEnter.append("button").attr("class", "button ignore-button action");
52599       buttonSection = buttonSection.merge(buttonEnter);
52600       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
52601         this.blur();
52602         const qaService = services.keepRight;
52603         if (qaService) {
52604           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52605         }
52606       });
52607       buttonSection.select(".close-button").html((d2) => {
52608         const andComment = d2.newComment ? "_comment" : "";
52609         return _t.html(`QA.keepRight.close${andComment}`);
52610       }).on("click.close", function(d3_event, d2) {
52611         this.blur();
52612         const qaService = services.keepRight;
52613         if (qaService) {
52614           d2.newStatus = "ignore_t";
52615           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52616         }
52617       });
52618       buttonSection.select(".ignore-button").html((d2) => {
52619         const andComment = d2.newComment ? "_comment" : "";
52620         return _t.html(`QA.keepRight.ignore${andComment}`);
52621       }).on("click.ignore", function(d3_event, d2) {
52622         this.blur();
52623         const qaService = services.keepRight;
52624         if (qaService) {
52625           d2.newStatus = "ignore";
52626           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52627         }
52628       });
52629     }
52630     keepRightEditor.error = function(val) {
52631       if (!arguments.length) return _qaItem;
52632       _qaItem = val;
52633       return keepRightEditor;
52634     };
52635     return utilRebind(keepRightEditor, dispatch14, "on");
52636   }
52637   var init_keepRight_editor = __esm({
52638     "modules/ui/keepRight_editor.js"() {
52639       "use strict";
52640       init_src4();
52641       init_src5();
52642       init_localizer();
52643       init_services();
52644       init_browse();
52645       init_icon();
52646       init_keepRight_details();
52647       init_keepRight_header();
52648       init_view_on_keepRight();
52649       init_util();
52650     }
52651   });
52652
52653   // modules/ui/osmose_details.js
52654   var osmose_details_exports = {};
52655   __export(osmose_details_exports, {
52656     uiOsmoseDetails: () => uiOsmoseDetails
52657   });
52658   function uiOsmoseDetails(context) {
52659     let _qaItem;
52660     function issueString(d2, type2) {
52661       if (!d2) return "";
52662       const s2 = services.osmose.getStrings(d2.itemType);
52663       return type2 in s2 ? s2[type2] : "";
52664     }
52665     function osmoseDetails(selection2) {
52666       const details = selection2.selectAll(".error-details").data(
52667         _qaItem ? [_qaItem] : [],
52668         (d2) => `${d2.id}-${d2.status || 0}`
52669       );
52670       details.exit().remove();
52671       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
52672       if (issueString(_qaItem, "detail")) {
52673         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
52674         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
52675         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52676       }
52677       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
52678       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
52679       if (issueString(_qaItem, "fix")) {
52680         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
52681         div.append("h4").call(_t.append("QA.osmose.fix_title"));
52682         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52683       }
52684       if (issueString(_qaItem, "trap")) {
52685         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
52686         div.append("h4").call(_t.append("QA.osmose.trap_title"));
52687         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52688       }
52689       const thisItem = _qaItem;
52690       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
52691         if (!d2.elems || d2.elems.length === 0) return;
52692         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty()) return;
52693         if (d2.detail) {
52694           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
52695           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52696         }
52697         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
52698         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() {
52699           const link2 = select_default2(this);
52700           const entityID = this.textContent;
52701           const entity = context.hasEntity(entityID);
52702           link2.on("mouseenter", () => {
52703             utilHighlightEntities([entityID], true, context);
52704           }).on("mouseleave", () => {
52705             utilHighlightEntities([entityID], false, context);
52706           }).on("click", (d3_event) => {
52707             d3_event.preventDefault();
52708             utilHighlightEntities([entityID], false, context);
52709             const osmlayer = context.layers().layer("osm");
52710             if (!osmlayer.enabled()) {
52711               osmlayer.enabled(true);
52712             }
52713             context.map().centerZoom(d2.loc, 20);
52714             if (entity) {
52715               context.enter(modeSelect(context, [entityID]));
52716             } else {
52717               context.loadEntity(entityID, (err, result) => {
52718                 if (err) return;
52719                 const entity2 = result.data.find((e3) => e3.id === entityID);
52720                 if (entity2) context.enter(modeSelect(context, [entityID]));
52721               });
52722             }
52723           });
52724           if (entity) {
52725             let name = utilDisplayName(entity);
52726             if (!name) {
52727               const preset = _mainPresetIndex.match(entity, context.graph());
52728               name = preset && !preset.isFallback() && preset.name();
52729             }
52730             if (name) {
52731               this.innerText = name;
52732             }
52733           }
52734         });
52735         context.features().forceVisible(d2.elems);
52736         context.map().pan([0, 0]);
52737       }).catch((err) => {
52738         console.log(err);
52739       });
52740     }
52741     osmoseDetails.issue = function(val) {
52742       if (!arguments.length) return _qaItem;
52743       _qaItem = val;
52744       return osmoseDetails;
52745     };
52746     return osmoseDetails;
52747   }
52748   var init_osmose_details = __esm({
52749     "modules/ui/osmose_details.js"() {
52750       "use strict";
52751       init_src5();
52752       init_presets();
52753       init_select5();
52754       init_localizer();
52755       init_services();
52756       init_util();
52757     }
52758   });
52759
52760   // modules/ui/osmose_header.js
52761   var osmose_header_exports = {};
52762   __export(osmose_header_exports, {
52763     uiOsmoseHeader: () => uiOsmoseHeader
52764   });
52765   function uiOsmoseHeader() {
52766     let _qaItem;
52767     function issueTitle(d2) {
52768       const unknown = _t("inspector.unknown");
52769       if (!d2) return unknown;
52770       const s2 = services.osmose.getStrings(d2.itemType);
52771       return "title" in s2 ? s2.title : unknown;
52772     }
52773     function osmoseHeader(selection2) {
52774       const header = selection2.selectAll(".qa-header").data(
52775         _qaItem ? [_qaItem] : [],
52776         (d2) => `${d2.id}-${d2.status || 0}`
52777       );
52778       header.exit().remove();
52779       const headerEnter = header.enter().append("div").attr("class", "qa-header");
52780       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}`);
52781       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");
52782       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 : "");
52783       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
52784     }
52785     osmoseHeader.issue = function(val) {
52786       if (!arguments.length) return _qaItem;
52787       _qaItem = val;
52788       return osmoseHeader;
52789     };
52790     return osmoseHeader;
52791   }
52792   var init_osmose_header = __esm({
52793     "modules/ui/osmose_header.js"() {
52794       "use strict";
52795       init_services();
52796       init_localizer();
52797     }
52798   });
52799
52800   // modules/ui/view_on_osmose.js
52801   var view_on_osmose_exports = {};
52802   __export(view_on_osmose_exports, {
52803     uiViewOnOsmose: () => uiViewOnOsmose
52804   });
52805   function uiViewOnOsmose() {
52806     let _qaItem;
52807     function viewOnOsmose(selection2) {
52808       let url;
52809       if (services.osmose && _qaItem instanceof QAItem) {
52810         url = services.osmose.itemURL(_qaItem);
52811       }
52812       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
52813       link2.exit().remove();
52814       const linkEnter = link2.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
52815       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
52816     }
52817     viewOnOsmose.what = function(val) {
52818       if (!arguments.length) return _qaItem;
52819       _qaItem = val;
52820       return viewOnOsmose;
52821     };
52822     return viewOnOsmose;
52823   }
52824   var init_view_on_osmose = __esm({
52825     "modules/ui/view_on_osmose.js"() {
52826       "use strict";
52827       init_localizer();
52828       init_services();
52829       init_icon();
52830       init_osm();
52831     }
52832   });
52833
52834   // modules/ui/osmose_editor.js
52835   var osmose_editor_exports = {};
52836   __export(osmose_editor_exports, {
52837     uiOsmoseEditor: () => uiOsmoseEditor
52838   });
52839   function uiOsmoseEditor(context) {
52840     const dispatch14 = dispatch_default("change");
52841     const qaDetails = uiOsmoseDetails(context);
52842     const qaHeader = uiOsmoseHeader(context);
52843     let _qaItem;
52844     function osmoseEditor(selection2) {
52845       const header = selection2.selectAll(".header").data([0]);
52846       const headerEnter = header.enter().append("div").attr("class", "header fillL");
52847       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
52848       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
52849       let body = selection2.selectAll(".body").data([0]);
52850       body = body.enter().append("div").attr("class", "body").merge(body);
52851       let editor = body.selectAll(".qa-editor").data([0]);
52852       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
52853       const footer = selection2.selectAll(".footer").data([0]);
52854       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
52855     }
52856     function osmoseSaveSection(selection2) {
52857       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52858       const isShown = _qaItem && isSelected;
52859       let saveSection = selection2.selectAll(".qa-save").data(
52860         isShown ? [_qaItem] : [],
52861         (d2) => `${d2.id}-${d2.status || 0}`
52862       );
52863       saveSection.exit().remove();
52864       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
52865       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
52866     }
52867     function qaSaveButtons(selection2) {
52868       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52869       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
52870       buttonSection.exit().remove();
52871       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
52872       buttonEnter.append("button").attr("class", "button close-button action");
52873       buttonEnter.append("button").attr("class", "button ignore-button action");
52874       buttonSection = buttonSection.merge(buttonEnter);
52875       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
52876         this.blur();
52877         const qaService = services.osmose;
52878         if (qaService) {
52879           d2.newStatus = "done";
52880           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52881         }
52882       });
52883       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
52884         this.blur();
52885         const qaService = services.osmose;
52886         if (qaService) {
52887           d2.newStatus = "false";
52888           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52889         }
52890       });
52891     }
52892     osmoseEditor.error = function(val) {
52893       if (!arguments.length) return _qaItem;
52894       _qaItem = val;
52895       return osmoseEditor;
52896     };
52897     return utilRebind(osmoseEditor, dispatch14, "on");
52898   }
52899   var init_osmose_editor = __esm({
52900     "modules/ui/osmose_editor.js"() {
52901       "use strict";
52902       init_src4();
52903       init_localizer();
52904       init_services();
52905       init_browse();
52906       init_icon();
52907       init_osmose_details();
52908       init_osmose_header();
52909       init_view_on_osmose();
52910       init_util();
52911     }
52912   });
52913
52914   // modules/modes/select_error.js
52915   var select_error_exports = {};
52916   __export(select_error_exports, {
52917     modeSelectError: () => modeSelectError
52918   });
52919   function modeSelectError(context, selectedErrorID, selectedErrorService) {
52920     var mode = {
52921       id: "select-error",
52922       button: "browse"
52923     };
52924     var keybinding = utilKeybinding("select-error");
52925     var errorService = services[selectedErrorService];
52926     var errorEditor;
52927     switch (selectedErrorService) {
52928       case "keepRight":
52929         errorEditor = uiKeepRightEditor(context).on("change", function() {
52930           context.map().pan([0, 0]);
52931           var error = checkSelectedID();
52932           if (!error) return;
52933           context.ui().sidebar.show(errorEditor.error(error));
52934         });
52935         break;
52936       case "osmose":
52937         errorEditor = uiOsmoseEditor(context).on("change", function() {
52938           context.map().pan([0, 0]);
52939           var error = checkSelectedID();
52940           if (!error) return;
52941           context.ui().sidebar.show(errorEditor.error(error));
52942         });
52943         break;
52944     }
52945     var behaviors = [
52946       behaviorBreathe(context),
52947       behaviorHover(context),
52948       behaviorSelect(context),
52949       behaviorLasso(context),
52950       modeDragNode(context).behavior,
52951       modeDragNote(context).behavior
52952     ];
52953     function checkSelectedID() {
52954       if (!errorService) return;
52955       var error = errorService.getError(selectedErrorID);
52956       if (!error) {
52957         context.enter(modeBrowse(context));
52958       }
52959       return error;
52960     }
52961     mode.zoomToSelected = function() {
52962       if (!errorService) return;
52963       var error = errorService.getError(selectedErrorID);
52964       if (error) {
52965         context.map().centerZoomEase(error.loc, 20);
52966       }
52967     };
52968     mode.enter = function() {
52969       var error = checkSelectedID();
52970       if (!error) return;
52971       behaviors.forEach(context.install);
52972       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
52973       select_default2(document).call(keybinding);
52974       selectError();
52975       var sidebar = context.ui().sidebar;
52976       sidebar.show(errorEditor.error(error));
52977       context.map().on("drawn.select-error", selectError);
52978       function selectError(d3_event, drawn) {
52979         if (!checkSelectedID()) return;
52980         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
52981         if (selection2.empty()) {
52982           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
52983           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
52984             context.enter(modeBrowse(context));
52985           }
52986         } else {
52987           selection2.classed("selected", true);
52988           context.selectedErrorID(selectedErrorID);
52989         }
52990       }
52991       function esc() {
52992         if (context.container().select(".combobox").size()) return;
52993         context.enter(modeBrowse(context));
52994       }
52995     };
52996     mode.exit = function() {
52997       behaviors.forEach(context.uninstall);
52998       select_default2(document).call(keybinding.unbind);
52999       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
53000       context.map().on("drawn.select-error", null);
53001       context.ui().sidebar.hide();
53002       context.selectedErrorID(null);
53003       context.features().forceVisible([]);
53004     };
53005     return mode;
53006   }
53007   var init_select_error = __esm({
53008     "modules/modes/select_error.js"() {
53009       "use strict";
53010       init_src5();
53011       init_breathe();
53012       init_hover();
53013       init_lasso2();
53014       init_select4();
53015       init_localizer();
53016       init_services();
53017       init_browse();
53018       init_drag_node();
53019       init_drag_note();
53020       init_keepRight_editor();
53021       init_osmose_editor();
53022       init_util();
53023     }
53024   });
53025
53026   // modules/behavior/select.js
53027   var select_exports = {};
53028   __export(select_exports, {
53029     behaviorSelect: () => behaviorSelect
53030   });
53031   function behaviorSelect(context) {
53032     var _tolerancePx = 4;
53033     var _lastMouseEvent = null;
53034     var _showMenu = false;
53035     var _downPointers = {};
53036     var _longPressTimeout = null;
53037     var _lastInteractionType = null;
53038     var _multiselectionPointerId = null;
53039     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
53040     function keydown(d3_event) {
53041       if (d3_event.keyCode === 32) {
53042         var activeNode = document.activeElement;
53043         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName)) return;
53044       }
53045       if (d3_event.keyCode === 93 || // context menu key
53046       d3_event.keyCode === 32) {
53047         d3_event.preventDefault();
53048       }
53049       if (d3_event.repeat) return;
53050       cancelLongPress();
53051       if (d3_event.shiftKey) {
53052         context.surface().classed("behavior-multiselect", true);
53053       }
53054       if (d3_event.keyCode === 32) {
53055         if (!_downPointers.spacebar && _lastMouseEvent) {
53056           cancelLongPress();
53057           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
53058           _downPointers.spacebar = {
53059             firstEvent: _lastMouseEvent,
53060             lastEvent: _lastMouseEvent
53061           };
53062         }
53063       }
53064     }
53065     function keyup(d3_event) {
53066       cancelLongPress();
53067       if (!d3_event.shiftKey) {
53068         context.surface().classed("behavior-multiselect", false);
53069       }
53070       if (d3_event.keyCode === 93) {
53071         d3_event.preventDefault();
53072         _lastInteractionType = "menukey";
53073         contextmenu(d3_event);
53074       } else if (d3_event.keyCode === 32) {
53075         var pointer = _downPointers.spacebar;
53076         if (pointer) {
53077           delete _downPointers.spacebar;
53078           if (pointer.done) return;
53079           d3_event.preventDefault();
53080           _lastInteractionType = "spacebar";
53081           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
53082         }
53083       }
53084     }
53085     function pointerdown(d3_event) {
53086       var id2 = (d3_event.pointerId || "mouse").toString();
53087       cancelLongPress();
53088       if (d3_event.buttons && d3_event.buttons !== 1) return;
53089       context.ui().closeEditMenu();
53090       if (d3_event.pointerType !== "mouse") {
53091         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
53092       }
53093       _downPointers[id2] = {
53094         firstEvent: d3_event,
53095         lastEvent: d3_event
53096       };
53097     }
53098     function didLongPress(id2, interactionType) {
53099       var pointer = _downPointers[id2];
53100       if (!pointer) return;
53101       for (var i3 in _downPointers) {
53102         _downPointers[i3].done = true;
53103       }
53104       _longPressTimeout = null;
53105       _lastInteractionType = interactionType;
53106       _showMenu = true;
53107       click(pointer.firstEvent, pointer.lastEvent, id2);
53108     }
53109     function pointermove(d3_event) {
53110       var id2 = (d3_event.pointerId || "mouse").toString();
53111       if (_downPointers[id2]) {
53112         _downPointers[id2].lastEvent = d3_event;
53113       }
53114       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
53115         _lastMouseEvent = d3_event;
53116         if (_downPointers.spacebar) {
53117           _downPointers.spacebar.lastEvent = d3_event;
53118         }
53119       }
53120     }
53121     function pointerup(d3_event) {
53122       var id2 = (d3_event.pointerId || "mouse").toString();
53123       var pointer = _downPointers[id2];
53124       if (!pointer) return;
53125       delete _downPointers[id2];
53126       if (_multiselectionPointerId === id2) {
53127         _multiselectionPointerId = null;
53128       }
53129       if (pointer.done) return;
53130       click(pointer.firstEvent, d3_event, id2);
53131     }
53132     function pointercancel(d3_event) {
53133       var id2 = (d3_event.pointerId || "mouse").toString();
53134       if (!_downPointers[id2]) return;
53135       delete _downPointers[id2];
53136       if (_multiselectionPointerId === id2) {
53137         _multiselectionPointerId = null;
53138       }
53139     }
53140     function contextmenu(d3_event) {
53141       d3_event.preventDefault();
53142       if (!+d3_event.clientX && !+d3_event.clientY) {
53143         if (_lastMouseEvent) {
53144           d3_event = _lastMouseEvent;
53145         } else {
53146           return;
53147         }
53148       } else {
53149         _lastMouseEvent = d3_event;
53150         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
53151         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
53152           _lastInteractionType = "touch";
53153         } else {
53154           _lastInteractionType = "rightclick";
53155         }
53156       }
53157       _showMenu = true;
53158       click(d3_event, d3_event);
53159     }
53160     function click(firstEvent, lastEvent, pointerId) {
53161       cancelLongPress();
53162       var mapNode = context.container().select(".main-map").node();
53163       var pointGetter = utilFastMouse(mapNode);
53164       var p1 = pointGetter(firstEvent);
53165       var p2 = pointGetter(lastEvent);
53166       var dist = geoVecLength(p1, p2);
53167       if (dist > _tolerancePx || !mapContains(lastEvent)) {
53168         resetProperties();
53169         return;
53170       }
53171       var targetDatum = lastEvent.target.__data__;
53172       if (targetDatum === 0 && lastEvent.target.parentNode.__data__) {
53173         targetDatum = lastEvent.target.parentNode.__data__;
53174       }
53175       var multiselectEntityId;
53176       if (!_multiselectionPointerId) {
53177         var selectPointerInfo = pointerDownOnSelection(pointerId);
53178         if (selectPointerInfo) {
53179           _multiselectionPointerId = selectPointerInfo.pointerId;
53180           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
53181           _downPointers[selectPointerInfo.pointerId].done = true;
53182         }
53183       }
53184       var isMultiselect = context.mode().id === "select" && // and shift key is down
53185       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
53186       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
53187       _multiselectionPointerId && !multiselectEntityId);
53188       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
53189       function mapContains(event) {
53190         var rect = mapNode.getBoundingClientRect();
53191         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
53192       }
53193       function pointerDownOnSelection(skipPointerId) {
53194         var mode = context.mode();
53195         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
53196         for (var pointerId2 in _downPointers) {
53197           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId) continue;
53198           var pointerInfo = _downPointers[pointerId2];
53199           var p12 = pointGetter(pointerInfo.firstEvent);
53200           var p22 = pointGetter(pointerInfo.lastEvent);
53201           if (geoVecLength(p12, p22) > _tolerancePx) continue;
53202           var datum2 = pointerInfo.firstEvent.target.__data__;
53203           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
53204           if (context.graph().hasEntity(entity.id)) {
53205             return {
53206               pointerId: pointerId2,
53207               entityId: entity.id,
53208               selected: selectedIDs.indexOf(entity.id) !== -1
53209             };
53210           }
53211         }
53212         return null;
53213       }
53214     }
53215     function processClick(datum2, isMultiselect, point, alsoSelectId) {
53216       var mode = context.mode();
53217       var showMenu = _showMenu;
53218       var interactionType = _lastInteractionType;
53219       var entity = datum2 && datum2.properties && datum2.properties.entity;
53220       if (entity) datum2 = entity;
53221       if (datum2 && datum2.type === "midpoint") {
53222         datum2 = datum2.parents[0];
53223       }
53224       var newMode;
53225       if (datum2 instanceof osmEntity) {
53226         var selectedIDs = context.selectedIDs();
53227         context.selectedNoteID(null);
53228         context.selectedErrorID(null);
53229         if (!isMultiselect) {
53230           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
53231             if (alsoSelectId === datum2.id) alsoSelectId = null;
53232             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
53233             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
53234             context.enter(newMode);
53235           }
53236         } else {
53237           if (selectedIDs.indexOf(datum2.id) !== -1) {
53238             if (!showMenu) {
53239               selectedIDs = selectedIDs.filter(function(id2) {
53240                 return id2 !== datum2.id;
53241               });
53242               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
53243               context.enter(newMode);
53244             }
53245           } else {
53246             selectedIDs = selectedIDs.concat([datum2.id]);
53247             newMode = mode.selectedIDs(selectedIDs);
53248             context.enter(newMode);
53249           }
53250         }
53251       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
53252         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
53253       } else if (datum2 instanceof osmNote && !isMultiselect) {
53254         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
53255       } else if (datum2 instanceof QAItem && !isMultiselect) {
53256         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
53257       } else if (datum2.service === "photo") {
53258       } else {
53259         context.selectedNoteID(null);
53260         context.selectedErrorID(null);
53261         if (!isMultiselect && mode.id !== "browse") {
53262           context.enter(modeBrowse(context));
53263         }
53264       }
53265       context.ui().closeEditMenu();
53266       if (showMenu) context.ui().showEditMenu(point, interactionType);
53267       resetProperties();
53268     }
53269     function cancelLongPress() {
53270       if (_longPressTimeout) window.clearTimeout(_longPressTimeout);
53271       _longPressTimeout = null;
53272     }
53273     function resetProperties() {
53274       cancelLongPress();
53275       _showMenu = false;
53276       _lastInteractionType = null;
53277     }
53278     function behavior(selection2) {
53279       resetProperties();
53280       _lastMouseEvent = context.map().lastPointerEvent();
53281       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) {
53282         var e3 = d3_event;
53283         if (+e3.clientX === 0 && +e3.clientY === 0) {
53284           d3_event.preventDefault();
53285         }
53286       });
53287       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
53288     }
53289     behavior.off = function(selection2) {
53290       cancelLongPress();
53291       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);
53292       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
53293       context.surface().classed("behavior-multiselect", false);
53294     };
53295     return behavior;
53296   }
53297   var init_select4 = __esm({
53298     "modules/behavior/select.js"() {
53299       "use strict";
53300       init_src5();
53301       init_geo2();
53302       init_browse();
53303       init_select5();
53304       init_select_data();
53305       init_select_note();
53306       init_select_error();
53307       init_osm();
53308       init_util2();
53309     }
53310   });
53311
53312   // modules/ui/note_comments.js
53313   var note_comments_exports = {};
53314   __export(note_comments_exports, {
53315     uiNoteComments: () => uiNoteComments
53316   });
53317   function uiNoteComments() {
53318     var _note;
53319     function noteComments(selection2) {
53320       if (_note.isNew()) return;
53321       var comments = selection2.selectAll(".comments-container").data([0]);
53322       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
53323       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
53324       commentEnter.append("div").attr("class", function(d2) {
53325         return "comment-avatar user-" + d2.uid;
53326       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
53327       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
53328       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
53329       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
53330         var selection3 = select_default2(this);
53331         var osm = services.osm;
53332         if (osm && d2.user) {
53333           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
53334         }
53335         if (d2.user) {
53336           selection3.text(d2.user);
53337         } else {
53338           selection3.call(_t.append("note.anonymous"));
53339         }
53340       });
53341       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
53342         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
53343       });
53344       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
53345         return d2.html;
53346       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
53347       comments.call(replaceAvatars);
53348     }
53349     function replaceAvatars(selection2) {
53350       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
53351       var osm = services.osm;
53352       if (showThirdPartyIcons !== "true" || !osm) return;
53353       var uids = {};
53354       _note.comments.forEach(function(d2) {
53355         if (d2.uid) uids[d2.uid] = true;
53356       });
53357       Object.keys(uids).forEach(function(uid) {
53358         osm.loadUser(uid, function(err, user) {
53359           if (!user || !user.image_url) return;
53360           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);
53361         });
53362       });
53363     }
53364     function localeDateString2(s2) {
53365       if (!s2) return null;
53366       var options = { day: "numeric", month: "short", year: "numeric" };
53367       s2 = s2.replace(/-/g, "/");
53368       var d2 = new Date(s2);
53369       if (isNaN(d2.getTime())) return null;
53370       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options);
53371     }
53372     noteComments.note = function(val) {
53373       if (!arguments.length) return _note;
53374       _note = val;
53375       return noteComments;
53376     };
53377     return noteComments;
53378   }
53379   var init_note_comments = __esm({
53380     "modules/ui/note_comments.js"() {
53381       "use strict";
53382       init_src5();
53383       init_preferences();
53384       init_localizer();
53385       init_icon();
53386       init_services();
53387     }
53388   });
53389
53390   // modules/ui/note_header.js
53391   var note_header_exports = {};
53392   __export(note_header_exports, {
53393     uiNoteHeader: () => uiNoteHeader
53394   });
53395   function uiNoteHeader() {
53396     var _note;
53397     function noteHeader(selection2) {
53398       var header = selection2.selectAll(".note-header").data(
53399         _note ? [_note] : [],
53400         function(d2) {
53401           return d2.status + d2.id;
53402         }
53403       );
53404       header.exit().remove();
53405       var headerEnter = header.enter().append("div").attr("class", "note-header");
53406       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
53407         return "note-header-icon " + d2.status;
53408       }).classed("new", function(d2) {
53409         return d2.id < 0;
53410       });
53411       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
53412       iconEnter.each(function(d2) {
53413         var statusIcon;
53414         if (d2.id < 0) {
53415           statusIcon = "#iD-icon-plus";
53416         } else if (d2.status === "open") {
53417           statusIcon = "#iD-icon-close";
53418         } else {
53419           statusIcon = "#iD-icon-apply";
53420         }
53421         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
53422       });
53423       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
53424         if (_note.isNew()) {
53425           return _t.html("note.new");
53426         }
53427         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
53428       });
53429     }
53430     noteHeader.note = function(val) {
53431       if (!arguments.length) return _note;
53432       _note = val;
53433       return noteHeader;
53434     };
53435     return noteHeader;
53436   }
53437   var init_note_header = __esm({
53438     "modules/ui/note_header.js"() {
53439       "use strict";
53440       init_localizer();
53441       init_icon();
53442     }
53443   });
53444
53445   // modules/ui/note_report.js
53446   var note_report_exports = {};
53447   __export(note_report_exports, {
53448     uiNoteReport: () => uiNoteReport
53449   });
53450   function uiNoteReport() {
53451     var _note;
53452     function noteReport(selection2) {
53453       var url;
53454       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
53455         url = services.osm.noteReportURL(_note);
53456       }
53457       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
53458       link2.exit().remove();
53459       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
53460         return d2;
53461       }).call(svgIcon("#iD-icon-out-link", "inline"));
53462       linkEnter.append("span").call(_t.append("note.report"));
53463     }
53464     noteReport.note = function(val) {
53465       if (!arguments.length) return _note;
53466       _note = val;
53467       return noteReport;
53468     };
53469     return noteReport;
53470   }
53471   var init_note_report = __esm({
53472     "modules/ui/note_report.js"() {
53473       "use strict";
53474       init_localizer();
53475       init_osm();
53476       init_services();
53477       init_icon();
53478     }
53479   });
53480
53481   // modules/ui/view_on_osm.js
53482   var view_on_osm_exports = {};
53483   __export(view_on_osm_exports, {
53484     uiViewOnOSM: () => uiViewOnOSM
53485   });
53486   function uiViewOnOSM(context) {
53487     var _what;
53488     function viewOnOSM(selection2) {
53489       var url;
53490       if (_what instanceof osmEntity) {
53491         url = context.connection().entityURL(_what);
53492       } else if (_what instanceof osmNote) {
53493         url = context.connection().noteURL(_what);
53494       }
53495       var data = !_what || _what.isNew() ? [] : [_what];
53496       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
53497         return d2.id;
53498       });
53499       link2.exit().remove();
53500       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
53501       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
53502     }
53503     viewOnOSM.what = function(_3) {
53504       if (!arguments.length) return _what;
53505       _what = _3;
53506       return viewOnOSM;
53507     };
53508     return viewOnOSM;
53509   }
53510   var init_view_on_osm = __esm({
53511     "modules/ui/view_on_osm.js"() {
53512       "use strict";
53513       init_localizer();
53514       init_osm();
53515       init_icon();
53516     }
53517   });
53518
53519   // modules/ui/note_editor.js
53520   var note_editor_exports = {};
53521   __export(note_editor_exports, {
53522     uiNoteEditor: () => uiNoteEditor
53523   });
53524   function uiNoteEditor(context) {
53525     var dispatch14 = dispatch_default("change");
53526     var noteComments = uiNoteComments(context);
53527     var noteHeader = uiNoteHeader();
53528     var _note;
53529     var _newNote;
53530     function noteEditor(selection2) {
53531       var header = selection2.selectAll(".header").data([0]);
53532       var headerEnter = header.enter().append("div").attr("class", "header fillL");
53533       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
53534         context.enter(modeBrowse(context));
53535       }).call(svgIcon("#iD-icon-close"));
53536       headerEnter.append("h2").call(_t.append("note.title"));
53537       var body = selection2.selectAll(".body").data([0]);
53538       body = body.enter().append("div").attr("class", "body").merge(body);
53539       var editor = body.selectAll(".note-editor").data([0]);
53540       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
53541       var footer = selection2.selectAll(".footer").data([0]);
53542       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
53543       var osm = services.osm;
53544       if (osm) {
53545         osm.on("change.note-save", function() {
53546           selection2.call(noteEditor);
53547         });
53548       }
53549     }
53550     function noteSaveSection(selection2) {
53551       var isSelected = _note && _note.id === context.selectedNoteID();
53552       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
53553         return d2.status + d2.id;
53554       });
53555       noteSave.exit().remove();
53556       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
53557       noteSaveEnter.append("h4").attr("class", ".note-save-header").text("").each(function() {
53558         if (_note.isNew()) {
53559           _t.append("note.newDescription")(select_default2(this));
53560         } else {
53561           _t.append("note.newComment")(select_default2(this));
53562         }
53563       });
53564       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
53565         return d2.newComment;
53566       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
53567       if (!commentTextarea.empty() && _newNote) {
53568         commentTextarea.node().focus();
53569       }
53570       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
53571       function keydown(d3_event) {
53572         if (!(d3_event.keyCode === 13 && // ↩ Return
53573         d3_event.metaKey)) return;
53574         var osm = services.osm;
53575         if (!osm) return;
53576         var hasAuth = osm.authenticated();
53577         if (!hasAuth) return;
53578         if (!_note.newComment) return;
53579         d3_event.preventDefault();
53580         select_default2(this).on("keydown.note-input", null);
53581         window.setTimeout(function() {
53582           if (_note.isNew()) {
53583             noteSave.selectAll(".save-button").node().focus();
53584             clickSave(_note);
53585           } else {
53586             noteSave.selectAll(".comment-button").node().focus();
53587             clickComment(_note);
53588           }
53589         }, 10);
53590       }
53591       function changeInput() {
53592         var input = select_default2(this);
53593         var val = input.property("value").trim() || void 0;
53594         _note = _note.update({ newComment: val });
53595         var osm = services.osm;
53596         if (osm) {
53597           osm.replaceNote(_note);
53598         }
53599         noteSave.call(noteSaveButtons);
53600       }
53601     }
53602     function userDetails(selection2) {
53603       var detailSection = selection2.selectAll(".detail-section").data([0]);
53604       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
53605       var osm = services.osm;
53606       if (!osm) return;
53607       var hasAuth = osm.authenticated();
53608       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
53609       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
53610       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
53611       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
53612       authEnter.append("span").call(_t.append("note.login"));
53613       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) {
53614         d3_event.preventDefault();
53615         osm.authenticate();
53616       });
53617       authEnter.transition().duration(200).style("opacity", 1);
53618       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
53619       prose.exit().remove();
53620       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
53621       osm.userDetails(function(err, user) {
53622         if (err) return;
53623         var userLink = select_default2(document.createElement("div"));
53624         if (user.image_url) {
53625           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
53626         }
53627         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
53628         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
53629       });
53630     }
53631     function noteSaveButtons(selection2) {
53632       var osm = services.osm;
53633       var hasAuth = osm && osm.authenticated();
53634       var isSelected = _note && _note.id === context.selectedNoteID();
53635       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
53636         return d2.status + d2.id;
53637       });
53638       buttonSection.exit().remove();
53639       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
53640       if (_note.isNew()) {
53641         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
53642         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
53643       } else {
53644         buttonEnter.append("button").attr("class", "button status-button action");
53645         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
53646       }
53647       buttonSection = buttonSection.merge(buttonEnter);
53648       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
53649       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
53650       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).each(function(d2) {
53651         var action = d2.status === "open" ? "close" : "open";
53652         var andComment = d2.newComment ? "_comment" : "";
53653         _t.addOrUpdate("note." + action + andComment)(select_default2(this));
53654       }).on("click.status", clickStatus);
53655       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
53656       function isSaveDisabled(d2) {
53657         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
53658       }
53659     }
53660     function clickCancel(d3_event, d2) {
53661       this.blur();
53662       var osm = services.osm;
53663       if (osm) {
53664         osm.removeNote(d2);
53665       }
53666       context.enter(modeBrowse(context));
53667       dispatch14.call("change");
53668     }
53669     function clickSave(d3_event, d2) {
53670       this.blur();
53671       var osm = services.osm;
53672       if (osm) {
53673         osm.postNoteCreate(d2, function(err, note) {
53674           dispatch14.call("change", note);
53675         });
53676       }
53677     }
53678     function clickStatus(d3_event, d2) {
53679       this.blur();
53680       var osm = services.osm;
53681       if (osm) {
53682         var setStatus = d2.status === "open" ? "closed" : "open";
53683         osm.postNoteUpdate(d2, setStatus, function(err, note) {
53684           dispatch14.call("change", note);
53685         });
53686       }
53687     }
53688     function clickComment(d3_event, d2) {
53689       this.blur();
53690       var osm = services.osm;
53691       if (osm) {
53692         osm.postNoteUpdate(d2, d2.status, function(err, note) {
53693           dispatch14.call("change", note);
53694         });
53695       }
53696     }
53697     noteEditor.note = function(val) {
53698       if (!arguments.length) return _note;
53699       _note = val;
53700       return noteEditor;
53701     };
53702     noteEditor.newNote = function(val) {
53703       if (!arguments.length) return _newNote;
53704       _newNote = val;
53705       return noteEditor;
53706     };
53707     return utilRebind(noteEditor, dispatch14, "on");
53708   }
53709   var init_note_editor = __esm({
53710     "modules/ui/note_editor.js"() {
53711       "use strict";
53712       init_src4();
53713       init_src5();
53714       init_localizer();
53715       init_services();
53716       init_browse();
53717       init_icon();
53718       init_note_comments();
53719       init_note_header();
53720       init_note_report();
53721       init_view_on_osm();
53722       init_util();
53723     }
53724   });
53725
53726   // modules/modes/select_note.js
53727   var select_note_exports = {};
53728   __export(select_note_exports, {
53729     modeSelectNote: () => modeSelectNote
53730   });
53731   function modeSelectNote(context, selectedNoteID) {
53732     var mode = {
53733       id: "select-note",
53734       button: "browse"
53735     };
53736     var _keybinding = utilKeybinding("select-note");
53737     var _noteEditor = uiNoteEditor(context).on("change", function() {
53738       context.map().pan([0, 0]);
53739       var note = checkSelectedID();
53740       if (!note) return;
53741       context.ui().sidebar.show(_noteEditor.note(note));
53742     });
53743     var _behaviors = [
53744       behaviorBreathe(context),
53745       behaviorHover(context),
53746       behaviorSelect(context),
53747       behaviorLasso(context),
53748       modeDragNode(context).behavior,
53749       modeDragNote(context).behavior
53750     ];
53751     var _newFeature = false;
53752     function checkSelectedID() {
53753       if (!services.osm) return;
53754       var note = services.osm.getNote(selectedNoteID);
53755       if (!note) {
53756         context.enter(modeBrowse(context));
53757       }
53758       return note;
53759     }
53760     function selectNote(d3_event, drawn) {
53761       if (!checkSelectedID()) return;
53762       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
53763       if (selection2.empty()) {
53764         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
53765         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
53766           context.enter(modeBrowse(context));
53767         }
53768       } else {
53769         selection2.classed("selected", true);
53770         context.selectedNoteID(selectedNoteID);
53771       }
53772     }
53773     function esc() {
53774       if (context.container().select(".combobox").size()) return;
53775       context.enter(modeBrowse(context));
53776     }
53777     mode.zoomToSelected = function() {
53778       if (!services.osm) return;
53779       var note = services.osm.getNote(selectedNoteID);
53780       if (note) {
53781         context.map().centerZoomEase(note.loc, 20);
53782       }
53783     };
53784     mode.newFeature = function(val) {
53785       if (!arguments.length) return _newFeature;
53786       _newFeature = val;
53787       return mode;
53788     };
53789     mode.enter = function() {
53790       var note = checkSelectedID();
53791       if (!note) return;
53792       _behaviors.forEach(context.install);
53793       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
53794       select_default2(document).call(_keybinding);
53795       selectNote();
53796       var sidebar = context.ui().sidebar;
53797       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
53798       sidebar.expand(sidebar.intersects(note.extent()));
53799       context.map().on("drawn.select", selectNote);
53800     };
53801     mode.exit = function() {
53802       _behaviors.forEach(context.uninstall);
53803       select_default2(document).call(_keybinding.unbind);
53804       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
53805       context.map().on("drawn.select", null);
53806       context.ui().sidebar.hide();
53807       context.selectedNoteID(null);
53808     };
53809     return mode;
53810   }
53811   var init_select_note = __esm({
53812     "modules/modes/select_note.js"() {
53813       "use strict";
53814       init_src5();
53815       init_breathe();
53816       init_hover();
53817       init_lasso2();
53818       init_select4();
53819       init_localizer();
53820       init_browse();
53821       init_drag_node();
53822       init_drag_note();
53823       init_services();
53824       init_note_editor();
53825       init_util();
53826     }
53827   });
53828
53829   // modules/modes/add_note.js
53830   var add_note_exports = {};
53831   __export(add_note_exports, {
53832     modeAddNote: () => modeAddNote
53833   });
53834   function modeAddNote(context) {
53835     var mode = {
53836       id: "add-note",
53837       button: "note",
53838       description: _t.append("modes.add_note.description"),
53839       key: _t("modes.add_note.key")
53840     };
53841     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
53842     function add(loc) {
53843       var osm = services.osm;
53844       if (!osm) return;
53845       var note = osmNote({ loc, status: "open", comments: [] });
53846       osm.replaceNote(note);
53847       context.map().pan([0, 0]);
53848       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
53849     }
53850     function cancel() {
53851       context.enter(modeBrowse(context));
53852     }
53853     mode.enter = function() {
53854       context.install(behavior);
53855     };
53856     mode.exit = function() {
53857       context.uninstall(behavior);
53858     };
53859     return mode;
53860   }
53861   var init_add_note = __esm({
53862     "modules/modes/add_note.js"() {
53863       "use strict";
53864       init_localizer();
53865       init_draw();
53866       init_browse();
53867       init_select_note();
53868       init_osm();
53869       init_services();
53870     }
53871   });
53872
53873   // modules/operations/move.js
53874   var move_exports2 = {};
53875   __export(move_exports2, {
53876     operationMove: () => operationMove
53877   });
53878   function operationMove(context, selectedIDs) {
53879     var multi = selectedIDs.length === 1 ? "single" : "multiple";
53880     var nodes = utilGetAllNodes(selectedIDs, context.graph());
53881     var coords = nodes.map(function(n3) {
53882       return n3.loc;
53883     });
53884     var extent = utilTotalExtent(selectedIDs, context.graph());
53885     var operation2 = function() {
53886       context.enter(modeMove(context, selectedIDs));
53887     };
53888     operation2.available = function() {
53889       return selectedIDs.length > 0;
53890     };
53891     operation2.disabled = function() {
53892       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
53893         return "too_large";
53894       } else if (someMissing()) {
53895         return "not_downloaded";
53896       } else if (selectedIDs.some(context.hasHiddenConnections)) {
53897         return "connected_to_hidden";
53898       } else if (selectedIDs.some(incompleteRelation)) {
53899         return "incomplete_relation";
53900       }
53901       return false;
53902       function someMissing() {
53903         if (context.inIntro()) return false;
53904         var osm = context.connection();
53905         if (osm) {
53906           var missing = coords.filter(function(loc) {
53907             return !osm.isDataLoaded(loc);
53908           });
53909           if (missing.length) {
53910             missing.forEach(function(loc) {
53911               context.loadTileAtLoc(loc);
53912             });
53913             return true;
53914           }
53915         }
53916         return false;
53917       }
53918       function incompleteRelation(id2) {
53919         var entity = context.entity(id2);
53920         return entity.type === "relation" && !entity.isComplete(context.graph());
53921       }
53922     };
53923     operation2.tooltip = function() {
53924       var disable = operation2.disabled();
53925       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
53926     };
53927     operation2.annotation = function() {
53928       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
53929     };
53930     operation2.id = "move";
53931     operation2.keys = [_t("operations.move.key")];
53932     operation2.title = _t.append("operations.move.title");
53933     operation2.behavior = behaviorOperation(context).which(operation2);
53934     operation2.mouseOnly = true;
53935     return operation2;
53936   }
53937   var init_move2 = __esm({
53938     "modules/operations/move.js"() {
53939       "use strict";
53940       init_localizer();
53941       init_operation();
53942       init_move3();
53943       init_util2();
53944     }
53945   });
53946
53947   // modules/operations/orthogonalize.js
53948   var orthogonalize_exports2 = {};
53949   __export(orthogonalize_exports2, {
53950     operationOrthogonalize: () => operationOrthogonalize
53951   });
53952   function operationOrthogonalize(context, selectedIDs) {
53953     var _extent;
53954     var _type;
53955     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
53956     var _amount = _actions.length === 1 ? "single" : "multiple";
53957     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
53958       return n3.loc;
53959     });
53960     function chooseAction(entityID) {
53961       var entity = context.entity(entityID);
53962       var geometry = entity.geometry(context.graph());
53963       if (!_extent) {
53964         _extent = entity.extent(context.graph());
53965       } else {
53966         _extent = _extent.extend(entity.extent(context.graph()));
53967       }
53968       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
53969         if (_type && _type !== "feature") return null;
53970         _type = "feature";
53971         return actionOrthogonalize(entityID, context.projection);
53972       } else if (geometry === "vertex") {
53973         if (_type && _type !== "corner") return null;
53974         _type = "corner";
53975         var graph = context.graph();
53976         var parents = graph.parentWays(entity);
53977         if (parents.length === 1) {
53978           var way = parents[0];
53979           if (way.nodes.indexOf(entityID) !== -1) {
53980             return actionOrthogonalize(way.id, context.projection, entityID);
53981           }
53982         }
53983       }
53984       return null;
53985     }
53986     var operation2 = function() {
53987       if (!_actions.length) return;
53988       var combinedAction = function(graph, t2) {
53989         _actions.forEach(function(action) {
53990           if (!action.disabled(graph)) {
53991             graph = action(graph, t2);
53992           }
53993         });
53994         return graph;
53995       };
53996       combinedAction.transitionable = true;
53997       context.perform(combinedAction, operation2.annotation());
53998       window.setTimeout(function() {
53999         context.validator().validate();
54000       }, 300);
54001     };
54002     operation2.available = function() {
54003       return _actions.length && selectedIDs.length === _actions.length;
54004     };
54005     operation2.disabled = function() {
54006       if (!_actions.length) return "";
54007       var actionDisableds = _actions.map(function(action) {
54008         return action.disabled(context.graph());
54009       }).filter(Boolean);
54010       if (actionDisableds.length === _actions.length) {
54011         if (new Set(actionDisableds).size > 1) {
54012           return "multiple_blockers";
54013         }
54014         return actionDisableds[0];
54015       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
54016         return "too_large";
54017       } else if (someMissing()) {
54018         return "not_downloaded";
54019       } else if (selectedIDs.some(context.hasHiddenConnections)) {
54020         return "connected_to_hidden";
54021       }
54022       return false;
54023       function someMissing() {
54024         if (context.inIntro()) return false;
54025         var osm = context.connection();
54026         if (osm) {
54027           var missing = _coords.filter(function(loc) {
54028             return !osm.isDataLoaded(loc);
54029           });
54030           if (missing.length) {
54031             missing.forEach(function(loc) {
54032               context.loadTileAtLoc(loc);
54033             });
54034             return true;
54035           }
54036         }
54037         return false;
54038       }
54039     };
54040     operation2.tooltip = function() {
54041       var disable = operation2.disabled();
54042       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
54043     };
54044     operation2.annotation = function() {
54045       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
54046     };
54047     operation2.id = "orthogonalize";
54048     operation2.keys = [_t("operations.orthogonalize.key")];
54049     operation2.title = _t.append("operations.orthogonalize.title");
54050     operation2.behavior = behaviorOperation(context).which(operation2);
54051     return operation2;
54052   }
54053   var init_orthogonalize2 = __esm({
54054     "modules/operations/orthogonalize.js"() {
54055       "use strict";
54056       init_localizer();
54057       init_orthogonalize();
54058       init_operation();
54059       init_util();
54060     }
54061   });
54062
54063   // modules/operations/reflect.js
54064   var reflect_exports2 = {};
54065   __export(reflect_exports2, {
54066     operationReflect: () => operationReflect,
54067     operationReflectLong: () => operationReflectLong,
54068     operationReflectShort: () => operationReflectShort
54069   });
54070   function operationReflectShort(context, selectedIDs) {
54071     return operationReflect(context, selectedIDs, "short");
54072   }
54073   function operationReflectLong(context, selectedIDs) {
54074     return operationReflect(context, selectedIDs, "long");
54075   }
54076   function operationReflect(context, selectedIDs, axis) {
54077     axis = axis || "long";
54078     var multi = selectedIDs.length === 1 ? "single" : "multiple";
54079     var nodes = utilGetAllNodes(selectedIDs, context.graph());
54080     var coords = nodes.map(function(n3) {
54081       return n3.loc;
54082     });
54083     var extent = utilTotalExtent(selectedIDs, context.graph());
54084     var operation2 = function() {
54085       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
54086       context.perform(action, operation2.annotation());
54087       window.setTimeout(function() {
54088         context.validator().validate();
54089       }, 300);
54090     };
54091     operation2.available = function() {
54092       return nodes.length >= 3;
54093     };
54094     operation2.disabled = function() {
54095       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
54096         return "too_large";
54097       } else if (someMissing()) {
54098         return "not_downloaded";
54099       } else if (selectedIDs.some(context.hasHiddenConnections)) {
54100         return "connected_to_hidden";
54101       } else if (selectedIDs.some(incompleteRelation)) {
54102         return "incomplete_relation";
54103       }
54104       return false;
54105       function someMissing() {
54106         if (context.inIntro()) return false;
54107         var osm = context.connection();
54108         if (osm) {
54109           var missing = coords.filter(function(loc) {
54110             return !osm.isDataLoaded(loc);
54111           });
54112           if (missing.length) {
54113             missing.forEach(function(loc) {
54114               context.loadTileAtLoc(loc);
54115             });
54116             return true;
54117           }
54118         }
54119         return false;
54120       }
54121       function incompleteRelation(id2) {
54122         var entity = context.entity(id2);
54123         return entity.type === "relation" && !entity.isComplete(context.graph());
54124       }
54125     };
54126     operation2.tooltip = function() {
54127       var disable = operation2.disabled();
54128       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
54129     };
54130     operation2.annotation = function() {
54131       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
54132     };
54133     operation2.id = "reflect-" + axis;
54134     operation2.keys = [_t("operations.reflect.key." + axis)];
54135     operation2.title = _t.append("operations.reflect.title." + axis);
54136     operation2.behavior = behaviorOperation(context).which(operation2);
54137     return operation2;
54138   }
54139   var init_reflect2 = __esm({
54140     "modules/operations/reflect.js"() {
54141       "use strict";
54142       init_localizer();
54143       init_reflect();
54144       init_operation();
54145       init_util2();
54146     }
54147   });
54148
54149   // modules/modes/rotate.js
54150   var rotate_exports2 = {};
54151   __export(rotate_exports2, {
54152     modeRotate: () => modeRotate
54153   });
54154   function modeRotate(context, entityIDs) {
54155     var _tolerancePx = 4;
54156     var mode = {
54157       id: "rotate",
54158       button: "browse"
54159     };
54160     var keybinding = utilKeybinding("rotate");
54161     var behaviors = [
54162       behaviorEdit(context),
54163       operationCircularize(context, entityIDs).behavior,
54164       operationDelete(context, entityIDs).behavior,
54165       operationMove(context, entityIDs).behavior,
54166       operationOrthogonalize(context, entityIDs).behavior,
54167       operationReflectLong(context, entityIDs).behavior,
54168       operationReflectShort(context, entityIDs).behavior
54169     ];
54170     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
54171     var _prevGraph;
54172     var _prevAngle;
54173     var _prevTransform;
54174     var _pivot;
54175     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
54176     function doRotate(d3_event) {
54177       var fn;
54178       if (context.graph() !== _prevGraph) {
54179         fn = context.perform;
54180       } else {
54181         fn = context.replace;
54182       }
54183       var projection2 = context.projection;
54184       var currTransform = projection2.transform();
54185       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
54186         var nodes = utilGetAllNodes(entityIDs, context.graph());
54187         var points = nodes.map(function(n3) {
54188           return projection2(n3.loc);
54189         });
54190         _pivot = getPivot(points);
54191         _prevAngle = void 0;
54192       }
54193       var currMouse = context.map().mouse(d3_event);
54194       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
54195       if (typeof _prevAngle === "undefined") _prevAngle = currAngle;
54196       var delta = currAngle - _prevAngle;
54197       fn(actionRotate(entityIDs, _pivot, delta, projection2));
54198       _prevTransform = currTransform;
54199       _prevAngle = currAngle;
54200       _prevGraph = context.graph();
54201     }
54202     function getPivot(points) {
54203       var _pivot2;
54204       if (points.length === 1) {
54205         _pivot2 = points[0];
54206       } else if (points.length === 2) {
54207         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
54208       } else {
54209         var polygonHull = hull_default(points);
54210         if (polygonHull.length === 2) {
54211           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
54212         } else {
54213           _pivot2 = centroid_default2(hull_default(points));
54214         }
54215       }
54216       return _pivot2;
54217     }
54218     function finish(d3_event) {
54219       d3_event.stopPropagation();
54220       context.replace(actionNoop(), annotation);
54221       context.enter(modeSelect(context, entityIDs));
54222     }
54223     function cancel() {
54224       if (_prevGraph) context.pop();
54225       context.enter(modeSelect(context, entityIDs));
54226     }
54227     function undone() {
54228       context.enter(modeBrowse(context));
54229     }
54230     mode.enter = function() {
54231       _prevGraph = null;
54232       context.features().forceVisible(entityIDs);
54233       behaviors.forEach(context.install);
54234       var downEvent;
54235       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
54236         downEvent = d3_event;
54237       });
54238       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
54239         if (!downEvent) return;
54240         var mapNode = context.container().select(".main-map").node();
54241         var pointGetter = utilFastMouse(mapNode);
54242         var p1 = pointGetter(downEvent);
54243         var p2 = pointGetter(d3_event);
54244         var dist = geoVecLength(p1, p2);
54245         if (dist <= _tolerancePx) finish(d3_event);
54246         downEvent = null;
54247       }, true);
54248       context.history().on("undone.modeRotate", undone);
54249       keybinding.on("\u238B", cancel).on("\u21A9", finish);
54250       select_default2(document).call(keybinding);
54251     };
54252     mode.exit = function() {
54253       behaviors.forEach(context.uninstall);
54254       context.surface().on(_pointerPrefix + "down.modeRotate", null);
54255       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
54256       context.history().on("undone.modeRotate", null);
54257       select_default2(document).call(keybinding.unbind);
54258       context.features().forceVisible([]);
54259     };
54260     mode.selectedIDs = function() {
54261       if (!arguments.length) return entityIDs;
54262       return mode;
54263     };
54264     return mode;
54265   }
54266   var init_rotate2 = __esm({
54267     "modules/modes/rotate.js"() {
54268       "use strict";
54269       init_src5();
54270       init_src3();
54271       init_localizer();
54272       init_rotate();
54273       init_noop2();
54274       init_edit();
54275       init_vector();
54276       init_browse();
54277       init_select5();
54278       init_circularize2();
54279       init_delete();
54280       init_move2();
54281       init_orthogonalize2();
54282       init_reflect2();
54283       init_keybinding();
54284       init_util2();
54285     }
54286   });
54287
54288   // modules/ui/conflicts.js
54289   var conflicts_exports = {};
54290   __export(conflicts_exports, {
54291     uiConflicts: () => uiConflicts
54292   });
54293   function uiConflicts(context) {
54294     var dispatch14 = dispatch_default("cancel", "save");
54295     var keybinding = utilKeybinding("conflicts");
54296     var _origChanges;
54297     var _conflictList;
54298     var _shownConflictIndex;
54299     function keybindingOn() {
54300       select_default2(document).call(keybinding.on("\u238B", cancel, true));
54301     }
54302     function keybindingOff() {
54303       select_default2(document).call(keybinding.unbind);
54304     }
54305     function tryAgain() {
54306       keybindingOff();
54307       dispatch14.call("save");
54308     }
54309     function cancel() {
54310       keybindingOff();
54311       dispatch14.call("cancel");
54312     }
54313     function conflicts(selection2) {
54314       keybindingOn();
54315       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
54316       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
54317       headerEnter.append("h2").call(_t.append("save.conflict.header"));
54318       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
54319       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
54320       var changeset = new osmChangeset();
54321       delete changeset.id;
54322       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
54323       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
54324       var fileName = "changes.osc";
54325       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
54326       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
54327       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
54328       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
54329       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
54330       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
54331       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
54332       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
54333     }
54334     function showConflict(selection2, index) {
54335       index = utilWrap(index, _conflictList.length);
54336       _shownConflictIndex = index;
54337       var parent2 = select_default2(selection2.node().parentNode);
54338       if (index === _conflictList.length - 1) {
54339         window.setTimeout(function() {
54340           parent2.select(".conflicts-button").attr("disabled", null);
54341           parent2.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
54342         }, 250);
54343       }
54344       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
54345       conflict.exit().remove();
54346       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
54347       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
54348       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
54349         return d2.name;
54350       }).on("click", function(d3_event, d2) {
54351         d3_event.preventDefault();
54352         zoomToEntity(d2.id);
54353       });
54354       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
54355       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
54356         return d2.details || [];
54357       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
54358         return d2;
54359       });
54360       details.append("div").attr("class", "conflict-choices").call(addChoices);
54361       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) {
54362         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
54363       }).on("click", function(d3_event, d2) {
54364         d3_event.preventDefault();
54365         var container = parent2.selectAll(".conflict-container");
54366         var sign2 = d2 === "previous" ? -1 : 1;
54367         container.selectAll(".conflict").remove();
54368         container.call(showConflict, index + sign2);
54369       }).each(function(d2) {
54370         _t.append("save.conflict." + d2)(select_default2(this));
54371       });
54372     }
54373     function addChoices(selection2) {
54374       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
54375         return d2.choices || [];
54376       });
54377       var choicesEnter = choices.enter().append("li").attr("class", "layer");
54378       var labelEnter = choicesEnter.append("label");
54379       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
54380         return d2.id;
54381       }).on("change", function(d3_event, d2) {
54382         var ul = this.parentNode.parentNode.parentNode;
54383         ul.__data__.chosen = d2.id;
54384         choose(d3_event, ul, d2);
54385       });
54386       labelEnter.append("span").text(function(d2) {
54387         return d2.text;
54388       });
54389       choicesEnter.merge(choices).each(function(d2) {
54390         var ul = this.parentNode;
54391         if (ul.__data__.chosen === d2.id) {
54392           choose(null, ul, d2);
54393         }
54394       });
54395     }
54396     function choose(d3_event, ul, datum2) {
54397       if (d3_event) d3_event.preventDefault();
54398       select_default2(ul).selectAll("li").classed("active", function(d2) {
54399         return d2 === datum2;
54400       }).selectAll("input").property("checked", function(d2) {
54401         return d2 === datum2;
54402       });
54403       var extent = geoExtent();
54404       var entity;
54405       entity = context.graph().hasEntity(datum2.id);
54406       if (entity) extent._extend(entity.extent(context.graph()));
54407       datum2.action();
54408       entity = context.graph().hasEntity(datum2.id);
54409       if (entity) extent._extend(entity.extent(context.graph()));
54410       zoomToEntity(datum2.id, extent);
54411     }
54412     function zoomToEntity(id2, extent) {
54413       context.surface().selectAll(".hover").classed("hover", false);
54414       var entity = context.graph().hasEntity(id2);
54415       if (entity) {
54416         if (extent) {
54417           context.map().trimmedExtent(extent);
54418         } else {
54419           context.map().zoomToEase(entity);
54420         }
54421         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
54422       }
54423     }
54424     conflicts.conflictList = function(_3) {
54425       if (!arguments.length) return _conflictList;
54426       _conflictList = _3;
54427       return conflicts;
54428     };
54429     conflicts.origChanges = function(_3) {
54430       if (!arguments.length) return _origChanges;
54431       _origChanges = _3;
54432       return conflicts;
54433     };
54434     conflicts.shownEntityIds = function() {
54435       if (_conflictList && typeof _shownConflictIndex === "number") {
54436         return [_conflictList[_shownConflictIndex].id];
54437       }
54438       return [];
54439     };
54440     return utilRebind(conflicts, dispatch14, "on");
54441   }
54442   var init_conflicts = __esm({
54443     "modules/ui/conflicts.js"() {
54444       "use strict";
54445       init_src4();
54446       init_src5();
54447       init_localizer();
54448       init_jxon();
54449       init_geo2();
54450       init_osm();
54451       init_icon();
54452       init_util();
54453     }
54454   });
54455
54456   // modules/ui/confirm.js
54457   var confirm_exports = {};
54458   __export(confirm_exports, {
54459     uiConfirm: () => uiConfirm
54460   });
54461   function uiConfirm(selection2) {
54462     var modalSelection = uiModal(selection2);
54463     modalSelection.select(".modal").classed("modal-alert", true);
54464     var section = modalSelection.select(".content");
54465     section.append("div").attr("class", "modal-section header");
54466     section.append("div").attr("class", "modal-section message-text");
54467     var buttons = section.append("div").attr("class", "modal-section buttons cf");
54468     modalSelection.okButton = function() {
54469       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
54470         modalSelection.remove();
54471       }).call(_t.append("confirm.okay")).node().focus();
54472       return modalSelection;
54473     };
54474     return modalSelection;
54475   }
54476   var init_confirm = __esm({
54477     "modules/ui/confirm.js"() {
54478       "use strict";
54479       init_localizer();
54480       init_modal();
54481     }
54482   });
54483
54484   // modules/ui/popover.js
54485   var popover_exports = {};
54486   __export(popover_exports, {
54487     uiPopover: () => uiPopover
54488   });
54489   function uiPopover(klass) {
54490     var _id = _popoverID++;
54491     var _anchorSelection = select_default2(null);
54492     var popover = function(selection2) {
54493       _anchorSelection = selection2;
54494       selection2.each(setup);
54495     };
54496     var _animation = utilFunctor(false);
54497     var _placement = utilFunctor("top");
54498     var _alignment = utilFunctor("center");
54499     var _scrollContainer = utilFunctor(select_default2(null));
54500     var _content;
54501     var _displayType = utilFunctor("");
54502     var _hasArrow = utilFunctor(true);
54503     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
54504     popover.displayType = function(val) {
54505       if (arguments.length) {
54506         _displayType = utilFunctor(val);
54507         return popover;
54508       } else {
54509         return _displayType;
54510       }
54511     };
54512     popover.hasArrow = function(val) {
54513       if (arguments.length) {
54514         _hasArrow = utilFunctor(val);
54515         return popover;
54516       } else {
54517         return _hasArrow;
54518       }
54519     };
54520     popover.placement = function(val) {
54521       if (arguments.length) {
54522         _placement = utilFunctor(val);
54523         return popover;
54524       } else {
54525         return _placement;
54526       }
54527     };
54528     popover.alignment = function(val) {
54529       if (arguments.length) {
54530         _alignment = utilFunctor(val);
54531         return popover;
54532       } else {
54533         return _alignment;
54534       }
54535     };
54536     popover.scrollContainer = function(val) {
54537       if (arguments.length) {
54538         _scrollContainer = utilFunctor(val);
54539         return popover;
54540       } else {
54541         return _scrollContainer;
54542       }
54543     };
54544     popover.content = function(val) {
54545       if (arguments.length) {
54546         _content = val;
54547         return popover;
54548       } else {
54549         return _content;
54550       }
54551     };
54552     popover.isShown = function() {
54553       var popoverSelection = _anchorSelection.select(".popover-" + _id);
54554       return !popoverSelection.empty() && popoverSelection.classed("in");
54555     };
54556     popover.show = function() {
54557       _anchorSelection.each(show);
54558     };
54559     popover.updateContent = function() {
54560       _anchorSelection.each(updateContent);
54561     };
54562     popover.hide = function() {
54563       _anchorSelection.each(hide);
54564     };
54565     popover.toggle = function() {
54566       _anchorSelection.each(toggle);
54567     };
54568     popover.destroy = function(selection2, selector) {
54569       selector = selector || ".popover-" + _id;
54570       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() {
54571         return this.getAttribute("data-original-title") || this.getAttribute("title");
54572       }).attr("data-original-title", null).selectAll(selector).remove();
54573     };
54574     popover.destroyAny = function(selection2) {
54575       selection2.call(popover.destroy, ".popover");
54576     };
54577     function setup() {
54578       var anchor = select_default2(this);
54579       var animate = _animation.apply(this, arguments);
54580       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
54581       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
54582       enter.append("div").attr("class", "popover-arrow");
54583       enter.append("div").attr("class", "popover-inner");
54584       popoverSelection = enter.merge(popoverSelection);
54585       if (animate) {
54586         popoverSelection.classed("fade", true);
54587       }
54588       var display = _displayType.apply(this, arguments);
54589       if (display === "hover") {
54590         var _lastNonMouseEnterTime;
54591         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
54592           if (d3_event.pointerType) {
54593             if (d3_event.pointerType !== "mouse") {
54594               _lastNonMouseEnterTime = d3_event.timeStamp;
54595               return;
54596             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
54597               return;
54598             }
54599           }
54600           if (d3_event.buttons !== 0) return;
54601           show.apply(this, arguments);
54602         }).on(_pointerPrefix + "leave.popover", function() {
54603           hide.apply(this, arguments);
54604         }).on("focus.popover", function() {
54605           show.apply(this, arguments);
54606         }).on("blur.popover", function() {
54607           hide.apply(this, arguments);
54608         });
54609       } else if (display === "clickFocus") {
54610         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
54611           d3_event.preventDefault();
54612           d3_event.stopPropagation();
54613         }).on(_pointerPrefix + "up.popover", function(d3_event) {
54614           d3_event.preventDefault();
54615           d3_event.stopPropagation();
54616         }).on("click.popover", toggle);
54617         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
54618           anchor.each(function() {
54619             hide.apply(this, arguments);
54620           });
54621         });
54622       }
54623     }
54624     function show() {
54625       var anchor = select_default2(this);
54626       var popoverSelection = anchor.selectAll(".popover-" + _id);
54627       if (popoverSelection.empty()) {
54628         anchor.call(popover.destroy);
54629         anchor.each(setup);
54630         popoverSelection = anchor.selectAll(".popover-" + _id);
54631       }
54632       popoverSelection.classed("in", true);
54633       var displayType = _displayType.apply(this, arguments);
54634       if (displayType === "clickFocus") {
54635         anchor.classed("active", true);
54636         popoverSelection.node().focus();
54637       }
54638       anchor.each(updateContent);
54639     }
54640     function updateContent() {
54641       var anchor = select_default2(this);
54642       if (_content) {
54643         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
54644       }
54645       updatePosition.apply(this, arguments);
54646       updatePosition.apply(this, arguments);
54647       updatePosition.apply(this, arguments);
54648     }
54649     function updatePosition() {
54650       var anchor = select_default2(this);
54651       var popoverSelection = anchor.selectAll(".popover-" + _id);
54652       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
54653       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
54654       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
54655       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
54656       var placement = _placement.apply(this, arguments);
54657       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
54658       var alignment = _alignment.apply(this, arguments);
54659       var alignFactor = 0.5;
54660       if (alignment === "leading") {
54661         alignFactor = 0;
54662       } else if (alignment === "trailing") {
54663         alignFactor = 1;
54664       }
54665       var anchorFrame = getFrame(anchor.node());
54666       var popoverFrame = getFrame(popoverSelection.node());
54667       var position;
54668       switch (placement) {
54669         case "top":
54670           position = {
54671             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
54672             y: anchorFrame.y - popoverFrame.h
54673           };
54674           break;
54675         case "bottom":
54676           position = {
54677             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
54678             y: anchorFrame.y + anchorFrame.h
54679           };
54680           break;
54681         case "left":
54682           position = {
54683             x: anchorFrame.x - popoverFrame.w,
54684             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
54685           };
54686           break;
54687         case "right":
54688           position = {
54689             x: anchorFrame.x + anchorFrame.w,
54690             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
54691           };
54692           break;
54693       }
54694       if (position) {
54695         if (scrollNode && (placement === "top" || placement === "bottom")) {
54696           var initialPosX = position.x;
54697           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
54698             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
54699           } else if (position.x < 10) {
54700             position.x = 10;
54701           }
54702           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
54703           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
54704           arrow.style("left", ~~arrowPosX + "px");
54705         }
54706         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
54707       } else {
54708         popoverSelection.style("left", null).style("top", null);
54709       }
54710       function getFrame(node) {
54711         var positionStyle = select_default2(node).style("position");
54712         if (positionStyle === "absolute" || positionStyle === "static") {
54713           return {
54714             x: node.offsetLeft - scrollLeft,
54715             y: node.offsetTop - scrollTop,
54716             w: node.offsetWidth,
54717             h: node.offsetHeight
54718           };
54719         } else {
54720           return {
54721             x: 0,
54722             y: 0,
54723             w: node.offsetWidth,
54724             h: node.offsetHeight
54725           };
54726         }
54727       }
54728     }
54729     function hide() {
54730       var anchor = select_default2(this);
54731       if (_displayType.apply(this, arguments) === "clickFocus") {
54732         anchor.classed("active", false);
54733       }
54734       anchor.selectAll(".popover-" + _id).classed("in", false);
54735     }
54736     function toggle() {
54737       if (select_default2(this).select(".popover-" + _id).classed("in")) {
54738         hide.apply(this, arguments);
54739       } else {
54740         show.apply(this, arguments);
54741       }
54742     }
54743     return popover;
54744   }
54745   var _popoverID;
54746   var init_popover = __esm({
54747     "modules/ui/popover.js"() {
54748       "use strict";
54749       init_src5();
54750       init_util2();
54751       _popoverID = 0;
54752     }
54753   });
54754
54755   // modules/ui/tooltip.js
54756   var tooltip_exports = {};
54757   __export(tooltip_exports, {
54758     uiTooltip: () => uiTooltip
54759   });
54760   function uiTooltip(klass) {
54761     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
54762     var _title = function() {
54763       var title = this.getAttribute("data-original-title");
54764       if (title) {
54765         return title;
54766       } else {
54767         title = this.getAttribute("title");
54768         this.removeAttribute("title");
54769         this.setAttribute("data-original-title", title);
54770       }
54771       return title;
54772     };
54773     var _heading = utilFunctor(null);
54774     var _keys = utilFunctor(null);
54775     tooltip.title = function(val) {
54776       if (!arguments.length) return _title;
54777       _title = utilFunctor(val);
54778       return tooltip;
54779     };
54780     tooltip.heading = function(val) {
54781       if (!arguments.length) return _heading;
54782       _heading = utilFunctor(val);
54783       return tooltip;
54784     };
54785     tooltip.keys = function(val) {
54786       if (!arguments.length) return _keys;
54787       _keys = utilFunctor(val);
54788       return tooltip;
54789     };
54790     tooltip.content(function() {
54791       var heading = _heading.apply(this, arguments);
54792       var text = _title.apply(this, arguments);
54793       var keys2 = _keys.apply(this, arguments);
54794       var headingCallback = typeof heading === "function" ? heading : (s2) => s2.text(heading);
54795       var textCallback = typeof text === "function" ? text : (s2) => s2.text(text);
54796       return function(selection2) {
54797         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
54798         headingSelect.exit().remove();
54799         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
54800         var textSelect = selection2.selectAll(".tooltip-text").data(text ? [text] : []);
54801         textSelect.exit().remove();
54802         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
54803         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
54804         keyhintWrap.exit().remove();
54805         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
54806         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
54807         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
54808         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
54809           return d2;
54810         });
54811       };
54812     });
54813     return tooltip;
54814   }
54815   var init_tooltip = __esm({
54816     "modules/ui/tooltip.js"() {
54817       "use strict";
54818       init_util2();
54819       init_localizer();
54820       init_popover();
54821     }
54822   });
54823
54824   // modules/ui/intro/helper.js
54825   var helper_exports = {};
54826   __export(helper_exports, {
54827     helpHtml: () => helpHtml,
54828     icon: () => icon,
54829     isMostlySquare: () => isMostlySquare,
54830     localize: () => localize,
54831     missingStrings: () => missingStrings,
54832     pad: () => pad2,
54833     pointBox: () => pointBox,
54834     selectMenuItem: () => selectMenuItem,
54835     transitionTime: () => transitionTime
54836   });
54837   function pointBox(loc, context) {
54838     var rect = context.surfaceRect();
54839     var point = context.curtainProjection(loc);
54840     return {
54841       left: point[0] + rect.left - 40,
54842       top: point[1] + rect.top - 60,
54843       width: 80,
54844       height: 90
54845     };
54846   }
54847   function pad2(locOrBox, padding, context) {
54848     var box;
54849     if (locOrBox instanceof Array) {
54850       var rect = context.surfaceRect();
54851       var point = context.curtainProjection(locOrBox);
54852       box = {
54853         left: point[0] + rect.left,
54854         top: point[1] + rect.top
54855       };
54856     } else {
54857       box = locOrBox;
54858     }
54859     return {
54860       left: box.left - padding,
54861       top: box.top - padding,
54862       width: (box.width || 0) + 2 * padding,
54863       height: (box.width || 0) + 2 * padding
54864     };
54865   }
54866   function icon(name, svgklass, useklass) {
54867     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
54868   }
54869   function helpHtml(id2, replacements) {
54870     if (!helpStringReplacements) {
54871       helpStringReplacements = {
54872         // insert icons corresponding to various UI elements
54873         point_icon: icon("#iD-icon-point", "inline"),
54874         line_icon: icon("#iD-icon-line", "inline"),
54875         area_icon: icon("#iD-icon-area", "inline"),
54876         note_icon: icon("#iD-icon-note", "inline add-note"),
54877         plus: icon("#iD-icon-plus", "inline"),
54878         minus: icon("#iD-icon-minus", "inline"),
54879         layers_icon: icon("#iD-icon-layers", "inline"),
54880         data_icon: icon("#iD-icon-data", "inline"),
54881         inspect: icon("#iD-icon-inspect", "inline"),
54882         help_icon: icon("#iD-icon-help", "inline"),
54883         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
54884         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
54885         save_icon: icon("#iD-icon-save", "inline"),
54886         // operation icons
54887         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
54888         continue_icon: icon("#iD-operation-continue", "inline operation"),
54889         copy_icon: icon("#iD-operation-copy", "inline operation"),
54890         delete_icon: icon("#iD-operation-delete", "inline operation"),
54891         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
54892         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
54893         extract_icon: icon("#iD-operation-extract", "inline operation"),
54894         merge_icon: icon("#iD-operation-merge", "inline operation"),
54895         move_icon: icon("#iD-operation-move", "inline operation"),
54896         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
54897         paste_icon: icon("#iD-operation-paste", "inline operation"),
54898         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
54899         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
54900         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
54901         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
54902         split_icon: icon("#iD-operation-split", "inline operation"),
54903         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
54904         // interaction icons
54905         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
54906         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
54907         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
54908         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
54909         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
54910         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
54911         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
54912         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
54913         // insert keys; may be localized and platform-dependent
54914         shift: uiCmd.display("\u21E7"),
54915         alt: uiCmd.display("\u2325"),
54916         return: uiCmd.display("\u21B5"),
54917         esc: _t.html("shortcuts.key.esc"),
54918         space: _t.html("shortcuts.key.space"),
54919         add_note_key: _t.html("modes.add_note.key"),
54920         help_key: _t.html("help.key"),
54921         shortcuts_key: _t.html("shortcuts.toggle.key"),
54922         // reference localized UI labels directly so that they'll always match
54923         save: _t.html("save.title"),
54924         undo: _t.html("undo.title"),
54925         redo: _t.html("redo.title"),
54926         upload: _t.html("commit.save"),
54927         point: _t.html("modes.add_point.title"),
54928         line: _t.html("modes.add_line.title"),
54929         area: _t.html("modes.add_area.title"),
54930         note: _t.html("modes.add_note.label"),
54931         circularize: _t.html("operations.circularize.title"),
54932         continue: _t.html("operations.continue.title"),
54933         copy: _t.html("operations.copy.title"),
54934         delete: _t.html("operations.delete.title"),
54935         disconnect: _t.html("operations.disconnect.title"),
54936         downgrade: _t.html("operations.downgrade.title"),
54937         extract: _t.html("operations.extract.title"),
54938         merge: _t.html("operations.merge.title"),
54939         move: _t.html("operations.move.title"),
54940         orthogonalize: _t.html("operations.orthogonalize.title"),
54941         paste: _t.html("operations.paste.title"),
54942         reflect_long: _t.html("operations.reflect.title.long"),
54943         reflect_short: _t.html("operations.reflect.title.short"),
54944         reverse: _t.html("operations.reverse.title"),
54945         rotate: _t.html("operations.rotate.title"),
54946         split: _t.html("operations.split.title"),
54947         straighten: _t.html("operations.straighten.title"),
54948         map_data: _t.html("map_data.title"),
54949         osm_notes: _t.html("map_data.layers.notes.title"),
54950         fields: _t.html("inspector.fields"),
54951         tags: _t.html("inspector.tags"),
54952         relations: _t.html("inspector.relations"),
54953         new_relation: _t.html("inspector.new_relation"),
54954         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
54955         background_settings: _t.html("background.description"),
54956         imagery_offset: _t.html("background.fix_misalignment"),
54957         start_the_walkthrough: _t.html("splash.walkthrough"),
54958         help: _t.html("help.title"),
54959         ok: _t.html("intro.ok")
54960       };
54961       for (var key in helpStringReplacements) {
54962         helpStringReplacements[key] = { html: helpStringReplacements[key] };
54963       }
54964     }
54965     var reps;
54966     if (replacements) {
54967       reps = Object.assign(replacements, helpStringReplacements);
54968     } else {
54969       reps = helpStringReplacements;
54970     }
54971     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
54972   }
54973   function slugify(text) {
54974     return text.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
54975   }
54976   function checkKey(key, text) {
54977     if (_t(key, { default: void 0 }) === void 0) {
54978       if (missingStrings.hasOwnProperty(key)) return;
54979       missingStrings[key] = text;
54980       var missing = key + ": " + text;
54981       if (typeof console !== "undefined") console.log(missing);
54982     }
54983   }
54984   function localize(obj) {
54985     var key;
54986     var name = obj.tags && obj.tags.name;
54987     if (name) {
54988       key = "intro.graph.name." + slugify(name);
54989       obj.tags.name = _t(key, { default: name });
54990       checkKey(key, name);
54991     }
54992     var street = obj.tags && obj.tags["addr:street"];
54993     if (street) {
54994       key = "intro.graph.name." + slugify(street);
54995       obj.tags["addr:street"] = _t(key, { default: street });
54996       checkKey(key, street);
54997       var addrTags = [
54998         "block_number",
54999         "city",
55000         "county",
55001         "district",
55002         "hamlet",
55003         "neighbourhood",
55004         "postcode",
55005         "province",
55006         "quarter",
55007         "state",
55008         "subdistrict",
55009         "suburb"
55010       ];
55011       addrTags.forEach(function(k3) {
55012         var key2 = "intro.graph." + k3;
55013         var tag = "addr:" + k3;
55014         var val = obj.tags && obj.tags[tag];
55015         var str = _t(key2, { default: val });
55016         if (str) {
55017           if (str.match(/^<.*>$/) !== null) {
55018             delete obj.tags[tag];
55019           } else {
55020             obj.tags[tag] = str;
55021           }
55022         }
55023       });
55024     }
55025     return obj;
55026   }
55027   function isMostlySquare(points) {
55028     var threshold = 15;
55029     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
55030     var upperBound = Math.cos(threshold * Math.PI / 180);
55031     for (var i3 = 0; i3 < points.length; i3++) {
55032       var a4 = points[(i3 - 1 + points.length) % points.length];
55033       var origin = points[i3];
55034       var b3 = points[(i3 + 1) % points.length];
55035       var dotp = geoVecNormalizedDot(a4, b3, origin);
55036       var mag = Math.abs(dotp);
55037       if (mag > lowerBound && mag < upperBound) {
55038         return false;
55039       }
55040     }
55041     return true;
55042   }
55043   function selectMenuItem(context, operation2) {
55044     return context.container().select(".edit-menu .edit-menu-item-" + operation2);
55045   }
55046   function transitionTime(point1, point2) {
55047     var distance = geoSphericalDistance(point1, point2);
55048     if (distance === 0) {
55049       return 0;
55050     } else if (distance < 80) {
55051       return 500;
55052     } else {
55053       return 1e3;
55054     }
55055   }
55056   var helpStringReplacements, missingStrings;
55057   var init_helper = __esm({
55058     "modules/ui/intro/helper.js"() {
55059       "use strict";
55060       init_localizer();
55061       init_geo2();
55062       init_cmd();
55063       missingStrings = {};
55064     }
55065   });
55066
55067   // modules/ui/field_help.js
55068   var field_help_exports = {};
55069   __export(field_help_exports, {
55070     uiFieldHelp: () => uiFieldHelp
55071   });
55072   function uiFieldHelp(context, fieldName) {
55073     var fieldHelp = {};
55074     var _inspector = select_default2(null);
55075     var _wrap = select_default2(null);
55076     var _body = select_default2(null);
55077     var fieldHelpKeys = {
55078       restrictions: [
55079         ["about", [
55080           "about",
55081           "from_via_to",
55082           "maxdist",
55083           "maxvia"
55084         ]],
55085         ["inspecting", [
55086           "about",
55087           "from_shadow",
55088           "allow_shadow",
55089           "restrict_shadow",
55090           "only_shadow",
55091           "restricted",
55092           "only"
55093         ]],
55094         ["modifying", [
55095           "about",
55096           "indicators",
55097           "allow_turn",
55098           "restrict_turn",
55099           "only_turn"
55100         ]],
55101         ["tips", [
55102           "simple",
55103           "simple_example",
55104           "indirect",
55105           "indirect_example",
55106           "indirect_noedit"
55107         ]]
55108       ]
55109     };
55110     var fieldHelpHeadings = {};
55111     var replacements = {
55112       distField: { html: _t.html("restriction.controls.distance") },
55113       viaField: { html: _t.html("restriction.controls.via") },
55114       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
55115       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
55116       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
55117       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
55118       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
55119       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
55120       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
55121     };
55122     var docs = fieldHelpKeys[fieldName].map(function(key) {
55123       var helpkey = "help.field." + fieldName + "." + key[0];
55124       var text = key[1].reduce(function(all, part) {
55125         var subkey = helpkey + "." + part;
55126         var depth = fieldHelpHeadings[subkey];
55127         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
55128         return all + hhh + _t.html(subkey, replacements) + "\n\n";
55129       }, "");
55130       return {
55131         key: helpkey,
55132         title: _t.html(helpkey + ".title"),
55133         html: k(text.trim())
55134       };
55135     });
55136     function show() {
55137       updatePosition();
55138       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
55139     }
55140     function hide() {
55141       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
55142         _body.classed("hide", true);
55143       });
55144     }
55145     function clickHelp(index) {
55146       var d2 = docs[index];
55147       var tkeys = fieldHelpKeys[fieldName][index][1];
55148       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
55149         return i3 === index;
55150       });
55151       var content = _body.selectAll(".field-help-content").html(d2.html);
55152       content.selectAll("p").attr("class", function(d4, i3) {
55153         return tkeys[i3];
55154       });
55155       if (d2.key === "help.field.restrictions.inspecting") {
55156         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
55157       } else if (d2.key === "help.field.restrictions.modifying") {
55158         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
55159       }
55160     }
55161     fieldHelp.button = function(selection2) {
55162       if (_body.empty()) return;
55163       var button = selection2.selectAll(".field-help-button").data([0]);
55164       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
55165         d3_event.stopPropagation();
55166         d3_event.preventDefault();
55167         if (_body.classed("hide")) {
55168           show();
55169         } else {
55170           hide();
55171         }
55172       });
55173     };
55174     function updatePosition() {
55175       var wrap2 = _wrap.node();
55176       var inspector = _inspector.node();
55177       var wRect = wrap2.getBoundingClientRect();
55178       var iRect = inspector.getBoundingClientRect();
55179       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
55180     }
55181     fieldHelp.body = function(selection2) {
55182       _wrap = selection2.selectAll(".form-field-input-wrap");
55183       if (_wrap.empty()) return;
55184       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
55185       if (_inspector.empty()) return;
55186       _body = _inspector.selectAll(".field-help-body").data([0]);
55187       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
55188       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
55189       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
55190       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
55191         d3_event.stopPropagation();
55192         d3_event.preventDefault();
55193         hide();
55194       }).call(svgIcon("#iD-icon-close"));
55195       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
55196       var titles = docs.map(function(d2) {
55197         return d2.title;
55198       });
55199       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
55200         return d2;
55201       }).on("click", function(d3_event, d2) {
55202         d3_event.stopPropagation();
55203         d3_event.preventDefault();
55204         clickHelp(titles.indexOf(d2));
55205       });
55206       enter.append("div").attr("class", "field-help-content");
55207       _body = _body.merge(enter);
55208       clickHelp(0);
55209     };
55210     return fieldHelp;
55211   }
55212   var init_field_help = __esm({
55213     "modules/ui/field_help.js"() {
55214       "use strict";
55215       init_src5();
55216       init_marked_esm();
55217       init_localizer();
55218       init_icon();
55219       init_helper();
55220     }
55221   });
55222
55223   // modules/ui/fields/check.js
55224   var check_exports = {};
55225   __export(check_exports, {
55226     uiFieldCheck: () => uiFieldCheck,
55227     uiFieldDefaultCheck: () => uiFieldCheck,
55228     uiFieldOnewayCheck: () => uiFieldCheck
55229   });
55230   function uiFieldCheck(field, context) {
55231     var dispatch14 = dispatch_default("change");
55232     var options = field.options;
55233     var values = [];
55234     var texts = [];
55235     var _tags;
55236     var input = select_default2(null);
55237     var text = select_default2(null);
55238     var label = select_default2(null);
55239     var reverser = select_default2(null);
55240     var _impliedYes;
55241     var _entityIDs = [];
55242     var _value;
55243     var stringsField = field.resolveReference("stringsCrossReference");
55244     if (!options && stringsField.options) {
55245       options = stringsField.options;
55246     }
55247     if (options) {
55248       for (var i3 in options) {
55249         var v3 = options[i3];
55250         values.push(v3 === "undefined" ? void 0 : v3);
55251         texts.push(stringsField.t.html("options." + v3, { "default": v3 }));
55252       }
55253     } else {
55254       values = [void 0, "yes"];
55255       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
55256       if (field.type !== "defaultCheck") {
55257         values.push("no");
55258         texts.push(_t.html("inspector.check.no"));
55259       }
55260     }
55261     function checkImpliedYes() {
55262       _impliedYes = field.id === "oneway_yes";
55263       if (field.id === "oneway") {
55264         var entity = context.entity(_entityIDs[0]);
55265         if (entity.type === "way" && !!utilCheckTagDictionary(entity.tags, omit_default(osmOneWayTags, "oneway"))) {
55266           _impliedYes = true;
55267           texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
55268         }
55269       }
55270     }
55271     function reverserHidden() {
55272       if (!context.container().select("div.inspector-hover").empty()) return true;
55273       return !(_value === "yes" || _impliedYes && !_value);
55274     }
55275     function reverserSetText(selection2) {
55276       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
55277       if (reverserHidden() || !entity) return selection2;
55278       var first = entity.first();
55279       var last2 = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
55280       var pseudoDirection = first < last2;
55281       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
55282       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
55283       return selection2;
55284     }
55285     var check = function(selection2) {
55286       checkImpliedYes();
55287       label = selection2.selectAll(".form-field-input-wrap").data([0]);
55288       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
55289       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
55290       enter.append("span").html(texts[0]).attr("class", "value");
55291       if (field.type === "onewayCheck") {
55292         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
55293       }
55294       label = label.merge(enter);
55295       input = label.selectAll("input");
55296       text = label.selectAll("span.value");
55297       input.on("click", function(d3_event) {
55298         d3_event.stopPropagation();
55299         var t2 = {};
55300         if (Array.isArray(_tags[field.key])) {
55301           if (values.indexOf("yes") !== -1) {
55302             t2[field.key] = "yes";
55303           } else {
55304             t2[field.key] = values[0];
55305           }
55306         } else {
55307           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
55308         }
55309         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
55310           t2[field.key] = values[0];
55311         }
55312         dispatch14.call("change", this, t2);
55313       });
55314       if (field.type === "onewayCheck") {
55315         reverser = label.selectAll(".reverser");
55316         reverser.call(reverserSetText).on("click", function(d3_event) {
55317           d3_event.preventDefault();
55318           d3_event.stopPropagation();
55319           context.perform(
55320             function(graph) {
55321               for (var i4 in _entityIDs) {
55322                 graph = actionReverse(_entityIDs[i4])(graph);
55323               }
55324               return graph;
55325             },
55326             _t("operations.reverse.annotation.line", { n: 1 })
55327           );
55328           context.validator().validate();
55329           select_default2(this).call(reverserSetText);
55330         });
55331       }
55332     };
55333     check.entityIDs = function(val) {
55334       if (!arguments.length) return _entityIDs;
55335       _entityIDs = val;
55336       return check;
55337     };
55338     check.tags = function(tags) {
55339       _tags = tags;
55340       function isChecked(val) {
55341         return val !== "no" && val !== "" && val !== void 0 && val !== null;
55342       }
55343       function textFor(val) {
55344         if (val === "") val = void 0;
55345         var index = values.indexOf(val);
55346         return index !== -1 ? texts[index] : '"' + val + '"';
55347       }
55348       checkImpliedYes();
55349       var isMixed = Array.isArray(tags[field.key]);
55350       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
55351       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
55352         _value = "yes";
55353       }
55354       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
55355       text.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
55356       label.classed("set", !!_value);
55357       if (field.type === "onewayCheck") {
55358         reverser.classed("hide", reverserHidden()).call(reverserSetText);
55359       }
55360     };
55361     check.focus = function() {
55362       input.node().focus();
55363     };
55364     return utilRebind(check, dispatch14, "on");
55365   }
55366   var init_check = __esm({
55367     "modules/ui/fields/check.js"() {
55368       "use strict";
55369       init_src4();
55370       init_src5();
55371       init_lodash();
55372       init_rebind();
55373       init_localizer();
55374       init_reverse();
55375       init_icon();
55376       init_util();
55377       init_tags();
55378     }
55379   });
55380
55381   // modules/svg/helpers.js
55382   var helpers_exports = {};
55383   __export(helpers_exports, {
55384     svgMarkerSegments: () => svgMarkerSegments,
55385     svgPassiveVertex: () => svgPassiveVertex,
55386     svgPath: () => svgPath,
55387     svgPointTransform: () => svgPointTransform,
55388     svgRelationMemberTags: () => svgRelationMemberTags,
55389     svgSegmentWay: () => svgSegmentWay
55390   });
55391   function svgPassiveVertex(node, graph, activeID) {
55392     if (!activeID) return 1;
55393     if (activeID === node.id) return 0;
55394     var parents = graph.parentWays(node);
55395     var i3, j3, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
55396     for (i3 = 0; i3 < parents.length; i3++) {
55397       nodes = parents[i3].nodes;
55398       isClosed = parents[i3].isClosed();
55399       for (j3 = 0; j3 < nodes.length; j3++) {
55400         if (nodes[j3] === node.id) {
55401           ix1 = j3 - 2;
55402           ix2 = j3 - 1;
55403           ix3 = j3 + 1;
55404           ix4 = j3 + 2;
55405           if (isClosed) {
55406             max3 = nodes.length - 1;
55407             if (ix1 < 0) ix1 = max3 + ix1;
55408             if (ix2 < 0) ix2 = max3 + ix2;
55409             if (ix3 > max3) ix3 = ix3 - max3;
55410             if (ix4 > max3) ix4 = ix4 - max3;
55411           }
55412           if (nodes[ix1] === activeID) return 0;
55413           else if (nodes[ix2] === activeID) return 2;
55414           else if (nodes[ix3] === activeID) return 2;
55415           else if (nodes[ix4] === activeID) return 0;
55416           else if (isClosed && nodes.indexOf(activeID) !== -1) return 0;
55417         }
55418       }
55419     }
55420     return 1;
55421   }
55422   function svgMarkerSegments(projection2, graph, dt2, shouldReverse = () => false, bothDirections = () => false) {
55423     return function(entity) {
55424       let i3 = 0;
55425       let offset = dt2 / 2;
55426       const segments = [];
55427       const clip = paddedClipExtent(projection2);
55428       const coordinates = graph.childNodes(entity).map(function(n3) {
55429         return n3.loc;
55430       });
55431       let a4, b3;
55432       const _shouldReverse = shouldReverse(entity);
55433       const _bothDirections = bothDirections(entity);
55434       stream_default({
55435         type: "LineString",
55436         coordinates
55437       }, projection2.stream(clip({
55438         lineStart: function() {
55439         },
55440         lineEnd: function() {
55441           a4 = null;
55442         },
55443         point: function(x2, y2) {
55444           b3 = [x2, y2];
55445           if (a4) {
55446             let span = geoVecLength(a4, b3) - offset;
55447             if (span >= 0) {
55448               const heading = geoVecAngle(a4, b3);
55449               const dx = dt2 * Math.cos(heading);
55450               const dy = dt2 * Math.sin(heading);
55451               let p2 = [
55452                 a4[0] + offset * Math.cos(heading),
55453                 a4[1] + offset * Math.sin(heading)
55454               ];
55455               const coord2 = [a4, p2];
55456               for (span -= dt2; span >= 0; span -= dt2) {
55457                 p2 = geoVecAdd(p2, [dx, dy]);
55458                 coord2.push(p2);
55459               }
55460               coord2.push(b3);
55461               let segment = "";
55462               if (!_shouldReverse || _bothDirections) {
55463                 for (let j3 = 0; j3 < coord2.length; j3++) {
55464                   segment += (j3 === 0 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
55465                 }
55466                 segments.push({ id: entity.id, index: i3++, d: segment });
55467               }
55468               if (_shouldReverse || _bothDirections) {
55469                 segment = "";
55470                 for (let j3 = coord2.length - 1; j3 >= 0; j3--) {
55471                   segment += (j3 === coord2.length - 1 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
55472                 }
55473                 segments.push({ id: entity.id, index: i3++, d: segment });
55474               }
55475             }
55476             offset = -span;
55477           }
55478           a4 = b3;
55479         }
55480       })));
55481       return segments;
55482     };
55483   }
55484   function svgPath(projection2, graph, isArea) {
55485     const cache = {};
55486     const project = projection2.stream;
55487     const clip = paddedClipExtent(projection2, isArea);
55488     const path = path_default().projection({ stream: function(output) {
55489       return project(clip(output));
55490     } });
55491     const svgpath = function(entity) {
55492       if (entity.id in cache) {
55493         return cache[entity.id];
55494       } else {
55495         return cache[entity.id] = path(entity.asGeoJSON(graph));
55496       }
55497     };
55498     svgpath.geojson = function(d2) {
55499       if (d2.__featurehash__ !== void 0) {
55500         if (d2.__featurehash__ in cache) {
55501           return cache[d2.__featurehash__];
55502         } else {
55503           return cache[d2.__featurehash__] = path(d2);
55504         }
55505       } else {
55506         return path(d2);
55507       }
55508     };
55509     return svgpath;
55510   }
55511   function svgPointTransform(projection2) {
55512     var svgpoint = function(entity) {
55513       var pt2 = projection2(entity.loc);
55514       return "translate(" + pt2[0] + "," + pt2[1] + ")";
55515     };
55516     svgpoint.geojson = function(d2) {
55517       return svgpoint(d2.properties.entity);
55518     };
55519     return svgpoint;
55520   }
55521   function svgRelationMemberTags(graph) {
55522     return function(entity) {
55523       var tags = entity.tags;
55524       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
55525       graph.parentRelations(entity).forEach(function(relation) {
55526         var type2 = relation.tags.type;
55527         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
55528           tags = Object.assign({}, relation.tags, tags);
55529         }
55530       });
55531       return tags;
55532     };
55533   }
55534   function svgSegmentWay(way, graph, activeID) {
55535     if (activeID === void 0) {
55536       return graph.transient(way, "waySegments", getWaySegments);
55537     } else {
55538       return getWaySegments();
55539     }
55540     function getWaySegments() {
55541       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
55542       var features = { passive: [], active: [] };
55543       var start2 = {};
55544       var end = {};
55545       var node, type2;
55546       for (var i3 = 0; i3 < way.nodes.length; i3++) {
55547         node = graph.entity(way.nodes[i3]);
55548         type2 = svgPassiveVertex(node, graph, activeID);
55549         end = { node, type: type2 };
55550         if (start2.type !== void 0) {
55551           if (start2.node.id === activeID || end.node.id === activeID) {
55552           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
55553             pushActive(start2, end, i3);
55554           } else if (start2.type === 0 && end.type === 0) {
55555             pushActive(start2, end, i3);
55556           } else {
55557             pushPassive(start2, end, i3);
55558           }
55559         }
55560         start2 = end;
55561       }
55562       return features;
55563       function pushActive(start3, end2, index) {
55564         features.active.push({
55565           type: "Feature",
55566           id: way.id + "-" + index + "-nope",
55567           properties: {
55568             nope: true,
55569             target: true,
55570             entity: way,
55571             nodes: [start3.node, end2.node],
55572             index
55573           },
55574           geometry: {
55575             type: "LineString",
55576             coordinates: [start3.node.loc, end2.node.loc]
55577           }
55578         });
55579       }
55580       function pushPassive(start3, end2, index) {
55581         features.passive.push({
55582           type: "Feature",
55583           id: way.id + "-" + index,
55584           properties: {
55585             target: true,
55586             entity: way,
55587             nodes: [start3.node, end2.node],
55588             index
55589           },
55590           geometry: {
55591             type: "LineString",
55592             coordinates: [start3.node.loc, end2.node.loc]
55593           }
55594         });
55595       }
55596     }
55597   }
55598   function paddedClipExtent(projection2, isArea = false) {
55599     var padding = isArea ? 65 : 5;
55600     var viewport = projection2.clipExtent();
55601     var paddedExtent = [
55602       [viewport[0][0] - padding, viewport[0][1] - padding],
55603       [viewport[1][0] + padding, viewport[1][1] + padding]
55604     ];
55605     return identity_default2().clipExtent(paddedExtent).stream;
55606   }
55607   var init_helpers = __esm({
55608     "modules/svg/helpers.js"() {
55609       "use strict";
55610       init_src2();
55611       init_geo2();
55612     }
55613   });
55614
55615   // modules/svg/tag_classes.js
55616   var tag_classes_exports = {};
55617   __export(tag_classes_exports, {
55618     svgTagClasses: () => svgTagClasses
55619   });
55620   function svgTagClasses() {
55621     var primaries = [
55622       "building",
55623       "highway",
55624       "railway",
55625       "waterway",
55626       "aeroway",
55627       "aerialway",
55628       "piste:type",
55629       "boundary",
55630       "power",
55631       "amenity",
55632       "natural",
55633       "landuse",
55634       "leisure",
55635       "military",
55636       "place",
55637       "man_made",
55638       "route",
55639       "attraction",
55640       "roller_coaster",
55641       "building:part",
55642       "indoor"
55643     ];
55644     var statuses = Object.keys(osmLifecyclePrefixes);
55645     var secondaries = [
55646       "oneway",
55647       "bridge",
55648       "tunnel",
55649       "embankment",
55650       "cutting",
55651       "barrier",
55652       "surface",
55653       "tracktype",
55654       "footway",
55655       "crossing",
55656       "service",
55657       "sport",
55658       "public_transport",
55659       "location",
55660       "parking",
55661       "golf",
55662       "type",
55663       "leisure",
55664       "man_made",
55665       "indoor",
55666       "construction",
55667       "proposed"
55668     ];
55669     var _tags = function(entity) {
55670       return entity.tags;
55671     };
55672     var tagClasses = function(selection2) {
55673       selection2.each(function tagClassesEach(entity) {
55674         var value = this.className;
55675         if (value.baseVal !== void 0) {
55676           value = value.baseVal;
55677         }
55678         var t2 = _tags(entity);
55679         var computed = tagClasses.getClassesString(t2, value);
55680         if (computed !== value) {
55681           select_default2(this).attr("class", computed);
55682         }
55683       });
55684     };
55685     tagClasses.getClassesString = function(t2, value) {
55686       var primary, status;
55687       var i3, j3, k3, v3;
55688       var overrideGeometry;
55689       if (/\bstroke\b/.test(value)) {
55690         if (!!t2.barrier && t2.barrier !== "no") {
55691           overrideGeometry = "line";
55692         }
55693       }
55694       var classes = value.trim().split(/\s+/).filter(function(klass) {
55695         return klass.length && !/^tag-/.test(klass);
55696       }).map(function(klass) {
55697         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
55698       });
55699       for (i3 = 0; i3 < primaries.length; i3++) {
55700         k3 = primaries[i3];
55701         v3 = t2[k3];
55702         if (!v3 || v3 === "no") continue;
55703         if (k3 === "piste:type") {
55704           k3 = "piste";
55705         } else if (k3 === "building:part") {
55706           k3 = "building_part";
55707         }
55708         primary = k3;
55709         if (statuses.indexOf(v3) !== -1) {
55710           status = v3;
55711           classes.push("tag-" + k3);
55712         } else {
55713           classes.push("tag-" + k3);
55714           classes.push("tag-" + k3 + "-" + v3);
55715         }
55716         break;
55717       }
55718       if (!primary) {
55719         for (i3 = 0; i3 < statuses.length; i3++) {
55720           for (j3 = 0; j3 < primaries.length; j3++) {
55721             k3 = statuses[i3] + ":" + primaries[j3];
55722             v3 = t2[k3];
55723             if (!v3 || v3 === "no") continue;
55724             status = statuses[i3];
55725             break;
55726           }
55727         }
55728       }
55729       if (!status) {
55730         for (i3 = 0; i3 < statuses.length; i3++) {
55731           k3 = statuses[i3];
55732           v3 = t2[k3];
55733           if (!v3 || v3 === "no") continue;
55734           if (v3 === "yes") {
55735             status = k3;
55736           } else if (primary && primary === v3) {
55737             status = k3;
55738           } else if (!primary && primaries.indexOf(v3) !== -1) {
55739             status = k3;
55740             primary = v3;
55741             classes.push("tag-" + v3);
55742           }
55743           if (status) break;
55744         }
55745       }
55746       if (status) {
55747         classes.push("tag-status");
55748         classes.push("tag-status-" + status);
55749       }
55750       for (i3 = 0; i3 < secondaries.length; i3++) {
55751         k3 = secondaries[i3];
55752         v3 = t2[k3];
55753         if (!v3 || v3 === "no" || k3 === primary) continue;
55754         classes.push("tag-" + k3);
55755         classes.push("tag-" + k3 + "-" + v3);
55756       }
55757       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
55758         var surface = t2.highway === "track" ? "unpaved" : "paved";
55759         for (k3 in t2) {
55760           v3 = t2[k3];
55761           if (k3 in osmPavedTags) {
55762             surface = osmPavedTags[k3][v3] ? "paved" : "unpaved";
55763           }
55764           if (k3 in osmSemipavedTags && !!osmSemipavedTags[k3][v3]) {
55765             surface = "semipaved";
55766           }
55767         }
55768         classes.push("tag-" + surface);
55769       }
55770       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
55771       if (qid) {
55772         classes.push("tag-wikidata");
55773       }
55774       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
55775     };
55776     tagClasses.tags = function(val) {
55777       if (!arguments.length) return _tags;
55778       _tags = val;
55779       return tagClasses;
55780     };
55781     return tagClasses;
55782   }
55783   var init_tag_classes = __esm({
55784     "modules/svg/tag_classes.js"() {
55785       "use strict";
55786       init_src5();
55787       init_tags();
55788     }
55789   });
55790
55791   // modules/svg/tag_pattern.js
55792   var tag_pattern_exports = {};
55793   __export(tag_pattern_exports, {
55794     svgTagPattern: () => svgTagPattern
55795   });
55796   function svgTagPattern(tags) {
55797     if (tags.building && tags.building !== "no") {
55798       return null;
55799     }
55800     for (var tag in patterns) {
55801       var entityValue = tags[tag];
55802       if (!entityValue) continue;
55803       if (typeof patterns[tag] === "string") {
55804         return "pattern-" + patterns[tag];
55805       } else {
55806         var values = patterns[tag];
55807         for (var value in values) {
55808           if (entityValue !== value) continue;
55809           var rules = values[value];
55810           if (typeof rules === "string") {
55811             return "pattern-" + rules;
55812           }
55813           for (var ruleKey in rules) {
55814             var rule = rules[ruleKey];
55815             var pass = true;
55816             for (var criterion in rule) {
55817               if (criterion !== "pattern") {
55818                 var v3 = tags[criterion];
55819                 if (!v3 || v3 !== rule[criterion]) {
55820                   pass = false;
55821                   break;
55822                 }
55823               }
55824             }
55825             if (pass) {
55826               return "pattern-" + rule.pattern;
55827             }
55828           }
55829         }
55830       }
55831     }
55832     return null;
55833   }
55834   var patterns;
55835   var init_tag_pattern = __esm({
55836     "modules/svg/tag_pattern.js"() {
55837       "use strict";
55838       patterns = {
55839         // tag - pattern name
55840         // -or-
55841         // tag - value - pattern name
55842         // -or-
55843         // tag - value - rules (optional tag-values, pattern name)
55844         // (matches earlier rules first, so fallback should be last entry)
55845         amenity: {
55846           grave_yard: "cemetery",
55847           fountain: "water_standing"
55848         },
55849         landuse: {
55850           cemetery: [
55851             { religion: "christian", pattern: "cemetery_christian" },
55852             { religion: "buddhist", pattern: "cemetery_buddhist" },
55853             { religion: "muslim", pattern: "cemetery_muslim" },
55854             { religion: "jewish", pattern: "cemetery_jewish" },
55855             { pattern: "cemetery" }
55856           ],
55857           construction: "construction",
55858           farmland: "farmland",
55859           farmyard: "farmyard",
55860           forest: [
55861             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
55862             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
55863             { leaf_type: "leafless", pattern: "forest_leafless" },
55864             { pattern: "forest" }
55865             // same as 'leaf_type:mixed'
55866           ],
55867           grave_yard: "cemetery",
55868           grass: "grass",
55869           landfill: "landfill",
55870           meadow: "meadow",
55871           military: "construction",
55872           orchard: "orchard",
55873           quarry: "quarry",
55874           vineyard: "vineyard"
55875         },
55876         leisure: {
55877           horse_riding: "farmyard"
55878         },
55879         natural: {
55880           beach: "beach",
55881           grassland: "grass",
55882           sand: "beach",
55883           scrub: "scrub",
55884           water: [
55885             { water: "pond", pattern: "pond" },
55886             { water: "reservoir", pattern: "water_standing" },
55887             { pattern: "waves" }
55888           ],
55889           wetland: [
55890             { wetland: "marsh", pattern: "wetland_marsh" },
55891             { wetland: "swamp", pattern: "wetland_swamp" },
55892             { wetland: "bog", pattern: "wetland_bog" },
55893             { wetland: "reedbed", pattern: "wetland_reedbed" },
55894             { pattern: "wetland" }
55895           ],
55896           wood: [
55897             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
55898             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
55899             { leaf_type: "leafless", pattern: "forest_leafless" },
55900             { pattern: "forest" }
55901             // same as 'leaf_type:mixed'
55902           ]
55903         },
55904         golf: {
55905           green: "golf_green",
55906           tee: "grass",
55907           fairway: "grass",
55908           rough: "scrub"
55909         },
55910         surface: {
55911           grass: "grass",
55912           sand: "beach"
55913         }
55914       };
55915     }
55916   });
55917
55918   // modules/svg/areas.js
55919   var areas_exports = {};
55920   __export(areas_exports, {
55921     svgAreas: () => svgAreas
55922   });
55923   function svgAreas(projection2, context) {
55924     function getPatternStyle(tags) {
55925       var imageID = svgTagPattern(tags);
55926       if (imageID) {
55927         return 'url("#ideditor-' + imageID + '")';
55928       }
55929       return "";
55930     }
55931     function drawTargets(selection2, graph, entities, filter2) {
55932       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
55933       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
55934       var getPath = svgPath(projection2).geojson;
55935       var activeID = context.activeID();
55936       var base = context.history().base();
55937       var data = { targets: [], nopes: [] };
55938       entities.forEach(function(way) {
55939         var features = svgSegmentWay(way, graph, activeID);
55940         data.targets.push.apply(data.targets, features.passive);
55941         data.nopes.push.apply(data.nopes, features.active);
55942       });
55943       var targetData = data.targets.filter(getPath);
55944       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
55945         return filter2(d2.properties.entity);
55946       }).data(targetData, function key(d2) {
55947         return d2.id;
55948       });
55949       targets.exit().remove();
55950       var segmentWasEdited = function(d2) {
55951         var wayID = d2.properties.entity.id;
55952         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
55953           return false;
55954         }
55955         return d2.properties.nodes.some(function(n3) {
55956           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
55957         });
55958       };
55959       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
55960         return "way area target target-allowed " + targetClass + d2.id;
55961       }).classed("segment-edited", segmentWasEdited);
55962       var nopeData = data.nopes.filter(getPath);
55963       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
55964         return filter2(d2.properties.entity);
55965       }).data(nopeData, function key(d2) {
55966         return d2.id;
55967       });
55968       nopes.exit().remove();
55969       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
55970         return "way area target target-nope " + nopeClass + d2.id;
55971       }).classed("segment-edited", segmentWasEdited);
55972     }
55973     function drawAreas(selection2, graph, entities, filter2) {
55974       var path = svgPath(projection2, graph, true);
55975       var areas = {};
55976       var base = context.history().base();
55977       for (var i3 = 0; i3 < entities.length; i3++) {
55978         var entity = entities[i3];
55979         if (entity.geometry(graph) !== "area") continue;
55980         if (!areas[entity.id]) {
55981           areas[entity.id] = {
55982             entity,
55983             area: Math.abs(entity.area(graph))
55984           };
55985         }
55986       }
55987       var fills = Object.values(areas).filter(function hasPath(a4) {
55988         return path(a4.entity);
55989       });
55990       fills.sort(function areaSort(a4, b3) {
55991         return b3.area - a4.area;
55992       });
55993       fills = fills.map(function(a4) {
55994         return a4.entity;
55995       });
55996       var strokes = fills.filter(function(area) {
55997         return area.type === "way";
55998       });
55999       var data = {
56000         clip: fills,
56001         shadow: strokes,
56002         stroke: strokes,
56003         fill: fills
56004       };
56005       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
56006       clipPaths.exit().remove();
56007       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
56008         return "ideditor-" + entity2.id + "-clippath";
56009       });
56010       clipPathsEnter.append("path");
56011       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
56012       var drawLayer = selection2.selectAll(".layer-osm.areas");
56013       var touchLayer = selection2.selectAll(".layer-touch.areas");
56014       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
56015       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
56016         return "areagroup area-" + d2;
56017       }).merge(areagroup);
56018       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
56019         return data[layer];
56020       }, osmEntity.key);
56021       paths.exit().remove();
56022       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
56023       var bisect = bisector(function(node) {
56024         return -node.__data__.area(graph);
56025       }).left;
56026       function sortedByArea(entity2) {
56027         if (this._parent.__data__ === "fill") {
56028           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
56029         }
56030       }
56031       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
56032         var layer = this.parentNode.__data__;
56033         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
56034         if (layer === "fill") {
56035           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
56036           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
56037         }
56038       }).classed("added", function(d2) {
56039         return !base.entities[d2.id];
56040       }).classed("geometry-edited", function(d2) {
56041         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);
56042       }).classed("retagged", function(d2) {
56043         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);
56044       }).call(svgTagClasses()).attr("d", path);
56045       touchLayer.call(drawTargets, graph, data.stroke, filter2);
56046     }
56047     return drawAreas;
56048   }
56049   var import_fast_deep_equal6;
56050   var init_areas = __esm({
56051     "modules/svg/areas.js"() {
56052       "use strict";
56053       import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
56054       init_src();
56055       init_osm();
56056       init_helpers();
56057       init_tag_classes();
56058       init_tag_pattern();
56059     }
56060   });
56061
56062   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
56063   function $2(element, tagName) {
56064     return Array.from(element.getElementsByTagName(tagName));
56065   }
56066   function normalizeId(id2) {
56067     return id2[0] === "#" ? id2 : `#${id2}`;
56068   }
56069   function $ns(element, tagName, ns) {
56070     return Array.from(element.getElementsByTagNameNS(ns, tagName));
56071   }
56072   function nodeVal(node) {
56073     node == null ? void 0 : node.normalize();
56074     return (node == null ? void 0 : node.textContent) || "";
56075   }
56076   function get1(node, tagName, callback) {
56077     const n3 = node.getElementsByTagName(tagName);
56078     const result = n3.length ? n3[0] : null;
56079     if (result && callback)
56080       callback(result);
56081     return result;
56082   }
56083   function get3(node, tagName, callback) {
56084     const properties = {};
56085     if (!node)
56086       return properties;
56087     const n3 = node.getElementsByTagName(tagName);
56088     const result = n3.length ? n3[0] : null;
56089     if (result && callback) {
56090       return callback(result, properties);
56091     }
56092     return properties;
56093   }
56094   function val1(node, tagName, callback) {
56095     const val = nodeVal(get1(node, tagName));
56096     if (val && callback)
56097       return callback(val) || {};
56098     return {};
56099   }
56100   function $num(node, tagName, callback) {
56101     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
56102     if (Number.isNaN(val))
56103       return void 0;
56104     if (val && callback)
56105       return callback(val) || {};
56106     return {};
56107   }
56108   function num1(node, tagName, callback) {
56109     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
56110     if (Number.isNaN(val))
56111       return void 0;
56112     if (callback)
56113       callback(val);
56114     return val;
56115   }
56116   function getMulti(node, propertyNames) {
56117     const properties = {};
56118     for (const property of propertyNames) {
56119       val1(node, property, (val) => {
56120         properties[property] = val;
56121       });
56122     }
56123     return properties;
56124   }
56125   function isElement(node) {
56126     return (node == null ? void 0 : node.nodeType) === 1;
56127   }
56128   function getExtensions(node) {
56129     let values = [];
56130     if (node === null)
56131       return values;
56132     for (const child of Array.from(node.childNodes)) {
56133       if (!isElement(child))
56134         continue;
56135       const name = abbreviateName(child.nodeName);
56136       if (name === "gpxtpx:TrackPointExtension") {
56137         values = values.concat(getExtensions(child));
56138       } else {
56139         const val = nodeVal(child);
56140         values.push([name, parseNumeric(val)]);
56141       }
56142     }
56143     return values;
56144   }
56145   function abbreviateName(name) {
56146     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
56147   }
56148   function parseNumeric(val) {
56149     const num = Number.parseFloat(val);
56150     return Number.isNaN(num) ? val : num;
56151   }
56152   function coordPair$1(node) {
56153     const ll = [
56154       Number.parseFloat(node.getAttribute("lon") || ""),
56155       Number.parseFloat(node.getAttribute("lat") || "")
56156     ];
56157     if (Number.isNaN(ll[0]) || Number.isNaN(ll[1])) {
56158       return null;
56159     }
56160     num1(node, "ele", (val) => {
56161       ll.push(val);
56162     });
56163     const time = get1(node, "time");
56164     return {
56165       coordinates: ll,
56166       time: time ? nodeVal(time) : null,
56167       extendedValues: getExtensions(get1(node, "extensions"))
56168     };
56169   }
56170   function getLineStyle(node) {
56171     return get3(node, "line", (lineStyle) => {
56172       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
56173         return { stroke: `#${color2}` };
56174       }), $num(lineStyle, "opacity", (opacity) => {
56175         return { "stroke-opacity": opacity };
56176       }), $num(lineStyle, "width", (width) => {
56177         return { "stroke-width": width * 96 / 25.4 };
56178       }));
56179       return val;
56180     });
56181   }
56182   function extractProperties(ns, node) {
56183     var _a4;
56184     const properties = getMulti(node, [
56185       "name",
56186       "cmt",
56187       "desc",
56188       "type",
56189       "time",
56190       "keywords"
56191     ]);
56192     for (const [n3, url] of ns) {
56193       for (const child of Array.from(node.getElementsByTagNameNS(url, "*"))) {
56194         properties[child.tagName.replace(":", "_")] = (_a4 = nodeVal(child)) == null ? void 0 : _a4.trim();
56195       }
56196     }
56197     const links = $2(node, "link");
56198     if (links.length) {
56199       properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
56200     }
56201     return properties;
56202   }
56203   function getPoints$1(node, pointname) {
56204     const pts = $2(node, pointname);
56205     const line = [];
56206     const times = [];
56207     const extendedValues = {};
56208     for (let i3 = 0; i3 < pts.length; i3++) {
56209       const c2 = coordPair$1(pts[i3]);
56210       if (!c2) {
56211         continue;
56212       }
56213       line.push(c2.coordinates);
56214       if (c2.time)
56215         times.push(c2.time);
56216       for (const [name, val] of c2.extendedValues) {
56217         const plural = name === "heart" ? name : `${name.replace("gpxtpx:", "")}s`;
56218         if (!extendedValues[plural]) {
56219           extendedValues[plural] = Array(pts.length).fill(null);
56220         }
56221         extendedValues[plural][i3] = val;
56222       }
56223     }
56224     if (line.length < 2)
56225       return;
56226     return {
56227       line,
56228       times,
56229       extendedValues
56230     };
56231   }
56232   function getRoute(ns, node) {
56233     const line = getPoints$1(node, "rtept");
56234     if (!line)
56235       return;
56236     return {
56237       type: "Feature",
56238       properties: Object.assign({ _gpxType: "rte" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions"))),
56239       geometry: {
56240         type: "LineString",
56241         coordinates: line.line
56242       }
56243     };
56244   }
56245   function getTrack(ns, node) {
56246     var _a4;
56247     const segments = $2(node, "trkseg");
56248     const track = [];
56249     const times = [];
56250     const extractedLines = [];
56251     for (const segment of segments) {
56252       const line = getPoints$1(segment, "trkpt");
56253       if (line) {
56254         extractedLines.push(line);
56255         if ((_a4 = line.times) == null ? void 0 : _a4.length)
56256           times.push(line.times);
56257       }
56258     }
56259     if (extractedLines.length === 0)
56260       return null;
56261     const multi = extractedLines.length > 1;
56262     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions")), times.length ? {
56263       coordinateProperties: {
56264         times: multi ? times : times[0]
56265       }
56266     } : {});
56267     for (let i3 = 0; i3 < extractedLines.length; i3++) {
56268       const line = extractedLines[i3];
56269       track.push(line.line);
56270       if (!properties.coordinateProperties) {
56271         properties.coordinateProperties = {};
56272       }
56273       const props = properties.coordinateProperties;
56274       for (const [name, val] of Object.entries(line.extendedValues)) {
56275         if (multi) {
56276           if (!props[name]) {
56277             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
56278           }
56279           props[name][i3] = val;
56280         } else {
56281           props[name] = val;
56282         }
56283       }
56284     }
56285     return {
56286       type: "Feature",
56287       properties,
56288       geometry: multi ? {
56289         type: "MultiLineString",
56290         coordinates: track
56291       } : {
56292         type: "LineString",
56293         coordinates: track[0]
56294       }
56295     };
56296   }
56297   function getPoint(ns, node) {
56298     const properties = Object.assign(extractProperties(ns, node), getMulti(node, ["sym"]));
56299     const pair3 = coordPair$1(node);
56300     if (!pair3)
56301       return null;
56302     return {
56303       type: "Feature",
56304       properties,
56305       geometry: {
56306         type: "Point",
56307         coordinates: pair3.coordinates
56308       }
56309     };
56310   }
56311   function* gpxGen(node) {
56312     var _a4, _b2;
56313     const n3 = node;
56314     const GPXX = "gpxx";
56315     const GPXX_URI = "http://www.garmin.com/xmlschemas/GpxExtensions/v3";
56316     const ns = [[GPXX, GPXX_URI]];
56317     const attrs = (_a4 = n3.getElementsByTagName("gpx")[0]) == null ? void 0 : _a4.attributes;
56318     if (attrs) {
56319       for (const attr of Array.from(attrs)) {
56320         if (((_b2 = attr.name) == null ? void 0 : _b2.startsWith("xmlns:")) && attr.value !== GPXX_URI) {
56321           ns.push([attr.name, attr.value]);
56322         }
56323       }
56324     }
56325     for (const track of $2(n3, "trk")) {
56326       const feature3 = getTrack(ns, track);
56327       if (feature3)
56328         yield feature3;
56329     }
56330     for (const route of $2(n3, "rte")) {
56331       const feature3 = getRoute(ns, route);
56332       if (feature3)
56333         yield feature3;
56334     }
56335     for (const waypoint of $2(n3, "wpt")) {
56336       const point = getPoint(ns, waypoint);
56337       if (point)
56338         yield point;
56339     }
56340   }
56341   function gpx(node) {
56342     return {
56343       type: "FeatureCollection",
56344       features: Array.from(gpxGen(node))
56345     };
56346   }
56347   function fixColor(v3, prefix) {
56348     const properties = {};
56349     const colorProp = prefix === "stroke" || prefix === "fill" ? prefix : `${prefix}-color`;
56350     if (v3[0] === "#") {
56351       v3 = v3.substring(1);
56352     }
56353     if (v3.length === 6 || v3.length === 3) {
56354       properties[colorProp] = `#${v3}`;
56355     } else if (v3.length === 8) {
56356       properties[`${prefix}-opacity`] = Number.parseInt(v3.substring(0, 2), 16) / 255;
56357       properties[colorProp] = `#${v3.substring(6, 8)}${v3.substring(4, 6)}${v3.substring(2, 4)}`;
56358     }
56359     return properties;
56360   }
56361   function numericProperty(node, source, target) {
56362     const properties = {};
56363     num1(node, source, (val) => {
56364       properties[target] = val;
56365     });
56366     return properties;
56367   }
56368   function getColor(node, output) {
56369     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
56370   }
56371   function extractIconHref(node) {
56372     return get3(node, "Icon", (icon2, properties) => {
56373       val1(icon2, "href", (href) => {
56374         properties.icon = href;
56375       });
56376       return properties;
56377     });
56378   }
56379   function extractIcon(node) {
56380     return get3(node, "IconStyle", (iconStyle) => {
56381       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
56382         const left = Number.parseFloat(hotspot.getAttribute("x") || "");
56383         const top = Number.parseFloat(hotspot.getAttribute("y") || "");
56384         const xunits = hotspot.getAttribute("xunits") || "";
56385         const yunits = hotspot.getAttribute("yunits") || "";
56386         if (!Number.isNaN(left) && !Number.isNaN(top))
56387           return {
56388             "icon-offset": [left, top],
56389             "icon-offset-units": [xunits, yunits]
56390           };
56391         return {};
56392       }), extractIconHref(iconStyle));
56393     });
56394   }
56395   function extractLabel(node) {
56396     return get3(node, "LabelStyle", (labelStyle) => {
56397       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
56398     });
56399   }
56400   function extractLine(node) {
56401     return get3(node, "LineStyle", (lineStyle) => {
56402       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
56403     });
56404   }
56405   function extractPoly(node) {
56406     return get3(node, "PolyStyle", (polyStyle, properties) => {
56407       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
56408         if (fill === "0")
56409           return { "fill-opacity": 0 };
56410       }), val1(polyStyle, "outline", (outline) => {
56411         if (outline === "0")
56412           return { "stroke-opacity": 0 };
56413       }));
56414     });
56415   }
56416   function extractStyle(node) {
56417     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
56418   }
56419   function coord1(value) {
56420     return value.replace(removeSpace, "").split(",").map(Number.parseFloat).filter((num) => !Number.isNaN(num)).slice(0, 3);
56421   }
56422   function coord(value) {
56423     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
56424       return coord2.length >= 2;
56425     });
56426   }
56427   function gxCoords(node) {
56428     let elems = $2(node, "coord");
56429     if (elems.length === 0) {
56430       elems = $ns(node, "coord", "*");
56431     }
56432     const coordinates = elems.map((elem) => {
56433       return nodeVal(elem).split(" ").map(Number.parseFloat);
56434     });
56435     if (coordinates.length === 0) {
56436       return null;
56437     }
56438     return {
56439       geometry: coordinates.length > 2 ? {
56440         type: "LineString",
56441         coordinates
56442       } : {
56443         type: "Point",
56444         coordinates: coordinates[0]
56445       },
56446       times: $2(node, "when").map((elem) => nodeVal(elem))
56447     };
56448   }
56449   function fixRing(ring) {
56450     if (ring.length === 0)
56451       return ring;
56452     const first = ring[0];
56453     const last2 = ring[ring.length - 1];
56454     let equal = true;
56455     for (let i3 = 0; i3 < Math.max(first.length, last2.length); i3++) {
56456       if (first[i3] !== last2[i3]) {
56457         equal = false;
56458         break;
56459       }
56460     }
56461     if (!equal) {
56462       return ring.concat([ring[0]]);
56463     }
56464     return ring;
56465   }
56466   function getCoordinates(node) {
56467     return nodeVal(get1(node, "coordinates"));
56468   }
56469   function getGeometry(node) {
56470     let geometries = [];
56471     let coordTimes = [];
56472     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
56473       const child = node.childNodes.item(i3);
56474       if (isElement(child)) {
56475         switch (child.tagName) {
56476           case "MultiGeometry":
56477           case "MultiTrack":
56478           case "gx:MultiTrack": {
56479             const childGeometries = getGeometry(child);
56480             geometries = geometries.concat(childGeometries.geometries);
56481             coordTimes = coordTimes.concat(childGeometries.coordTimes);
56482             break;
56483           }
56484           case "Point": {
56485             const coordinates = coord1(getCoordinates(child));
56486             if (coordinates.length >= 2) {
56487               geometries.push({
56488                 type: "Point",
56489                 coordinates
56490               });
56491             }
56492             break;
56493           }
56494           case "LinearRing":
56495           case "LineString": {
56496             const coordinates = coord(getCoordinates(child));
56497             if (coordinates.length >= 2) {
56498               geometries.push({
56499                 type: "LineString",
56500                 coordinates
56501               });
56502             }
56503             break;
56504           }
56505           case "Polygon": {
56506             const coords = [];
56507             for (const linearRing of $2(child, "LinearRing")) {
56508               const ring = fixRing(coord(getCoordinates(linearRing)));
56509               if (ring.length >= 4) {
56510                 coords.push(ring);
56511               }
56512             }
56513             if (coords.length) {
56514               geometries.push({
56515                 type: "Polygon",
56516                 coordinates: coords
56517               });
56518             }
56519             break;
56520           }
56521           case "Track":
56522           case "gx:Track": {
56523             const gx = gxCoords(child);
56524             if (!gx)
56525               break;
56526             const { times, geometry } = gx;
56527             geometries.push(geometry);
56528             if (times.length)
56529               coordTimes.push(times);
56530             break;
56531           }
56532         }
56533       }
56534     }
56535     return {
56536       geometries,
56537       coordTimes
56538     };
56539   }
56540   function extractExtendedData(node, schema) {
56541     return get3(node, "ExtendedData", (extendedData, properties) => {
56542       for (const data of $2(extendedData, "Data")) {
56543         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
56544       }
56545       for (const simpleData of $2(extendedData, "SimpleData")) {
56546         const name = simpleData.getAttribute("name") || "";
56547         const typeConverter = schema[name] || typeConverters.string;
56548         properties[name] = typeConverter(nodeVal(simpleData));
56549       }
56550       return properties;
56551     });
56552   }
56553   function getMaybeHTMLDescription(node) {
56554     const descriptionNode = get1(node, "description");
56555     for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
56556       if (c2.nodeType === 4) {
56557         return {
56558           description: {
56559             "@type": "html",
56560             value: nodeVal(c2)
56561           }
56562         };
56563       }
56564     }
56565     return {};
56566   }
56567   function extractTimeSpan(node) {
56568     return get3(node, "TimeSpan", (timeSpan) => {
56569       return {
56570         timespan: {
56571           begin: nodeVal(get1(timeSpan, "begin")),
56572           end: nodeVal(get1(timeSpan, "end"))
56573         }
56574       };
56575     });
56576   }
56577   function extractTimeStamp(node) {
56578     return get3(node, "TimeStamp", (timeStamp) => {
56579       return { timestamp: nodeVal(get1(timeStamp, "when")) };
56580     });
56581   }
56582   function extractCascadedStyle(node, styleMap) {
56583     return val1(node, "styleUrl", (styleUrl) => {
56584       styleUrl = normalizeId(styleUrl);
56585       if (styleMap[styleUrl]) {
56586         return Object.assign({ styleUrl }, styleMap[styleUrl]);
56587       }
56588       return { styleUrl };
56589     });
56590   }
56591   function processAltitudeMode(mode) {
56592     switch (mode == null ? void 0 : mode.textContent) {
56593       case AltitudeMode.ABSOLUTE:
56594         return AltitudeMode.ABSOLUTE;
56595       case AltitudeMode.CLAMP_TO_GROUND:
56596         return AltitudeMode.CLAMP_TO_GROUND;
56597       case AltitudeMode.CLAMP_TO_SEAFLOOR:
56598         return AltitudeMode.CLAMP_TO_SEAFLOOR;
56599       case AltitudeMode.RELATIVE_TO_GROUND:
56600         return AltitudeMode.RELATIVE_TO_GROUND;
56601       case AltitudeMode.RELATIVE_TO_SEAFLOOR:
56602         return AltitudeMode.RELATIVE_TO_SEAFLOOR;
56603     }
56604     return null;
56605   }
56606   function getGroundOverlayBox(node) {
56607     const latLonQuad = get1(node, "gx:LatLonQuad");
56608     if (latLonQuad) {
56609       const ring = fixRing(coord(getCoordinates(node)));
56610       return {
56611         geometry: {
56612           type: "Polygon",
56613           coordinates: [ring]
56614         }
56615       };
56616     }
56617     return getLatLonBox(node);
56618   }
56619   function rotateBox(bbox2, coordinates, rotation) {
56620     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
56621     return [
56622       coordinates[0].map((coordinate) => {
56623         const dy = coordinate[1] - center[1];
56624         const dx = coordinate[0] - center[0];
56625         const distance = Math.sqrt(dy ** 2 + dx ** 2);
56626         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
56627         return [
56628           center[0] + Math.cos(angle2) * distance,
56629           center[1] + Math.sin(angle2) * distance
56630         ];
56631       })
56632     ];
56633   }
56634   function getLatLonBox(node) {
56635     const latLonBox = get1(node, "LatLonBox");
56636     if (latLonBox) {
56637       const north = num1(latLonBox, "north");
56638       const west = num1(latLonBox, "west");
56639       const east = num1(latLonBox, "east");
56640       const south = num1(latLonBox, "south");
56641       const rotation = num1(latLonBox, "rotation");
56642       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
56643         const bbox2 = [west, south, east, north];
56644         let coordinates = [
56645           [
56646             [west, north],
56647             // top left
56648             [east, north],
56649             // top right
56650             [east, south],
56651             // top right
56652             [west, south],
56653             // bottom left
56654             [west, north]
56655             // top left (again)
56656           ]
56657         ];
56658         if (typeof rotation === "number") {
56659           coordinates = rotateBox(bbox2, coordinates, rotation);
56660         }
56661         return {
56662           bbox: bbox2,
56663           geometry: {
56664             type: "Polygon",
56665             coordinates
56666           }
56667         };
56668       }
56669     }
56670     return null;
56671   }
56672   function getGroundOverlay(node, styleMap, schema, options) {
56673     var _a4;
56674     const box = getGroundOverlayBox(node);
56675     const geometry = (box == null ? void 0 : box.geometry) || null;
56676     if (!geometry && options.skipNullGeometry) {
56677       return null;
56678     }
56679     const feature3 = {
56680       type: "Feature",
56681       geometry,
56682       properties: Object.assign(
56683         /**
56684          * Related to
56685          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
56686          */
56687         { "@geometry-type": "groundoverlay" },
56688         getMulti(node, [
56689           "name",
56690           "address",
56691           "visibility",
56692           "open",
56693           "phoneNumber",
56694           "description"
56695         ]),
56696         getMaybeHTMLDescription(node),
56697         extractCascadedStyle(node, styleMap),
56698         extractStyle(node),
56699         extractIconHref(node),
56700         extractExtendedData(node, schema),
56701         extractTimeSpan(node),
56702         extractTimeStamp(node)
56703       )
56704     };
56705     if (box == null ? void 0 : box.bbox) {
56706       feature3.bbox = box.bbox;
56707     }
56708     if (((_a4 = feature3.properties) == null ? void 0 : _a4.visibility) !== void 0) {
56709       feature3.properties.visibility = feature3.properties.visibility !== "0";
56710     }
56711     const id2 = node.getAttribute("id");
56712     if (id2 !== null && id2 !== "")
56713       feature3.id = id2;
56714     return feature3;
56715   }
56716   function getNetworkLinkRegion(node) {
56717     const region = get1(node, "Region");
56718     if (region) {
56719       return {
56720         coordinateBox: getLatLonAltBox(region),
56721         lod: getLod(node)
56722       };
56723     }
56724     return null;
56725   }
56726   function getLod(node) {
56727     var _a4, _b2, _c, _d;
56728     const lod = get1(node, "Lod");
56729     if (lod) {
56730       return [
56731         (_a4 = num1(lod, "minLodPixels")) != null ? _a4 : -1,
56732         (_b2 = num1(lod, "maxLodPixels")) != null ? _b2 : -1,
56733         (_c = num1(lod, "minFadeExtent")) != null ? _c : null,
56734         (_d = num1(lod, "maxFadeExtent")) != null ? _d : null
56735       ];
56736     }
56737     return null;
56738   }
56739   function getLatLonAltBox(node) {
56740     const latLonAltBox = get1(node, "LatLonAltBox");
56741     if (latLonAltBox) {
56742       const north = num1(latLonAltBox, "north");
56743       const west = num1(latLonAltBox, "west");
56744       const east = num1(latLonAltBox, "east");
56745       const south = num1(latLonAltBox, "south");
56746       const altitudeMode = processAltitudeMode(get1(latLonAltBox, "altitudeMode") || get1(latLonAltBox, "gx:altitudeMode"));
56747       if (altitudeMode) {
56748         console.debug("Encountered an unsupported feature of KML for togeojson: please contact developers for support of altitude mode.");
56749       }
56750       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
56751         const bbox2 = [west, south, east, north];
56752         const coordinates = [
56753           [
56754             [west, north],
56755             // top left
56756             [east, north],
56757             // top right
56758             [east, south],
56759             // top right
56760             [west, south],
56761             // bottom left
56762             [west, north]
56763             // top left (again)
56764           ]
56765         ];
56766         return {
56767           bbox: bbox2,
56768           geometry: {
56769             type: "Polygon",
56770             coordinates
56771           }
56772         };
56773       }
56774     }
56775     return null;
56776   }
56777   function getLinkObject(node) {
56778     const linkObj = get1(node, "Link");
56779     if (linkObj) {
56780       return getMulti(linkObj, [
56781         "href",
56782         "refreshMode",
56783         "refreshInterval",
56784         "viewRefreshMode",
56785         "viewRefreshTime",
56786         "viewBoundScale",
56787         "viewFormat",
56788         "httpQuery"
56789       ]);
56790     }
56791     return {};
56792   }
56793   function getNetworkLink(node, styleMap, schema, options) {
56794     var _a4, _b2, _c;
56795     const box = getNetworkLinkRegion(node);
56796     const geometry = ((_a4 = box == null ? void 0 : box.coordinateBox) == null ? void 0 : _a4.geometry) || null;
56797     if (!geometry && options.skipNullGeometry) {
56798       return null;
56799     }
56800     const feature3 = {
56801       type: "Feature",
56802       geometry,
56803       properties: Object.assign(
56804         /**
56805          * Related to
56806          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
56807          */
56808         { "@geometry-type": "networklink" },
56809         getMulti(node, [
56810           "name",
56811           "address",
56812           "visibility",
56813           "open",
56814           "phoneNumber",
56815           "styleUrl",
56816           "refreshVisibility",
56817           "flyToView",
56818           "description"
56819         ]),
56820         getMaybeHTMLDescription(node),
56821         extractCascadedStyle(node, styleMap),
56822         extractStyle(node),
56823         extractIconHref(node),
56824         extractExtendedData(node, schema),
56825         extractTimeSpan(node),
56826         extractTimeStamp(node),
56827         getLinkObject(node),
56828         (box == null ? void 0 : box.lod) ? { lod: box.lod } : {}
56829       )
56830     };
56831     if ((_b2 = box == null ? void 0 : box.coordinateBox) == null ? void 0 : _b2.bbox) {
56832       feature3.bbox = box.coordinateBox.bbox;
56833     }
56834     if (((_c = feature3.properties) == null ? void 0 : _c.visibility) !== void 0) {
56835       feature3.properties.visibility = feature3.properties.visibility !== "0";
56836     }
56837     const id2 = node.getAttribute("id");
56838     if (id2 !== null && id2 !== "")
56839       feature3.id = id2;
56840     return feature3;
56841   }
56842   function geometryListToGeometry(geometries) {
56843     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
56844       type: "GeometryCollection",
56845       geometries
56846     };
56847   }
56848   function getPlacemark(node, styleMap, schema, options) {
56849     var _a4;
56850     const { coordTimes, geometries } = getGeometry(node);
56851     const geometry = geometryListToGeometry(geometries);
56852     if (!geometry && options.skipNullGeometry) {
56853       return null;
56854     }
56855     const feature3 = {
56856       type: "Feature",
56857       geometry,
56858       properties: Object.assign(getMulti(node, [
56859         "name",
56860         "address",
56861         "visibility",
56862         "open",
56863         "phoneNumber",
56864         "description"
56865       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
56866         coordinateProperties: {
56867           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
56868         }
56869       } : {})
56870     };
56871     if (((_a4 = feature3.properties) == null ? void 0 : _a4.visibility) !== void 0) {
56872       feature3.properties.visibility = feature3.properties.visibility !== "0";
56873     }
56874     const id2 = node.getAttribute("id");
56875     if (id2 !== null && id2 !== "")
56876       feature3.id = id2;
56877     return feature3;
56878   }
56879   function getStyleId(style) {
56880     let id2 = style.getAttribute("id");
56881     const parentNode = style.parentNode;
56882     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
56883       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
56884     }
56885     return normalizeId(id2 || "");
56886   }
56887   function buildStyleMap(node) {
56888     const styleMap = {};
56889     for (const style of $2(node, "Style")) {
56890       styleMap[getStyleId(style)] = extractStyle(style);
56891     }
56892     for (const map2 of $2(node, "StyleMap")) {
56893       const id2 = normalizeId(map2.getAttribute("id") || "");
56894       val1(map2, "styleUrl", (styleUrl) => {
56895         styleUrl = normalizeId(styleUrl);
56896         if (styleMap[styleUrl]) {
56897           styleMap[id2] = styleMap[styleUrl];
56898         }
56899       });
56900     }
56901     return styleMap;
56902   }
56903   function buildSchema(node) {
56904     const schema = {};
56905     for (const field of $2(node, "SimpleField")) {
56906       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters.string;
56907     }
56908     return schema;
56909   }
56910   function* kmlGen(node, options = {
56911     skipNullGeometry: false
56912   }) {
56913     const n3 = node;
56914     const styleMap = buildStyleMap(n3);
56915     const schema = buildSchema(n3);
56916     for (const placemark of $2(n3, "Placemark")) {
56917       const feature3 = getPlacemark(placemark, styleMap, schema, options);
56918       if (feature3)
56919         yield feature3;
56920     }
56921     for (const groundOverlay of $2(n3, "GroundOverlay")) {
56922       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options);
56923       if (feature3)
56924         yield feature3;
56925     }
56926     for (const networkLink of $2(n3, "NetworkLink")) {
56927       const feature3 = getNetworkLink(networkLink, styleMap, schema, options);
56928       if (feature3)
56929         yield feature3;
56930     }
56931   }
56932   function kml(node, options = {
56933     skipNullGeometry: false
56934   }) {
56935     return {
56936       type: "FeatureCollection",
56937       features: Array.from(kmlGen(node, options))
56938     };
56939   }
56940   var removeSpace, trimSpace, splitSpace, toNumber2, typeConverters, AltitudeMode, DEGREES_TO_RADIANS;
56941   var init_togeojson_es = __esm({
56942     "node_modules/@tmcw/togeojson/dist/togeojson.es.mjs"() {
56943       removeSpace = /\s*/g;
56944       trimSpace = /^\s*|\s*$/g;
56945       splitSpace = /\s+/;
56946       toNumber2 = (x2) => Number(x2);
56947       typeConverters = {
56948         string: (x2) => x2,
56949         int: toNumber2,
56950         uint: toNumber2,
56951         short: toNumber2,
56952         ushort: toNumber2,
56953         float: toNumber2,
56954         double: toNumber2,
56955         bool: (x2) => Boolean(x2)
56956       };
56957       (function(AltitudeMode2) {
56958         AltitudeMode2["ABSOLUTE"] = "absolute";
56959         AltitudeMode2["RELATIVE_TO_GROUND"] = "relativeToGround";
56960         AltitudeMode2["CLAMP_TO_GROUND"] = "clampToGround";
56961         AltitudeMode2["CLAMP_TO_SEAFLOOR"] = "clampToSeaFloor";
56962         AltitudeMode2["RELATIVE_TO_SEAFLOOR"] = "relativeToSeaFloor";
56963       })(AltitudeMode || (AltitudeMode = {}));
56964       DEGREES_TO_RADIANS = Math.PI / 180;
56965     }
56966   });
56967
56968   // modules/svg/data.js
56969   var data_exports = {};
56970   __export(data_exports, {
56971     svgData: () => svgData
56972   });
56973   function svgData(projection2, context, dispatch14) {
56974     var throttledRedraw = throttle_default(function() {
56975       dispatch14.call("change");
56976     }, 1e3);
56977     var _showLabels = true;
56978     var detected = utilDetect();
56979     var layer = select_default2(null);
56980     var _vtService;
56981     var _fileList;
56982     var _template;
56983     var _src;
56984     const supportedFormats = [
56985       ".gpx",
56986       ".kml",
56987       ".geojson",
56988       ".json"
56989     ];
56990     function init2() {
56991       if (_initialized) return;
56992       _geojson = {};
56993       _enabled = true;
56994       function over(d3_event) {
56995         d3_event.stopPropagation();
56996         d3_event.preventDefault();
56997         d3_event.dataTransfer.dropEffect = "copy";
56998       }
56999       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
57000         d3_event.stopPropagation();
57001         d3_event.preventDefault();
57002         if (!detected.filedrop) return;
57003         var f2 = d3_event.dataTransfer.files[0];
57004         var extension = getExtension(f2.name);
57005         if (!supportedFormats.includes(extension)) return;
57006         drawData.fileList(d3_event.dataTransfer.files);
57007       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
57008       _initialized = true;
57009     }
57010     function getService() {
57011       if (services.vectorTile && !_vtService) {
57012         _vtService = services.vectorTile;
57013         _vtService.event.on("loadedData", throttledRedraw);
57014       } else if (!services.vectorTile && _vtService) {
57015         _vtService = null;
57016       }
57017       return _vtService;
57018     }
57019     function showLayer() {
57020       layerOn();
57021       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
57022         dispatch14.call("change");
57023       });
57024     }
57025     function hideLayer() {
57026       throttledRedraw.cancel();
57027       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
57028     }
57029     function layerOn() {
57030       layer.style("display", "block");
57031     }
57032     function layerOff() {
57033       layer.selectAll(".viewfield-group").remove();
57034       layer.style("display", "none");
57035     }
57036     function ensureIDs(gj) {
57037       if (!gj) return null;
57038       if (gj.type === "FeatureCollection") {
57039         for (var i3 = 0; i3 < gj.features.length; i3++) {
57040           ensureFeatureID(gj.features[i3]);
57041         }
57042       } else {
57043         ensureFeatureID(gj);
57044       }
57045       return gj;
57046     }
57047     function ensureFeatureID(feature3) {
57048       if (!feature3) return;
57049       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
57050       return feature3;
57051     }
57052     function getFeatures(gj) {
57053       if (!gj) return [];
57054       if (gj.type === "FeatureCollection") {
57055         return gj.features;
57056       } else {
57057         return [gj];
57058       }
57059     }
57060     function featureKey(d2) {
57061       return d2.__featurehash__;
57062     }
57063     function isPolygon(d2) {
57064       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
57065     }
57066     function clipPathID(d2) {
57067       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
57068     }
57069     function featureClasses(d2) {
57070       return [
57071         "data" + d2.__featurehash__,
57072         d2.geometry.type,
57073         isPolygon(d2) ? "area" : "",
57074         d2.__layerID__ || ""
57075       ].filter(Boolean).join(" ");
57076     }
57077     function drawData(selection2) {
57078       var vtService = getService();
57079       var getPath = svgPath(projection2).geojson;
57080       var getAreaPath = svgPath(projection2, null, true).geojson;
57081       var hasData = drawData.hasData();
57082       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
57083       layer.exit().remove();
57084       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
57085       var surface = context.surface();
57086       if (!surface || surface.empty()) return;
57087       var geoData, polygonData;
57088       if (_template && vtService) {
57089         var sourceID = _template;
57090         vtService.loadTiles(sourceID, _template, projection2);
57091         geoData = vtService.data(sourceID, projection2);
57092       } else {
57093         geoData = getFeatures(_geojson);
57094       }
57095       geoData = geoData.filter(getPath);
57096       polygonData = geoData.filter(isPolygon);
57097       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
57098       clipPaths.exit().remove();
57099       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
57100       clipPathsEnter.append("path");
57101       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
57102       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
57103       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
57104         return "datagroup datagroup-" + d2;
57105       }).merge(datagroups);
57106       var pathData = {
57107         fill: polygonData,
57108         shadow: geoData,
57109         stroke: geoData
57110       };
57111       var paths = datagroups.selectAll("path").data(function(layer2) {
57112         return pathData[layer2];
57113       }, featureKey);
57114       paths.exit().remove();
57115       paths = paths.enter().append("path").attr("class", function(d2) {
57116         var datagroup = this.parentNode.__data__;
57117         return "pathdata " + datagroup + " " + featureClasses(d2);
57118       }).attr("clip-path", function(d2) {
57119         var datagroup = this.parentNode.__data__;
57120         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
57121       }).merge(paths).attr("d", function(d2) {
57122         var datagroup = this.parentNode.__data__;
57123         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
57124       });
57125       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
57126       function drawLabels(selection3, textClass, data) {
57127         var labelPath = path_default(projection2);
57128         var labelData = data.filter(function(d2) {
57129           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
57130         });
57131         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
57132         labels.exit().remove();
57133         labels = labels.enter().append("text").attr("class", function(d2) {
57134           return textClass + " " + featureClasses(d2);
57135         }).merge(labels).text(function(d2) {
57136           return d2.properties.desc || d2.properties.name;
57137         }).attr("x", function(d2) {
57138           var centroid = labelPath.centroid(d2);
57139           return centroid[0] + 11;
57140         }).attr("y", function(d2) {
57141           var centroid = labelPath.centroid(d2);
57142           return centroid[1];
57143         });
57144       }
57145     }
57146     function getExtension(fileName) {
57147       if (!fileName) return;
57148       var re4 = /\.(gpx|kml|(geo)?json|png)$/i;
57149       var match = fileName.toLowerCase().match(re4);
57150       return match && match.length && match[0];
57151     }
57152     function xmlToDom(textdata) {
57153       return new DOMParser().parseFromString(textdata, "text/xml");
57154     }
57155     function stringifyGeojsonProperties(feature3) {
57156       const properties = feature3.properties;
57157       for (const key in properties) {
57158         const property = properties[key];
57159         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
57160           properties[key] = property.toString();
57161         } else if (property === null) {
57162           properties[key] = "null";
57163         } else if (typeof property === "object") {
57164           properties[key] = JSON.stringify(property);
57165         }
57166       }
57167     }
57168     drawData.setFile = function(extension, data) {
57169       _template = null;
57170       _fileList = null;
57171       _geojson = null;
57172       _src = null;
57173       var gj;
57174       switch (extension) {
57175         case ".gpx":
57176           gj = gpx(xmlToDom(data));
57177           break;
57178         case ".kml":
57179           gj = kml(xmlToDom(data));
57180           break;
57181         case ".geojson":
57182         case ".json":
57183           gj = JSON.parse(data);
57184           if (gj.type === "FeatureCollection") {
57185             gj.features.forEach(stringifyGeojsonProperties);
57186           } else if (gj.type === "Feature") {
57187             stringifyGeojsonProperties(gj);
57188           }
57189           break;
57190       }
57191       gj = gj || {};
57192       if (Object.keys(gj).length) {
57193         _geojson = ensureIDs(gj);
57194         _src = extension + " data file";
57195         this.fitZoom();
57196       }
57197       dispatch14.call("change");
57198       return this;
57199     };
57200     drawData.showLabels = function(val) {
57201       if (!arguments.length) return _showLabels;
57202       _showLabels = val;
57203       return this;
57204     };
57205     drawData.enabled = function(val) {
57206       if (!arguments.length) return _enabled;
57207       _enabled = val;
57208       if (_enabled) {
57209         showLayer();
57210       } else {
57211         hideLayer();
57212       }
57213       dispatch14.call("change");
57214       return this;
57215     };
57216     drawData.hasData = function() {
57217       var gj = _geojson || {};
57218       return !!(_template || Object.keys(gj).length);
57219     };
57220     drawData.template = function(val, src) {
57221       if (!arguments.length) return _template;
57222       var osm = context.connection();
57223       if (osm) {
57224         var blocklists = osm.imageryBlocklists();
57225         var fail = false;
57226         var tested = 0;
57227         var regex;
57228         for (var i3 = 0; i3 < blocklists.length; i3++) {
57229           regex = blocklists[i3];
57230           fail = regex.test(val);
57231           tested++;
57232           if (fail) break;
57233         }
57234         if (!tested) {
57235           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
57236           fail = regex.test(val);
57237         }
57238       }
57239       _template = val;
57240       _fileList = null;
57241       _geojson = null;
57242       _src = src || "vectortile:" + val.split(/[?#]/)[0];
57243       dispatch14.call("change");
57244       return this;
57245     };
57246     drawData.geojson = function(gj, src) {
57247       if (!arguments.length) return _geojson;
57248       _template = null;
57249       _fileList = null;
57250       _geojson = null;
57251       _src = null;
57252       gj = gj || {};
57253       if (Object.keys(gj).length) {
57254         _geojson = ensureIDs(gj);
57255         _src = src || "unknown.geojson";
57256       }
57257       dispatch14.call("change");
57258       return this;
57259     };
57260     drawData.fileList = function(fileList) {
57261       if (!arguments.length) return _fileList;
57262       _template = null;
57263       _geojson = null;
57264       _src = null;
57265       _fileList = fileList;
57266       if (!fileList || !fileList.length) return this;
57267       var f2 = fileList[0];
57268       var extension = getExtension(f2.name);
57269       var reader = new FileReader();
57270       reader.onload = /* @__PURE__ */ function() {
57271         return function(e3) {
57272           drawData.setFile(extension, e3.target.result);
57273         };
57274       }(f2);
57275       reader.readAsText(f2);
57276       return this;
57277     };
57278     drawData.url = function(url, defaultExtension) {
57279       _template = null;
57280       _fileList = null;
57281       _geojson = null;
57282       _src = null;
57283       var testUrl = url.split(/[?#]/)[0];
57284       var extension = getExtension(testUrl) || defaultExtension;
57285       if (extension) {
57286         _template = null;
57287         text_default3(url).then(function(data) {
57288           drawData.setFile(extension, data);
57289         }).catch(function() {
57290         });
57291       } else {
57292         drawData.template(url);
57293       }
57294       return this;
57295     };
57296     drawData.getSrc = function() {
57297       return _src || "";
57298     };
57299     drawData.fitZoom = function() {
57300       var features = getFeatures(_geojson);
57301       if (!features.length) return;
57302       var map2 = context.map();
57303       var viewport = map2.trimmedExtent().polygon();
57304       var coords = features.reduce(function(coords2, feature3) {
57305         var geom = feature3.geometry;
57306         if (!geom) return coords2;
57307         var c2 = geom.coordinates;
57308         switch (geom.type) {
57309           case "Point":
57310             c2 = [c2];
57311           case "MultiPoint":
57312           case "LineString":
57313             break;
57314           case "MultiPolygon":
57315             c2 = utilArrayFlatten(c2);
57316           case "Polygon":
57317           case "MultiLineString":
57318             c2 = utilArrayFlatten(c2);
57319             break;
57320         }
57321         return utilArrayUnion(coords2, c2);
57322       }, []);
57323       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
57324         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
57325         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
57326       }
57327       return this;
57328     };
57329     init2();
57330     return drawData;
57331   }
57332   var import_fast_json_stable_stringify2, _initialized, _enabled, _geojson;
57333   var init_data2 = __esm({
57334     "modules/svg/data.js"() {
57335       "use strict";
57336       init_throttle();
57337       init_src2();
57338       init_src18();
57339       init_src5();
57340       import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
57341       init_togeojson_es();
57342       init_geo2();
57343       init_services();
57344       init_helpers();
57345       init_detect();
57346       init_util();
57347       _initialized = false;
57348       _enabled = false;
57349     }
57350   });
57351
57352   // modules/svg/debug.js
57353   var debug_exports = {};
57354   __export(debug_exports, {
57355     svgDebug: () => svgDebug
57356   });
57357   function svgDebug(projection2, context) {
57358     function drawDebug(selection2) {
57359       const showTile = context.getDebug("tile");
57360       const showCollision = context.getDebug("collision");
57361       const showImagery = context.getDebug("imagery");
57362       const showTouchTargets = context.getDebug("target");
57363       const showDownloaded = context.getDebug("downloaded");
57364       let debugData = [];
57365       if (showTile) {
57366         debugData.push({ class: "red", label: "tile" });
57367       }
57368       if (showCollision) {
57369         debugData.push({ class: "yellow", label: "collision" });
57370       }
57371       if (showImagery) {
57372         debugData.push({ class: "orange", label: "imagery" });
57373       }
57374       if (showTouchTargets) {
57375         debugData.push({ class: "pink", label: "touchTargets" });
57376       }
57377       if (showDownloaded) {
57378         debugData.push({ class: "purple", label: "downloaded" });
57379       }
57380       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
57381       legend.exit().remove();
57382       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
57383       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
57384       legendItems.exit().remove();
57385       legendItems.enter().append("span").attr("class", (d2) => `debug-legend-item ${d2.class}`).text((d2) => d2.label);
57386       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
57387       layer.exit().remove();
57388       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
57389       const extent = context.map().extent();
57390       _mainFileFetcher.get("imagery").then((d2) => {
57391         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
57392         const features = hits.map((d4) => d4.features[d4.id]);
57393         let imagery = layer.selectAll("path.debug-imagery").data(features);
57394         imagery.exit().remove();
57395         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
57396       }).catch(() => {
57397       });
57398       const osm = context.connection();
57399       let dataDownloaded = [];
57400       if (osm && showDownloaded) {
57401         const rtree = osm.caches("get").tile.rtree;
57402         dataDownloaded = rtree.all().map((bbox2) => {
57403           return {
57404             type: "Feature",
57405             properties: { id: bbox2.id },
57406             geometry: {
57407               type: "Polygon",
57408               coordinates: [[
57409                 [bbox2.minX, bbox2.minY],
57410                 [bbox2.minX, bbox2.maxY],
57411                 [bbox2.maxX, bbox2.maxY],
57412                 [bbox2.maxX, bbox2.minY],
57413                 [bbox2.minX, bbox2.minY]
57414               ]]
57415             }
57416           };
57417         });
57418       }
57419       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
57420       downloaded.exit().remove();
57421       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
57422       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
57423     }
57424     drawDebug.enabled = function() {
57425       if (!arguments.length) {
57426         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
57427       } else {
57428         return this;
57429       }
57430     };
57431     return drawDebug;
57432   }
57433   var init_debug = __esm({
57434     "modules/svg/debug.js"() {
57435       "use strict";
57436       init_file_fetcher();
57437       init_helpers();
57438     }
57439   });
57440
57441   // modules/svg/defs.js
57442   var defs_exports = {};
57443   __export(defs_exports, {
57444     svgDefs: () => svgDefs
57445   });
57446   function svgDefs(context) {
57447     var _defsSelection = select_default2(null);
57448     var _spritesheetIds = [
57449       "iD-sprite",
57450       "maki-sprite",
57451       "temaki-sprite",
57452       "fa-sprite",
57453       "roentgen-sprite",
57454       "community-sprite"
57455     ];
57456     function drawDefs(selection2) {
57457       _defsSelection = selection2.append("defs");
57458       function addOnewayMarker(name, colour) {
57459         _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");
57460       }
57461       addOnewayMarker("black", "#333");
57462       addOnewayMarker("white", "#fff");
57463       addOnewayMarker("gray", "#eee");
57464       function addSidedMarker(name, color2, offset) {
57465         _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);
57466       }
57467       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
57468       addSidedMarker("coastline", "#77dede", 1);
57469       addSidedMarker("waterway", "#77dede", 1);
57470       addSidedMarker("barrier", "#ddd", 1);
57471       addSidedMarker("man_made", "#fff", 0);
57472       _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");
57473       _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");
57474       var patterns2 = _defsSelection.selectAll("pattern").data([
57475         // pattern name, pattern image name
57476         ["beach", "dots"],
57477         ["construction", "construction"],
57478         ["cemetery", "cemetery"],
57479         ["cemetery_christian", "cemetery_christian"],
57480         ["cemetery_buddhist", "cemetery_buddhist"],
57481         ["cemetery_muslim", "cemetery_muslim"],
57482         ["cemetery_jewish", "cemetery_jewish"],
57483         ["farmland", "farmland"],
57484         ["farmyard", "farmyard"],
57485         ["forest", "forest"],
57486         ["forest_broadleaved", "forest_broadleaved"],
57487         ["forest_needleleaved", "forest_needleleaved"],
57488         ["forest_leafless", "forest_leafless"],
57489         ["golf_green", "grass"],
57490         ["grass", "grass"],
57491         ["landfill", "landfill"],
57492         ["meadow", "grass"],
57493         ["orchard", "orchard"],
57494         ["pond", "pond"],
57495         ["quarry", "quarry"],
57496         ["scrub", "bushes"],
57497         ["vineyard", "vineyard"],
57498         ["water_standing", "lines"],
57499         ["waves", "waves"],
57500         ["wetland", "wetland"],
57501         ["wetland_marsh", "wetland_marsh"],
57502         ["wetland_swamp", "wetland_swamp"],
57503         ["wetland_bog", "wetland_bog"],
57504         ["wetland_reedbed", "wetland_reedbed"]
57505       ]).enter().append("pattern").attr("id", function(d2) {
57506         return "ideditor-pattern-" + d2[0];
57507       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
57508       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
57509         return "pattern-color-" + d2[0];
57510       });
57511       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
57512         return context.imagePath("pattern/" + d2[1] + ".png");
57513       });
57514       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
57515         return "ideditor-clip-square-" + d2;
57516       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
57517         return d2;
57518       }).attr("height", function(d2) {
57519         return d2;
57520       });
57521       const filters = _defsSelection.selectAll("filter").data(["alpha-slope5"]).enter().append("filter").attr("id", (d2) => d2);
57522       const alphaSlope5 = filters.filter("#alpha-slope5").append("feComponentTransfer");
57523       alphaSlope5.append("feFuncR").attr("type", "identity");
57524       alphaSlope5.append("feFuncG").attr("type", "identity");
57525       alphaSlope5.append("feFuncB").attr("type", "identity");
57526       alphaSlope5.append("feFuncA").attr("type", "linear").attr("slope", 5);
57527       addSprites(_spritesheetIds, true);
57528     }
57529     function addSprites(ids, overrideColors) {
57530       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
57531       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
57532       spritesheets.enter().append("g").attr("class", function(d2) {
57533         return "spritesheet spritesheet-" + d2;
57534       }).each(function(d2) {
57535         var url = context.imagePath(d2 + ".svg");
57536         var node = select_default2(this).node();
57537         svg(url).then(function(svg2) {
57538           node.appendChild(
57539             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
57540           );
57541           if (overrideColors && d2 !== "iD-sprite") {
57542             select_default2(node).selectAll("path").attr("fill", "currentColor");
57543           }
57544         }).catch(function() {
57545         });
57546       });
57547       spritesheets.exit().remove();
57548     }
57549     drawDefs.addSprites = addSprites;
57550     return drawDefs;
57551   }
57552   var init_defs = __esm({
57553     "modules/svg/defs.js"() {
57554       "use strict";
57555       init_src18();
57556       init_src5();
57557       init_util();
57558     }
57559   });
57560
57561   // modules/svg/keepRight.js
57562   var keepRight_exports2 = {};
57563   __export(keepRight_exports2, {
57564     svgKeepRight: () => svgKeepRight
57565   });
57566   function svgKeepRight(projection2, context, dispatch14) {
57567     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
57568     const minZoom5 = 12;
57569     let touchLayer = select_default2(null);
57570     let drawLayer = select_default2(null);
57571     let layerVisible = false;
57572     function markerPath(selection2, klass) {
57573       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");
57574     }
57575     function getService() {
57576       if (services.keepRight && !_qaService) {
57577         _qaService = services.keepRight;
57578         _qaService.on("loaded", throttledRedraw);
57579       } else if (!services.keepRight && _qaService) {
57580         _qaService = null;
57581       }
57582       return _qaService;
57583     }
57584     function editOn() {
57585       if (!layerVisible) {
57586         layerVisible = true;
57587         drawLayer.style("display", "block");
57588       }
57589     }
57590     function editOff() {
57591       if (layerVisible) {
57592         layerVisible = false;
57593         drawLayer.style("display", "none");
57594         drawLayer.selectAll(".qaItem.keepRight").remove();
57595         touchLayer.selectAll(".qaItem.keepRight").remove();
57596       }
57597     }
57598     function layerOn() {
57599       editOn();
57600       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
57601     }
57602     function layerOff() {
57603       throttledRedraw.cancel();
57604       drawLayer.interrupt();
57605       touchLayer.selectAll(".qaItem.keepRight").remove();
57606       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
57607         editOff();
57608         dispatch14.call("change");
57609       });
57610     }
57611     function updateMarkers() {
57612       if (!layerVisible || !_layerEnabled) return;
57613       const service = getService();
57614       const selectedID = context.selectedErrorID();
57615       const data = service ? service.getItems(projection2) : [];
57616       const getTransform = svgPointTransform(projection2);
57617       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
57618       markers.exit().remove();
57619       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`);
57620       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
57621       markersEnter.append("path").call(markerPath, "shadow");
57622       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");
57623       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
57624       if (touchLayer.empty()) return;
57625       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57626       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
57627       targets.exit().remove();
57628       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);
57629       function sortY(a4, b3) {
57630         return a4.id === selectedID ? 1 : b3.id === selectedID ? -1 : a4.severity === "error" && b3.severity !== "error" ? 1 : b3.severity === "error" && a4.severity !== "error" ? -1 : b3.loc[1] - a4.loc[1];
57631       }
57632     }
57633     function drawKeepRight(selection2) {
57634       const service = getService();
57635       const surface = context.surface();
57636       if (surface && !surface.empty()) {
57637         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
57638       }
57639       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
57640       drawLayer.exit().remove();
57641       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
57642       if (_layerEnabled) {
57643         if (service && ~~context.map().zoom() >= minZoom5) {
57644           editOn();
57645           service.loadIssues(projection2);
57646           updateMarkers();
57647         } else {
57648           editOff();
57649         }
57650       }
57651     }
57652     drawKeepRight.enabled = function(val) {
57653       if (!arguments.length) return _layerEnabled;
57654       _layerEnabled = val;
57655       if (_layerEnabled) {
57656         layerOn();
57657       } else {
57658         layerOff();
57659         if (context.selectedErrorID()) {
57660           context.enter(modeBrowse(context));
57661         }
57662       }
57663       dispatch14.call("change");
57664       return this;
57665     };
57666     drawKeepRight.supported = () => !!getService();
57667     return drawKeepRight;
57668   }
57669   var _layerEnabled, _qaService;
57670   var init_keepRight2 = __esm({
57671     "modules/svg/keepRight.js"() {
57672       "use strict";
57673       init_throttle();
57674       init_src5();
57675       init_browse();
57676       init_helpers();
57677       init_services();
57678       _layerEnabled = false;
57679     }
57680   });
57681
57682   // modules/svg/geolocate.js
57683   var geolocate_exports = {};
57684   __export(geolocate_exports, {
57685     svgGeolocate: () => svgGeolocate
57686   });
57687   function svgGeolocate(projection2) {
57688     var layer = select_default2(null);
57689     var _position;
57690     function init2() {
57691       if (svgGeolocate.initialized) return;
57692       svgGeolocate.enabled = false;
57693       svgGeolocate.initialized = true;
57694     }
57695     function showLayer() {
57696       layer.style("display", "block");
57697     }
57698     function hideLayer() {
57699       layer.transition().duration(250).style("opacity", 0);
57700     }
57701     function layerOn() {
57702       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
57703     }
57704     function layerOff() {
57705       layer.style("display", "none");
57706     }
57707     function transform2(d2) {
57708       return svgPointTransform(projection2)(d2);
57709     }
57710     function accuracy(accuracy2, loc) {
57711       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
57712       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
57713     }
57714     function update() {
57715       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
57716       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
57717       groups.exit().remove();
57718       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
57719       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");
57720       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");
57721       groups.merge(pointsEnter).attr("transform", transform2);
57722       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
57723     }
57724     function drawLocation(selection2) {
57725       var enabled = svgGeolocate.enabled;
57726       layer = selection2.selectAll(".layer-geolocate").data([0]);
57727       layer.exit().remove();
57728       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
57729       layerEnter.append("g").attr("class", "geolocations");
57730       layer = layerEnter.merge(layer);
57731       if (enabled) {
57732         update();
57733       } else {
57734         layerOff();
57735       }
57736     }
57737     drawLocation.enabled = function(position, enabled) {
57738       if (!arguments.length) return svgGeolocate.enabled;
57739       _position = position;
57740       svgGeolocate.enabled = enabled;
57741       if (svgGeolocate.enabled) {
57742         showLayer();
57743         layerOn();
57744       } else {
57745         hideLayer();
57746       }
57747       return this;
57748     };
57749     init2();
57750     return drawLocation;
57751   }
57752   var init_geolocate = __esm({
57753     "modules/svg/geolocate.js"() {
57754       "use strict";
57755       init_src5();
57756       init_helpers();
57757       init_geo2();
57758     }
57759   });
57760
57761   // modules/svg/labels.js
57762   var labels_exports = {};
57763   __export(labels_exports, {
57764     isAddressPoint: () => isAddressPoint,
57765     svgLabels: () => svgLabels,
57766     textWidth: () => textWidth
57767   });
57768   function svgLabels(projection2, context) {
57769     var path = path_default(projection2);
57770     var detected = utilDetect();
57771     var baselineHack = detected.browser.toLowerCase() === "safari";
57772     var _rdrawn = new RBush();
57773     var _rskipped = new RBush();
57774     var _entitybboxes = {};
57775     const labelStack = [
57776       ["line", "aeroway", "*", 12],
57777       ["line", "highway", "motorway", 12],
57778       ["line", "highway", "trunk", 12],
57779       ["line", "highway", "primary", 12],
57780       ["line", "highway", "secondary", 12],
57781       ["line", "highway", "tertiary", 12],
57782       ["line", "highway", "*", 12],
57783       ["line", "railway", "*", 12],
57784       ["line", "waterway", "*", 12],
57785       ["area", "aeroway", "*", 12],
57786       ["area", "amenity", "*", 12],
57787       ["area", "building", "*", 12],
57788       ["area", "historic", "*", 12],
57789       ["area", "leisure", "*", 12],
57790       ["area", "man_made", "*", 12],
57791       ["area", "natural", "*", 12],
57792       ["area", "shop", "*", 12],
57793       ["area", "tourism", "*", 12],
57794       ["area", "camp_site", "*", 12],
57795       ["point", "aeroway", "*", 10],
57796       ["point", "amenity", "*", 10],
57797       ["point", "building", "*", 10],
57798       ["point", "historic", "*", 10],
57799       ["point", "leisure", "*", 10],
57800       ["point", "man_made", "*", 10],
57801       ["point", "natural", "*", 10],
57802       ["point", "shop", "*", 10],
57803       ["point", "tourism", "*", 10],
57804       ["point", "camp_site", "*", 10],
57805       ["line", "ref", "*", 12],
57806       ["area", "ref", "*", 12],
57807       ["point", "ref", "*", 10],
57808       ["line", "name", "*", 12],
57809       ["area", "name", "*", 12],
57810       ["point", "name", "*", 10],
57811       ["point", "addr:housenumber", "*", 10],
57812       ["point", "addr:housename", "*", 10]
57813     ];
57814     function shouldSkipIcon(preset) {
57815       var noIcons = ["building", "landuse", "natural"];
57816       return noIcons.some(function(s2) {
57817         return preset.id.indexOf(s2) >= 0;
57818       });
57819     }
57820     function drawLinePaths(selection2, labels, filter2, classes) {
57821       var paths = selection2.selectAll("path:not(.debug)").filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57822       paths.exit().remove();
57823       paths.enter().append("path").style("stroke-width", (d2) => d2.position["font-size"]).attr("id", (d2) => "ideditor-labelpath-" + d2.entity.id).attr("class", classes).merge(paths).attr("d", (d2) => d2.position.lineString);
57824     }
57825     function drawLineLabels(selection2, labels, filter2, classes) {
57826       var texts = selection2.selectAll("text." + classes).filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57827       texts.exit().remove();
57828       texts.enter().append("text").attr("class", (d2) => classes + " " + d2.position.classes + " " + d2.entity.id).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
57829       selection2.selectAll("text." + classes).selectAll(".textpath").filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity)).attr("startOffset", "50%").attr("xlink:href", function(d2) {
57830         return "#ideditor-labelpath-" + d2.entity.id;
57831       }).text((d2) => d2.name);
57832     }
57833     function drawPointLabels(selection2, labels, filter2, classes) {
57834       if (classes.includes("pointlabel-halo")) {
57835         labels = labels.filter((d2) => !d2.position.isAddr);
57836       }
57837       var texts = selection2.selectAll("text." + classes).filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57838       texts.exit().remove();
57839       texts.enter().append("text").attr("class", (d2) => classes + " " + d2.position.classes + " " + d2.entity.id).style("text-anchor", (d2) => d2.position.textAnchor).text((d2) => d2.name).merge(texts).attr("x", (d2) => d2.position.x).attr("y", (d2) => d2.position.y);
57840     }
57841     function drawAreaLabels(selection2, labels, filter2, classes) {
57842       labels = labels.filter(hasText);
57843       drawPointLabels(selection2, labels, filter2, classes);
57844       function hasText(d2) {
57845         return d2.position.hasOwnProperty("x") && d2.position.hasOwnProperty("y");
57846       }
57847     }
57848     function drawAreaIcons(selection2, labels, filter2, classes) {
57849       var icons = selection2.selectAll("use." + classes).filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57850       icons.exit().remove();
57851       icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", (d2) => d2.position.transform).attr("xlink:href", function(d2) {
57852         var preset = _mainPresetIndex.match(d2.entity, context.graph());
57853         var picon = preset && preset.icon;
57854         return picon ? "#" + picon : "";
57855       });
57856     }
57857     function drawCollisionBoxes(selection2, rtree, which) {
57858       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
57859       var gj = [];
57860       if (context.getDebug("collision")) {
57861         gj = rtree.all().map(function(d2) {
57862           return { type: "Polygon", coordinates: [[
57863             [d2.minX, d2.minY],
57864             [d2.maxX, d2.minY],
57865             [d2.maxX, d2.maxY],
57866             [d2.minX, d2.maxY],
57867             [d2.minX, d2.minY]
57868           ]] };
57869         });
57870       }
57871       var boxes = selection2.selectAll("." + which).data(gj);
57872       boxes.exit().remove();
57873       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
57874     }
57875     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
57876       var wireframe = context.surface().classed("fill-wireframe");
57877       var zoom = geoScaleToZoom(projection2.scale());
57878       var labelable = [];
57879       var renderNodeAs = {};
57880       var i3, j3, k3, entity, geometry;
57881       for (i3 = 0; i3 < labelStack.length; i3++) {
57882         labelable.push([]);
57883       }
57884       if (fullRedraw) {
57885         _rdrawn.clear();
57886         _rskipped.clear();
57887         _entitybboxes = {};
57888       } else {
57889         for (i3 = 0; i3 < entities.length; i3++) {
57890           entity = entities[i3];
57891           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
57892           for (j3 = 0; j3 < toRemove.length; j3++) {
57893             _rdrawn.remove(toRemove[j3]);
57894             _rskipped.remove(toRemove[j3]);
57895           }
57896         }
57897       }
57898       for (i3 = 0; i3 < entities.length; i3++) {
57899         entity = entities[i3];
57900         geometry = entity.geometry(graph);
57901         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
57902           const isAddr = isAddressPoint(entity.tags);
57903           var hasDirections = entity.directions(graph, projection2).length;
57904           var markerPadding = 0;
57905           if (wireframe) {
57906             renderNodeAs[entity.id] = { geometry: "vertex", isAddr };
57907           } else if (geometry === "vertex") {
57908             renderNodeAs[entity.id] = { geometry: "vertex", isAddr };
57909           } else if (zoom >= 18 && hasDirections) {
57910             renderNodeAs[entity.id] = { geometry: "vertex", isAddr };
57911           } else {
57912             renderNodeAs[entity.id] = { geometry: "point", isAddr };
57913             markerPadding = 20;
57914           }
57915           if (isAddr) {
57916             undoInsert(entity.id + "P");
57917           } else {
57918             var coord2 = projection2(entity.loc);
57919             var nodePadding = 10;
57920             var bbox2 = {
57921               minX: coord2[0] - nodePadding,
57922               minY: coord2[1] - nodePadding - markerPadding,
57923               maxX: coord2[0] + nodePadding,
57924               maxY: coord2[1] + nodePadding
57925             };
57926             doInsert(bbox2, entity.id + "P");
57927           }
57928         }
57929         if (geometry === "vertex") {
57930           geometry = "point";
57931         }
57932         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
57933         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
57934         if (!icon2 && !utilDisplayName(entity)) continue;
57935         for (k3 = 0; k3 < labelStack.length; k3++) {
57936           var matchGeom = labelStack[k3][0];
57937           var matchKey = labelStack[k3][1];
57938           var matchVal = labelStack[k3][2];
57939           var hasVal = entity.tags[matchKey];
57940           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
57941             labelable[k3].push(entity);
57942             break;
57943           }
57944         }
57945       }
57946       var labelled = {
57947         point: [],
57948         line: [],
57949         area: []
57950       };
57951       for (k3 = 0; k3 < labelable.length; k3++) {
57952         var fontSize = labelStack[k3][3];
57953         for (i3 = 0; i3 < labelable[k3].length; i3++) {
57954           entity = labelable[k3][i3];
57955           geometry = entity.geometry(graph);
57956           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
57957           var name = getName(entity);
57958           var width = name && textWidth(name, fontSize, selection2.select("g.layer-osm.labels").node());
57959           var p2 = null;
57960           if (geometry === "point" || geometry === "vertex") {
57961             if (wireframe) continue;
57962             var renderAs = renderNodeAs[entity.id];
57963             if (renderAs.geometry === "vertex" && zoom < 17) continue;
57964             while (renderAs.isAddr && width > 36) {
57965               name = `${name.substring(0, name.replace(/…$/, "").length - 1)}\u2026`;
57966               width = textWidth(name, fontSize, selection2.select("g.layer-osm.labels").node());
57967             }
57968             p2 = getPointLabel(entity, width, fontSize, renderAs);
57969           } else if (geometry === "line") {
57970             p2 = getLineLabel(entity, width, fontSize);
57971           } else if (geometry === "area") {
57972             p2 = getAreaLabel(entity, width, fontSize);
57973           }
57974           if (p2) {
57975             if (geometry === "vertex") {
57976               geometry = "point";
57977             }
57978             p2.classes = geometry + " tag-" + labelStack[k3][1];
57979             labelled[geometry].push({
57980               entity,
57981               name,
57982               position: p2
57983             });
57984           }
57985         }
57986       }
57987       function isInterestingVertex(entity2) {
57988         var selectedIDs = context.selectedIDs();
57989         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent2) {
57990           return selectedIDs.indexOf(parent2.id) !== -1;
57991         });
57992       }
57993       function getPointLabel(entity2, width2, height, style) {
57994         var y2 = style.geometry === "point" ? -12 : 0;
57995         var pointOffsets = {
57996           ltr: [15, y2, "start"],
57997           rtl: [-15, y2, "end"]
57998         };
57999         const isAddrMarker = style.isAddr && style.geometry !== "vertex";
58000         var textDirection = _mainLocalizer.textDirection();
58001         var coord3 = projection2(entity2.loc);
58002         var textPadding = 2;
58003         var offset = pointOffsets[textDirection];
58004         if (isAddrMarker) offset = [0, 1, "middle"];
58005         var p3 = {
58006           height,
58007           width: width2,
58008           x: coord3[0] + offset[0],
58009           y: coord3[1] + offset[1],
58010           textAnchor: offset[2]
58011         };
58012         let bbox3;
58013         if (isAddrMarker) {
58014           bbox3 = {
58015             minX: p3.x - width2 / 2 - textPadding,
58016             minY: p3.y - height / 2 - textPadding,
58017             maxX: p3.x + width2 / 2 + textPadding,
58018             maxY: p3.y + height / 2 + textPadding
58019           };
58020         } else if (textDirection === "rtl") {
58021           bbox3 = {
58022             minX: p3.x - width2 - textPadding,
58023             minY: p3.y - height / 2 - textPadding,
58024             maxX: p3.x + textPadding,
58025             maxY: p3.y + height / 2 + textPadding
58026           };
58027         } else {
58028           bbox3 = {
58029             minX: p3.x - textPadding,
58030             minY: p3.y - height / 2 - textPadding,
58031             maxX: p3.x + width2 + textPadding,
58032             maxY: p3.y + height / 2 + textPadding
58033           };
58034         }
58035         if (tryInsert([bbox3], entity2.id, true)) {
58036           return p3;
58037         }
58038       }
58039       function getLineLabel(entity2, width2, height) {
58040         var viewport = geoExtent(context.projection.clipExtent()).polygon();
58041         var points = graph.childNodes(entity2).map(function(node) {
58042           return projection2(node.loc);
58043         });
58044         var length2 = geoPathLength(points);
58045         if (length2 < width2 + 20) return;
58046         var lineOffsets = [
58047           50,
58048           45,
58049           55,
58050           40,
58051           60,
58052           35,
58053           65,
58054           30,
58055           70,
58056           25,
58057           75,
58058           20,
58059           80,
58060           15,
58061           95,
58062           10,
58063           90,
58064           5,
58065           95
58066         ];
58067         var padding = 3;
58068         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
58069           var offset = lineOffsets[i4];
58070           var middle = offset / 100 * length2;
58071           var start2 = middle - width2 / 2;
58072           if (start2 < 0 || start2 + width2 > length2) continue;
58073           var sub = subpath(points, start2, start2 + width2);
58074           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
58075             continue;
58076           }
58077           var isReverse = reverse(sub);
58078           if (isReverse) {
58079             sub = sub.reverse();
58080           }
58081           var bboxes = [];
58082           var boxsize = (height + 2) / 2;
58083           for (var j4 = 0; j4 < sub.length - 1; j4++) {
58084             var a4 = sub[j4];
58085             var b3 = sub[j4 + 1];
58086             var num = Math.max(1, Math.floor(geoVecLength(a4, b3) / boxsize / 2));
58087             for (var box = 0; box < num; box++) {
58088               var p3 = geoVecInterp(a4, b3, box / num);
58089               var x05 = p3[0] - boxsize - padding;
58090               var y05 = p3[1] - boxsize - padding;
58091               var x12 = p3[0] + boxsize + padding;
58092               var y12 = p3[1] + boxsize + padding;
58093               bboxes.push({
58094                 minX: Math.min(x05, x12),
58095                 minY: Math.min(y05, y12),
58096                 maxX: Math.max(x05, x12),
58097                 maxY: Math.max(y05, y12)
58098               });
58099             }
58100           }
58101           if (tryInsert(bboxes, entity2.id, false)) {
58102             return {
58103               "font-size": height + 2,
58104               lineString: lineString2(sub),
58105               startOffset: offset + "%"
58106             };
58107           }
58108         }
58109         function reverse(p4) {
58110           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
58111           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
58112         }
58113         function lineString2(points2) {
58114           return "M" + points2.join("L");
58115         }
58116         function subpath(points2, from, to) {
58117           var sofar = 0;
58118           var start3, end, i0, i1;
58119           for (var i5 = 0; i5 < points2.length - 1; i5++) {
58120             var a5 = points2[i5];
58121             var b4 = points2[i5 + 1];
58122             var current = geoVecLength(a5, b4);
58123             var portion;
58124             if (!start3 && sofar + current >= from) {
58125               portion = (from - sofar) / current;
58126               start3 = [
58127                 a5[0] + portion * (b4[0] - a5[0]),
58128                 a5[1] + portion * (b4[1] - a5[1])
58129               ];
58130               i0 = i5 + 1;
58131             }
58132             if (!end && sofar + current >= to) {
58133               portion = (to - sofar) / current;
58134               end = [
58135                 a5[0] + portion * (b4[0] - a5[0]),
58136                 a5[1] + portion * (b4[1] - a5[1])
58137               ];
58138               i1 = i5 + 1;
58139             }
58140             sofar += current;
58141           }
58142           var result = points2.slice(i0, i1);
58143           result.unshift(start3);
58144           result.push(end);
58145           return result;
58146         }
58147       }
58148       function getAreaLabel(entity2, width2, height) {
58149         var centroid = path.centroid(entity2.asGeoJSON(graph));
58150         var extent = entity2.extent(graph);
58151         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
58152         if (isNaN(centroid[0]) || areaWidth < 20) return;
58153         var preset2 = _mainPresetIndex.match(entity2, context.graph());
58154         var picon = preset2 && preset2.icon;
58155         var iconSize = 17;
58156         var padding = 2;
58157         var p3 = {};
58158         if (picon && !shouldSkipIcon(preset2)) {
58159           if (addIcon()) {
58160             addLabel(iconSize + padding);
58161             return p3;
58162           }
58163         } else {
58164           if (addLabel(0)) {
58165             return p3;
58166           }
58167         }
58168         function addIcon() {
58169           var iconX = centroid[0] - iconSize / 2;
58170           var iconY = centroid[1] - iconSize / 2;
58171           var bbox3 = {
58172             minX: iconX,
58173             minY: iconY,
58174             maxX: iconX + iconSize,
58175             maxY: iconY + iconSize
58176           };
58177           if (tryInsert([bbox3], entity2.id + "I", true)) {
58178             p3.transform = "translate(" + iconX + "," + iconY + ")";
58179             return true;
58180           }
58181           return false;
58182         }
58183         function addLabel(yOffset) {
58184           if (width2 && areaWidth >= width2 + 20) {
58185             var labelX = centroid[0];
58186             var labelY = centroid[1] + yOffset;
58187             var bbox3 = {
58188               minX: labelX - width2 / 2 - padding,
58189               minY: labelY - height / 2 - padding,
58190               maxX: labelX + width2 / 2 + padding,
58191               maxY: labelY + height / 2 + padding
58192             };
58193             if (tryInsert([bbox3], entity2.id, true)) {
58194               p3.x = labelX;
58195               p3.y = labelY;
58196               p3.textAnchor = "middle";
58197               p3.height = height;
58198               return true;
58199             }
58200           }
58201           return false;
58202         }
58203       }
58204       function doInsert(bbox3, id2) {
58205         bbox3.id = id2;
58206         var oldbox = _entitybboxes[id2];
58207         if (oldbox) {
58208           _rdrawn.remove(oldbox);
58209         }
58210         _entitybboxes[id2] = bbox3;
58211         _rdrawn.insert(bbox3);
58212       }
58213       function undoInsert(id2) {
58214         var oldbox = _entitybboxes[id2];
58215         if (oldbox) {
58216           _rdrawn.remove(oldbox);
58217         }
58218         delete _entitybboxes[id2];
58219       }
58220       function tryInsert(bboxes, id2, saveSkipped) {
58221         var skipped = false;
58222         for (var i4 = 0; i4 < bboxes.length; i4++) {
58223           var bbox3 = bboxes[i4];
58224           bbox3.id = id2;
58225           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
58226             skipped = true;
58227             break;
58228           }
58229           if (_rdrawn.collides(bbox3)) {
58230             skipped = true;
58231             break;
58232           }
58233         }
58234         _entitybboxes[id2] = bboxes;
58235         if (skipped) {
58236           if (saveSkipped) {
58237             _rskipped.load(bboxes);
58238           }
58239         } else {
58240           _rdrawn.load(bboxes);
58241         }
58242         return !skipped;
58243       }
58244       var layer = selection2.selectAll(".layer-osm.labels");
58245       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
58246         return "labels-group " + d2;
58247       });
58248       var halo = layer.selectAll(".labels-group.halo");
58249       var label = layer.selectAll(".labels-group.label");
58250       var debug2 = layer.selectAll(".labels-group.debug");
58251       drawPointLabels(label, labelled.point, filter2, "pointlabel");
58252       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo");
58253       drawLinePaths(layer, labelled.line, filter2, "");
58254       drawLineLabels(label, labelled.line, filter2, "linelabel");
58255       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo");
58256       drawAreaLabels(label, labelled.area, filter2, "arealabel");
58257       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo");
58258       drawAreaIcons(label, labelled.area, filter2, "areaicon");
58259       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo");
58260       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
58261       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
58262       layer.call(filterLabels);
58263     }
58264     function filterLabels(selection2) {
58265       var _a4, _b2;
58266       var drawLayer = selection2.selectAll(".layer-osm.labels");
58267       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
58268       layers.selectAll(".nolabel").classed("nolabel", false);
58269       var mouse = context.map().mouse();
58270       var ids = [];
58271       var pad3, bbox2;
58272       if (mouse && context.mode().id !== "browse" && context.mode().id !== "select") {
58273         pad3 = 20;
58274         bbox2 = { minX: mouse[0] - pad3, minY: mouse[1] - pad3, maxX: mouse[0] + pad3, maxY: mouse[1] + pad3 };
58275         var nearMouse = _rdrawn.search(bbox2).map(function(entity) {
58276           return entity.id;
58277         });
58278         ids.push.apply(ids, nearMouse);
58279       }
58280       ids = utilArrayDifference(ids, ((_b2 = (_a4 = context.mode()) == null ? void 0 : _a4.selectedIDs) == null ? void 0 : _b2.call(_a4)) || []);
58281       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
58282       var debug2 = selection2.selectAll(".labels-group.debug");
58283       var gj = [];
58284       if (context.getDebug("collision")) {
58285         gj = bbox2 ? [{
58286           type: "Polygon",
58287           coordinates: [[
58288             [bbox2.minX, bbox2.minY],
58289             [bbox2.maxX, bbox2.minY],
58290             [bbox2.maxX, bbox2.maxY],
58291             [bbox2.minX, bbox2.maxY],
58292             [bbox2.minX, bbox2.minY]
58293           ]]
58294         }] : [];
58295       }
58296       var box = debug2.selectAll(".debug-mouse").data(gj);
58297       box.exit().remove();
58298       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
58299     }
58300     var throttleFilterLabels = throttle_default(filterLabels, 100);
58301     drawLabels.observe = function(selection2) {
58302       var listener = function() {
58303         throttleFilterLabels(selection2);
58304       };
58305       selection2.on("mousemove.hidelabels", listener);
58306       context.on("enter.hidelabels", listener);
58307     };
58308     drawLabels.off = function(selection2) {
58309       throttleFilterLabels.cancel();
58310       selection2.on("mousemove.hidelabels", null);
58311       context.on("enter.hidelabels", null);
58312     };
58313     return drawLabels;
58314   }
58315   function textWidth(text, size, container) {
58316     let c2 = _textWidthCache[size];
58317     if (!c2) c2 = _textWidthCache[size] = {};
58318     if (c2[text]) {
58319       return c2[text];
58320     }
58321     const elem = document.createElementNS("http://www.w3.org/2000/svg", "text");
58322     elem.style.fontSize = `${size}px`;
58323     elem.style.fontWeight = "bold";
58324     elem.textContent = text;
58325     container.appendChild(elem);
58326     c2[text] = elem.getComputedTextLength();
58327     elem.remove();
58328     return c2[text];
58329   }
58330   function isAddressPoint(tags) {
58331     const keys2 = Object.keys(tags).filter(
58332       (key) => osmIsInterestingTag(key) && !nonPrimaryKeys.has(key) && !nonPrimaryKeysRegex.test(key)
58333     );
58334     return keys2.length > 0 && keys2.every(
58335       (key) => key.startsWith("addr:")
58336     );
58337   }
58338   var _textWidthCache, nonPrimaryKeys, nonPrimaryKeysRegex;
58339   var init_labels = __esm({
58340     "modules/svg/labels.js"() {
58341       "use strict";
58342       init_throttle();
58343       init_src2();
58344       init_rbush();
58345       init_localizer();
58346       init_geo2();
58347       init_presets();
58348       init_osm();
58349       init_detect();
58350       init_util();
58351       _textWidthCache = {};
58352       nonPrimaryKeys = /* @__PURE__ */ new Set([
58353         "check_date",
58354         "fixme",
58355         "layer",
58356         "level",
58357         "level:ref",
58358         "note"
58359       ]);
58360       nonPrimaryKeysRegex = /^(ref|survey|note):/;
58361     }
58362   });
58363
58364   // node_modules/exifr/dist/full.esm.mjs
58365   function l(e3, t2 = o) {
58366     if (n2) try {
58367       return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
58368         /* webpackIgnore: true */
58369         e3
58370       ).then(t2);
58371     } catch (t3) {
58372       console.warn(`Couldn't load ${e3}`);
58373     }
58374   }
58375   function c(e3, t2, i3) {
58376     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
58377   }
58378   function p(e3) {
58379     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
58380   }
58381   function g2(e3) {
58382     let t2 = new Error(e3);
58383     throw delete t2.stack, t2;
58384   }
58385   function m2(e3) {
58386     return "" === (e3 = function(e4) {
58387       for (; e4.endsWith("\0"); ) e4 = e4.slice(0, -1);
58388       return e4;
58389     }(e3).trim()) ? void 0 : e3;
58390   }
58391   function S2(e3) {
58392     let t2 = function(e4) {
58393       let t3 = 0;
58394       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;
58395     }(e3);
58396     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
58397   }
58398   function b2(e3) {
58399     return y ? y.decode(e3) : a3 ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C2(e3)));
58400   }
58401   function P2(e3, t2) {
58402     g2(`${e3} '${t2}' was not loaded, try using full build of exifr.`);
58403   }
58404   function D2(e3, n3) {
58405     return "string" == typeof e3 ? O2(e3, n3) : t && !i2 && e3 instanceof HTMLImageElement ? O2(e3.src, n3) : e3 instanceof Uint8Array || e3 instanceof ArrayBuffer || e3 instanceof DataView ? new I2(e3) : t && e3 instanceof Blob ? x(e3, n3, "blob", R2) : void g2("Invalid input argument");
58406   }
58407   function O2(e3, i3) {
58408     return (s2 = e3).startsWith("data:") || s2.length > 1e4 ? v2(e3, i3, "base64") : n2 && e3.includes("://") ? x(e3, i3, "url", M2) : n2 ? v2(e3, i3, "fs") : t ? x(e3, i3, "url", M2) : void g2("Invalid input argument");
58409     var s2;
58410   }
58411   async function x(e3, t2, i3, n3) {
58412     return A2.has(i3) ? v2(e3, t2, i3) : n3 ? async function(e4, t3) {
58413       let i4 = await t3(e4);
58414       return new I2(i4);
58415     }(e3, n3) : void g2(`Parser ${i3} is not loaded`);
58416   }
58417   async function v2(e3, t2, i3) {
58418     let n3 = new (A2.get(i3))(e3, t2);
58419     return await n3.read(), n3;
58420   }
58421   function U2(e3, t2, i3) {
58422     let n3 = new L2();
58423     for (let [e4, t3] of i3) n3.set(e4, t3);
58424     if (Array.isArray(t2)) for (let i4 of t2) e3.set(i4, n3);
58425     else e3.set(t2, n3);
58426     return n3;
58427   }
58428   function F2(e3, t2, i3) {
58429     let n3, s2 = e3.get(t2);
58430     for (n3 of i3) s2.set(n3[0], n3[1]);
58431   }
58432   function Q2(e3, t2) {
58433     let i3, n3, s2, r2, a4 = [];
58434     for (s2 of t2) {
58435       for (r2 of (i3 = E.get(s2), n3 = [], i3)) (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
58436       n3.length && a4.push([s2, n3]);
58437     }
58438     return a4;
58439   }
58440   function Z(e3, t2) {
58441     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
58442   }
58443   function ee(e3, t2) {
58444     for (let i3 of t2) e3.add(i3);
58445   }
58446   async function ie2(e3, t2) {
58447     let i3 = new te(t2);
58448     return await i3.read(e3), i3.parse();
58449   }
58450   function ae2(e3) {
58451     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
58452   }
58453   function oe2(e3) {
58454     return e3 >= 224 && e3 <= 239;
58455   }
58456   function le2(e3, t2, i3) {
58457     for (let [n3, s2] of T2) if (s2.canHandle(e3, t2, i3)) return n3;
58458   }
58459   function de2(e3, t2, i3, n3) {
58460     var s2 = e3 + t2 / 60 + i3 / 3600;
58461     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
58462   }
58463   async function Se2(e3) {
58464     let t2 = new te(me);
58465     await t2.read(e3);
58466     let i3 = await t2.parse();
58467     if (i3 && i3.gps) {
58468       let { latitude: e4, longitude: t3 } = i3.gps;
58469       return { latitude: e4, longitude: t3 };
58470     }
58471   }
58472   async function ye2(e3) {
58473     let t2 = new te(Ce2);
58474     await t2.read(e3);
58475     let i3 = await t2.extractThumbnail();
58476     return i3 && a3 ? s.from(i3) : i3;
58477   }
58478   async function be2(e3) {
58479     let t2 = await this.thumbnail(e3);
58480     if (void 0 !== t2) {
58481       let e4 = new Blob([t2]);
58482       return URL.createObjectURL(e4);
58483     }
58484   }
58485   async function Pe2(e3) {
58486     let t2 = new te(Ie2);
58487     await t2.read(e3);
58488     let i3 = await t2.parse();
58489     if (i3 && i3.ifd0) return i3.ifd0[274];
58490   }
58491   async function Ae2(e3) {
58492     let t2 = await Pe2(e3);
58493     return Object.assign({ canvas: we2, css: Te2 }, ke2[t2]);
58494   }
58495   function xe2(e3, t2, i3) {
58496     return e3 <= t2 && t2 <= i3;
58497   }
58498   function Ge2(e3) {
58499     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
58500   }
58501   function Ve(e3) {
58502     let t2 = Array.from(e3).slice(1);
58503     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
58504   }
58505   function ze2(e3) {
58506     if ("string" == typeof e3) {
58507       var [t2, i3, n3, s2, r2, a4] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
58508       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a4) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a4)), Number.isNaN(+o2) ? e3 : o2;
58509     }
58510   }
58511   function He2(e3) {
58512     if ("string" == typeof e3) return e3;
58513     let t2 = [];
58514     if (0 === e3[1] && 0 === e3[e3.length - 1]) for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je2(e3[i3 + 1], e3[i3]));
58515     else for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je2(e3[i3], e3[i3 + 1]));
58516     return m2(String.fromCodePoint(...t2));
58517   }
58518   function je2(e3, t2) {
58519     return e3 << 8 | t2;
58520   }
58521   function _e2(e3, t2) {
58522     let i3 = e3.serialize();
58523     void 0 !== i3 && (t2[e3.name] = i3);
58524   }
58525   function qe2(e3, t2) {
58526     let i3, n3 = [];
58527     if (!e3) return n3;
58528     for (; null !== (i3 = t2.exec(e3)); ) n3.push(i3);
58529     return n3;
58530   }
58531   function Qe2(e3) {
58532     if (function(e4) {
58533       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
58534     }(e3)) return;
58535     let t2 = Number(e3);
58536     if (!Number.isNaN(t2)) return t2;
58537     let i3 = e3.toLowerCase();
58538     return "true" === i3 || "false" !== i3 && e3.trim();
58539   }
58540   function mt(e3, t2) {
58541     return m2(e3.getString(t2, 4));
58542   }
58543   var e, t, i2, n2, s, r, a3, o, h2, u, f, d, C2, y, I2, k2, w2, T2, A2, M2, R2, L2, E, B2, N2, G, V2, z2, H2, j2, W2, K2, X3, _2, Y, $3, J2, q2, te, ne, se2, re3, he2, ue2, ce2, fe2, pe2, ge2, me, Ce2, Ie2, ke2, we2, Te2, De2, Oe2, ve2, Me2, Re2, Le2, Ue2, Fe2, Ee2, Be2, Ne2, We2, Ke2, Xe2, Ye, $e2, Je2, Ze2, et, tt, at, ot, lt, ht, ut, ct, ft, dt, pt, gt, St, Ct, yt, full_esm_default;
58544   var init_full_esm = __esm({
58545     "node_modules/exifr/dist/full.esm.mjs"() {
58546       e = "undefined" != typeof self ? self : global;
58547       t = "undefined" != typeof navigator;
58548       i2 = t && "undefined" == typeof HTMLImageElement;
58549       n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
58550       s = e.Buffer;
58551       r = e.BigInt;
58552       a3 = !!s;
58553       o = (e3) => e3;
58554       h2 = e.fetch;
58555       u = (e3) => h2 = e3;
58556       if (!e.fetch) {
58557         const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a4) => {
58558           let { port: o2, hostname: l2, pathname: h3, protocol: u2, search: c2 } = new URL(n3);
58559           const f2 = { method: "GET", hostname: l2, path: encodeURI(h3) + c2, headers: s2 };
58560           "" !== o2 && (f2.port = Number(o2));
58561           const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
58562             if (301 === e4.statusCode || 302 === e4.statusCode) {
58563               let t3 = new URL(e4.headers.location, n3).toString();
58564               return i3(t3, { headers: s2 }).then(r2).catch(a4);
58565             }
58566             r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
58567               let i4 = [];
58568               e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
58569             }) });
58570           });
58571           d2.on("error", a4), d2.end();
58572         });
58573         u(i3);
58574       }
58575       f = (e3) => p(e3) ? void 0 : e3;
58576       d = (e3) => void 0 !== e3;
58577       C2 = (e3) => String.fromCharCode.apply(null, e3);
58578       y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
58579       I2 = class _I {
58580         static from(e3, t2) {
58581           return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
58582         }
58583         constructor(e3, t2 = 0, i3, n3) {
58584           if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3) this.byteOffset = 0, this.byteLength = 0;
58585           else if (e3 instanceof ArrayBuffer) {
58586             void 0 === i3 && (i3 = e3.byteLength - t2);
58587             let n4 = new DataView(e3, t2, i3);
58588             this._swapDataView(n4);
58589           } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
58590             void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
58591             let n4 = new DataView(e3.buffer, t2, i3);
58592             this._swapDataView(n4);
58593           } else if ("number" == typeof e3) {
58594             let t3 = new DataView(new ArrayBuffer(e3));
58595             this._swapDataView(t3);
58596           } else g2("Invalid input argument for BufferView: " + e3);
58597         }
58598         _swapArrayBuffer(e3) {
58599           this._swapDataView(new DataView(e3));
58600         }
58601         _swapBuffer(e3) {
58602           this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
58603         }
58604         _swapDataView(e3) {
58605           this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
58606         }
58607         _lengthToEnd(e3) {
58608           return this.byteLength - e3;
58609         }
58610         set(e3, t2, i3 = _I) {
58611           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);
58612         }
58613         subarray(e3, t2) {
58614           return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
58615         }
58616         toUint8() {
58617           return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
58618         }
58619         getUint8Array(e3, t2) {
58620           return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
58621         }
58622         getString(e3 = 0, t2 = this.byteLength) {
58623           return b2(this.getUint8Array(e3, t2));
58624         }
58625         getLatin1String(e3 = 0, t2 = this.byteLength) {
58626           let i3 = this.getUint8Array(e3, t2);
58627           return C2(i3);
58628         }
58629         getUnicodeString(e3 = 0, t2 = this.byteLength) {
58630           const i3 = [];
58631           for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2) i3.push(this.getUint16(e3 + n3));
58632           return C2(i3);
58633         }
58634         getInt8(e3) {
58635           return this.dataView.getInt8(e3);
58636         }
58637         getUint8(e3) {
58638           return this.dataView.getUint8(e3);
58639         }
58640         getInt16(e3, t2 = this.le) {
58641           return this.dataView.getInt16(e3, t2);
58642         }
58643         getInt32(e3, t2 = this.le) {
58644           return this.dataView.getInt32(e3, t2);
58645         }
58646         getUint16(e3, t2 = this.le) {
58647           return this.dataView.getUint16(e3, t2);
58648         }
58649         getUint32(e3, t2 = this.le) {
58650           return this.dataView.getUint32(e3, t2);
58651         }
58652         getFloat32(e3, t2 = this.le) {
58653           return this.dataView.getFloat32(e3, t2);
58654         }
58655         getFloat64(e3, t2 = this.le) {
58656           return this.dataView.getFloat64(e3, t2);
58657         }
58658         getFloat(e3, t2 = this.le) {
58659           return this.dataView.getFloat32(e3, t2);
58660         }
58661         getDouble(e3, t2 = this.le) {
58662           return this.dataView.getFloat64(e3, t2);
58663         }
58664         getUintBytes(e3, t2, i3) {
58665           switch (t2) {
58666             case 1:
58667               return this.getUint8(e3, i3);
58668             case 2:
58669               return this.getUint16(e3, i3);
58670             case 4:
58671               return this.getUint32(e3, i3);
58672             case 8:
58673               return this.getUint64 && this.getUint64(e3, i3);
58674           }
58675         }
58676         getUint(e3, t2, i3) {
58677           switch (t2) {
58678             case 8:
58679               return this.getUint8(e3, i3);
58680             case 16:
58681               return this.getUint16(e3, i3);
58682             case 32:
58683               return this.getUint32(e3, i3);
58684             case 64:
58685               return this.getUint64 && this.getUint64(e3, i3);
58686           }
58687         }
58688         toString(e3) {
58689           return this.dataView.toString(e3, this.constructor.name);
58690         }
58691         ensureChunk() {
58692         }
58693       };
58694       k2 = class extends Map {
58695         constructor(e3) {
58696           super(), this.kind = e3;
58697         }
58698         get(e3, t2) {
58699           return this.has(e3) || P2(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
58700             g2(`Unknown ${e4} '${t3}'.`);
58701           }(this.kind, e3), t2[e3].enabled || P2(this.kind, e3)), super.get(e3);
58702         }
58703         keyList() {
58704           return Array.from(this.keys());
58705         }
58706       };
58707       w2 = new k2("file parser");
58708       T2 = new k2("segment parser");
58709       A2 = new k2("file reader");
58710       M2 = (e3) => h2(e3).then((e4) => e4.arrayBuffer());
58711       R2 = (e3) => new Promise((t2, i3) => {
58712         let n3 = new FileReader();
58713         n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
58714       });
58715       L2 = class extends Map {
58716         get tagKeys() {
58717           return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
58718         }
58719         get tagValues() {
58720           return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
58721         }
58722       };
58723       E = /* @__PURE__ */ new Map();
58724       B2 = /* @__PURE__ */ new Map();
58725       N2 = /* @__PURE__ */ new Map();
58726       G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
58727       V2 = ["jfif", "xmp", "icc", "iptc", "ihdr"];
58728       z2 = ["tiff", ...V2];
58729       H2 = ["ifd0", "ifd1", "exif", "gps", "interop"];
58730       j2 = [...z2, ...H2];
58731       W2 = ["makerNote", "userComment"];
58732       K2 = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
58733       X3 = [...K2, "sanitize", "mergeOutput", "silentErrors"];
58734       _2 = class {
58735         get translate() {
58736           return this.translateKeys || this.translateValues || this.reviveValues;
58737         }
58738       };
58739       Y = class extends _2 {
58740         get needed() {
58741           return this.enabled || this.deps.size > 0;
58742         }
58743         constructor(e3, t2, i3, n3) {
58744           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 = H2.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);
58745           else if ("object" == typeof i3) {
58746             if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
58747               let { pick: e4, skip: t3 } = i3;
58748               e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
58749             }
58750             this.applyInheritables(i3);
58751           } else true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2(`Invalid options argument: ${i3}`);
58752         }
58753         applyInheritables(e3) {
58754           let t2, i3;
58755           for (t2 of K2) i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
58756         }
58757         translateTagSet(e3, t2) {
58758           if (this.dict) {
58759             let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
58760             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);
58761           } else for (let i3 of e3) t2.add(i3);
58762         }
58763         finalizeFilters() {
58764           !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);
58765         }
58766       };
58767       $3 = { 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 };
58768       J2 = /* @__PURE__ */ new Map();
58769       q2 = class extends _2 {
58770         static useCached(e3) {
58771           let t2 = J2.get(e3);
58772           return void 0 !== t2 || (t2 = new this(e3), J2.set(e3, t2)), t2;
58773         }
58774         constructor(e3) {
58775           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();
58776         }
58777         setupFromUndefined() {
58778           let e3;
58779           for (e3 of G) this[e3] = $3[e3];
58780           for (e3 of X3) this[e3] = $3[e3];
58781           for (e3 of W2) this[e3] = $3[e3];
58782           for (e3 of j2) this[e3] = new Y(e3, $3[e3], void 0, this);
58783         }
58784         setupFromTrue() {
58785           let e3;
58786           for (e3 of G) this[e3] = $3[e3];
58787           for (e3 of X3) this[e3] = $3[e3];
58788           for (e3 of W2) this[e3] = true;
58789           for (e3 of j2) this[e3] = new Y(e3, true, void 0, this);
58790         }
58791         setupFromArray(e3) {
58792           let t2;
58793           for (t2 of G) this[t2] = $3[t2];
58794           for (t2 of X3) this[t2] = $3[t2];
58795           for (t2 of W2) this[t2] = $3[t2];
58796           for (t2 of j2) this[t2] = new Y(t2, false, void 0, this);
58797           this.setupGlobalFilters(e3, void 0, H2);
58798         }
58799         setupFromObject(e3) {
58800           let t2;
58801           for (t2 of (H2.ifd0 = H2.ifd0 || H2.image, H2.ifd1 = H2.ifd1 || H2.thumbnail, Object.assign(this, e3), G)) this[t2] = Z(e3[t2], $3[t2]);
58802           for (t2 of X3) this[t2] = Z(e3[t2], $3[t2]);
58803           for (t2 of W2) this[t2] = Z(e3[t2], $3[t2]);
58804           for (t2 of z2) this[t2] = new Y(t2, $3[t2], e3[t2], this);
58805           for (t2 of H2) this[t2] = new Y(t2, $3[t2], e3[t2], this.tiff);
58806           this.setupGlobalFilters(e3.pick, e3.skip, H2, j2), true === e3.tiff ? this.batchEnableWithBool(H2, true) : false === e3.tiff ? this.batchEnableWithUserValue(H2, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H2) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H2);
58807         }
58808         batchEnableWithBool(e3, t2) {
58809           for (let i3 of e3) this[i3].enabled = t2;
58810         }
58811         batchEnableWithUserValue(e3, t2) {
58812           for (let i3 of e3) {
58813             let e4 = t2[i3];
58814             this[i3].enabled = false !== e4 && void 0 !== e4;
58815           }
58816         }
58817         setupGlobalFilters(e3, t2, i3, n3 = i3) {
58818           if (e3 && e3.length) {
58819             for (let e4 of n3) this[e4].enabled = false;
58820             let t3 = Q2(e3, i3);
58821             for (let [e4, i4] of t3) ee(this[e4].pick, i4), this[e4].enabled = true;
58822           } else if (t2 && t2.length) {
58823             let e4 = Q2(t2, i3);
58824             for (let [t3, i4] of e4) ee(this[t3].skip, i4);
58825           }
58826         }
58827         filterNestedSegmentTags() {
58828           let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
58829           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);
58830         }
58831         traverseTiffDependencyTree() {
58832           let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
58833           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 = H2.some((e4) => true === this[e4].enabled) || this.makerNote || this.userComment;
58834           for (let e4 of H2) this[e4].finalizeFilters();
58835         }
58836         get onlyTiff() {
58837           return !V2.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
58838         }
58839         checkLoadedPlugins() {
58840           for (let e3 of z2) this[e3].enabled && !T2.has(e3) && P2("segment parser", e3);
58841         }
58842       };
58843       c(q2, "default", $3);
58844       te = class {
58845         constructor(e3) {
58846           c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q2.useCached(e3);
58847         }
58848         async read(e3) {
58849           this.file = await D2(e3, this.options);
58850         }
58851         setup() {
58852           if (this.fileParser) return;
58853           let { file: e3 } = this, t2 = e3.getUint16(0);
58854           for (let [i3, n3] of w2) if (n3.canHandle(e3, t2)) return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
58855           this.file.close && this.file.close(), g2("Unknown file format");
58856         }
58857         async parse() {
58858           let { output: e3, errors: t2 } = this;
58859           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);
58860         }
58861         async executeParsers() {
58862           let { output: e3 } = this;
58863           await this.fileParser.parse();
58864           let t2 = Object.values(this.parsers).map(async (t3) => {
58865             let i3 = await t3.parse();
58866             t3.assignToOutput(e3, i3);
58867           });
58868           this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
58869         }
58870         async extractThumbnail() {
58871           this.setup();
58872           let { options: e3, file: t2 } = this, i3 = T2.get("tiff", e3);
58873           var n3;
58874           if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3) return;
58875           let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a4 = await r2.extractThumbnail();
58876           return t2.close && t2.close(), a4;
58877         }
58878       };
58879       ne = Object.freeze({ __proto__: null, parse: ie2, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2 });
58880       se2 = class {
58881         constructor(e3, t2, i3) {
58882           c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
58883             let t3 = e4.start, i4 = e4.size || 65536;
58884             if (this.file.chunked) if (this.file.available(t3, i4)) e4.chunk = this.file.subarray(t3, i4);
58885             else try {
58886               e4.chunk = await this.file.readChunk(t3, i4);
58887             } catch (t4) {
58888               g2(`Couldn't read segment: ${JSON.stringify(e4)}. ${t4.message}`);
58889             }
58890             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));
58891             return e4.chunk;
58892           }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
58893         }
58894         injectSegment(e3, t2) {
58895           this.options[e3].enabled && this.createParser(e3, t2);
58896         }
58897         createParser(e3, t2) {
58898           let i3 = new (T2.get(e3))(t2, this.options, this.file);
58899           return this.parsers[e3] = i3;
58900         }
58901         createParsers(e3) {
58902           for (let t2 of e3) {
58903             let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
58904             if (n3 && n3.enabled) {
58905               let t3 = this.parsers[e4];
58906               t3 && t3.append || t3 || this.createParser(e4, i3);
58907             }
58908           }
58909         }
58910         async readSegments(e3) {
58911           let t2 = e3.map(this.ensureSegmentChunk);
58912           await Promise.all(t2);
58913         }
58914       };
58915       re3 = class {
58916         static findPosition(e3, t2) {
58917           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;
58918           return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
58919         }
58920         static parse(e3, t2 = {}) {
58921           return new this(e3, new q2({ [this.type]: t2 }), e3).parse();
58922         }
58923         normalizeInput(e3) {
58924           return e3 instanceof I2 ? e3 : new I2(e3);
58925         }
58926         constructor(e3, t2 = {}, i3) {
58927           c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
58928             if (!this.options.silentErrors) throw e4;
58929             this.errors.push(e4.message);
58930           }), 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;
58931         }
58932         translate() {
58933           this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
58934         }
58935         get output() {
58936           return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
58937         }
58938         translateBlock(e3, t2) {
58939           let i3 = N2.get(t2), n3 = B2.get(t2), s2 = E.get(t2), r2 = this.options[t2], a4 = r2.reviveValues && !!i3, o2 = r2.translateValues && !!n3, l2 = r2.translateKeys && !!s2, h3 = {};
58940           for (let [t3, r3] of e3) a4 && 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), h3[t3] = r3;
58941           return h3;
58942         }
58943         translateValue(e3, t2) {
58944           return t2[e3] || t2.DEFAULT || e3;
58945         }
58946         assignToOutput(e3, t2) {
58947           this.assignObjectToOutput(e3, this.constructor.type, t2);
58948         }
58949         assignObjectToOutput(e3, t2, i3) {
58950           if (this.globalOptions.mergeOutput) return Object.assign(e3, i3);
58951           e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
58952         }
58953       };
58954       c(re3, "headerLength", 4), c(re3, "type", void 0), c(re3, "multiSegment", false), c(re3, "canHandle", () => false);
58955       he2 = class extends se2 {
58956         constructor(...e3) {
58957           super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
58958         }
58959         static canHandle(e3, t2) {
58960           return 65496 === t2;
58961         }
58962         async parse() {
58963           await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
58964         }
58965         setupSegmentFinderArgs(e3) {
58966           true === e3 ? (this.findAll = true, this.wanted = new Set(T2.keyList())) : (e3 = void 0 === e3 ? T2.keyList().filter((e4) => this.options[e4].enabled) : e3.filter((e4) => this.options[e4].enabled && T2.has(e4)), this.findAll = false, this.remaining = new Set(e3), this.wanted = new Set(e3)), this.unfinishedMultiSegment = false;
58967         }
58968         async findAppSegments(e3 = 0, t2) {
58969           this.setupSegmentFinderArgs(t2);
58970           let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
58971           if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
58972             let t3 = T2.get(e4), i4 = this.options[e4];
58973             return t3.multiSegment && i4.multiSegment;
58974           }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
58975             let t3 = false;
58976             for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
58977               let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
58978               if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength))) return;
58979             }
58980           }
58981         }
58982         findAppSegmentsInRange(e3, t2) {
58983           t2 -= 2;
58984           let i3, n3, s2, r2, a4, o2, { file: l2, findAll: h3, wanted: u2, remaining: c2, options: f2 } = this;
58985           for (; e3 < t2; e3++) if (255 === l2.getUint8(e3)) {
58986             if (i3 = l2.getUint8(e3 + 1), oe2(i3)) {
58987               if (n3 = l2.getUint16(e3 + 2), s2 = le2(l2, e3, n3), s2 && u2.has(s2) && (r2 = T2.get(s2), a4 = r2.findPosition(l2, e3), o2 = f2[s2], a4.type = s2, this.appSegments.push(a4), !h3 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a4.chunkNumber < a4.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size))) break;
58988               f2.recordUnknownSegments && (a4 = re3.findPosition(l2, e3), a4.marker = i3, this.unknownSegments.push(a4)), e3 += n3 + 1;
58989             } else if (ae2(i3)) {
58990               if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos) return;
58991               f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
58992             }
58993           }
58994           return e3;
58995         }
58996         mergeMultiSegments() {
58997           if (!this.appSegments.some((e4) => e4.multiSegment)) return;
58998           let e3 = function(e4, t2) {
58999             let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
59000             for (let a4 = 0; a4 < e4.length; a4++) i3 = e4[a4], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
59001             return Array.from(r2);
59002           }(this.appSegments, "type");
59003           this.mergedAppSegments = e3.map(([e4, t2]) => {
59004             let i3 = T2.get(e4, this.options);
59005             if (i3.handleMultiSegments) {
59006               return { type: e4, chunk: i3.handleMultiSegments(t2) };
59007             }
59008             return t2[0];
59009           });
59010         }
59011         getSegment(e3) {
59012           return this.appSegments.find((t2) => t2.type === e3);
59013         }
59014         async getOrFindSegment(e3) {
59015           let t2 = this.getSegment(e3);
59016           return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
59017         }
59018       };
59019       c(he2, "type", "jpeg"), w2.set("jpeg", he2);
59020       ue2 = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
59021       ce2 = class extends re3 {
59022         parseHeader() {
59023           var e3 = this.chunk.getUint16();
59024           18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
59025         }
59026         parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
59027           let { pick: n3, skip: s2 } = this.options[t2];
59028           n3 = new Set(n3);
59029           let r2 = n3.size > 0, a4 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
59030           e3 += 2;
59031           for (let l2 = 0; l2 < o2; l2++) {
59032             let o3 = this.chunk.getUint16(e3);
59033             if (r2) {
59034               if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size)) break;
59035             } else !a4 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
59036             e3 += 12;
59037           }
59038           return i3;
59039         }
59040         parseTag(e3, t2, i3) {
59041           let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a4 = ue2[s2];
59042           if (a4 * 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);
59043           if (2 === s2) return m2(n3.getString(e3, r2));
59044           if (7 === s2) return n3.getUint8Array(e3, r2);
59045           if (1 === r2) return this.parseTagValue(s2, e3);
59046           {
59047             let t3 = new (function(e4) {
59048               switch (e4) {
59049                 case 1:
59050                   return Uint8Array;
59051                 case 3:
59052                   return Uint16Array;
59053                 case 4:
59054                   return Uint32Array;
59055                 case 5:
59056                   return Array;
59057                 case 6:
59058                   return Int8Array;
59059                 case 8:
59060                   return Int16Array;
59061                 case 9:
59062                   return Int32Array;
59063                 case 10:
59064                   return Array;
59065                 case 11:
59066                   return Float32Array;
59067                 case 12:
59068                   return Float64Array;
59069                 default:
59070                   return Array;
59071               }
59072             }(s2))(r2), i4 = a4;
59073             for (let n4 = 0; n4 < r2; n4++) t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
59074             return t3;
59075           }
59076         }
59077         parseTagValue(e3, t2) {
59078           let { chunk: i3 } = this;
59079           switch (e3) {
59080             case 1:
59081               return i3.getUint8(t2);
59082             case 3:
59083               return i3.getUint16(t2);
59084             case 4:
59085               return i3.getUint32(t2);
59086             case 5:
59087               return i3.getUint32(t2) / i3.getUint32(t2 + 4);
59088             case 6:
59089               return i3.getInt8(t2);
59090             case 8:
59091               return i3.getInt16(t2);
59092             case 9:
59093               return i3.getInt32(t2);
59094             case 10:
59095               return i3.getInt32(t2) / i3.getInt32(t2 + 4);
59096             case 11:
59097               return i3.getFloat(t2);
59098             case 12:
59099               return i3.getDouble(t2);
59100             case 13:
59101               return i3.getUint32(t2);
59102             default:
59103               g2(`Invalid tiff type ${e3}`);
59104           }
59105         }
59106       };
59107       fe2 = class extends ce2 {
59108         static canHandle(e3, t2) {
59109           return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
59110         }
59111         async parse() {
59112           this.parseHeader();
59113           let { options: e3 } = this;
59114           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();
59115         }
59116         safeParse(e3) {
59117           let t2 = this[e3]();
59118           return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
59119         }
59120         findIfd0Offset() {
59121           void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
59122         }
59123         findIfd1Offset() {
59124           if (void 0 === this.ifd1Offset) {
59125             this.findIfd0Offset();
59126             let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
59127             this.ifd1Offset = this.chunk.getUint32(t2);
59128           }
59129         }
59130         parseBlock(e3, t2) {
59131           let i3 = /* @__PURE__ */ new Map();
59132           return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
59133         }
59134         async parseIfd0Block() {
59135           if (this.ifd0) return;
59136           let { file: e3 } = this;
59137           this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2(`IFD0 offset points to outside of file.
59138 this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S2(this.options));
59139           let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
59140           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;
59141         }
59142         async parseExifBlock() {
59143           if (this.exif) return;
59144           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset) return;
59145           this.file.tiff && await this.file.ensureChunk(this.exifOffset, S2(this.options));
59146           let e3 = this.parseBlock(this.exifOffset, "exif");
59147           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;
59148         }
59149         unpack(e3, t2) {
59150           let i3 = e3.get(t2);
59151           i3 && 1 === i3.length && e3.set(t2, i3[0]);
59152         }
59153         async parseGpsBlock() {
59154           if (this.gps) return;
59155           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset) return;
59156           let e3 = this.parseBlock(this.gpsOffset, "gps");
59157           return e3 && e3.has(2) && e3.has(4) && (e3.set("latitude", de2(...e3.get(2), e3.get(1))), e3.set("longitude", de2(...e3.get(4), e3.get(3)))), e3;
59158         }
59159         async parseInteropBlock() {
59160           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");
59161         }
59162         async parseThumbnailBlock(e3 = false) {
59163           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;
59164         }
59165         async extractThumbnail() {
59166           if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1) return;
59167           let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
59168           return this.chunk.getUint8Array(e3, t2);
59169         }
59170         get image() {
59171           return this.ifd0;
59172         }
59173         get thumbnail() {
59174           return this.ifd1;
59175         }
59176         createOutput() {
59177           let e3, t2, i3, n3 = {};
59178           for (t2 of H2) if (e3 = this[t2], !p(e3)) if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
59179             if ("ifd1" === t2) continue;
59180             Object.assign(n3, i3);
59181           } else n3[t2] = i3;
59182           return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
59183         }
59184         assignToOutput(e3, t2) {
59185           if (this.globalOptions.mergeOutput) Object.assign(e3, t2);
59186           else for (let [i3, n3] of Object.entries(t2)) this.assignObjectToOutput(e3, i3, n3);
59187         }
59188       };
59189       c(fe2, "type", "tiff"), c(fe2, "headerLength", 10), T2.set("tiff", fe2);
59190       pe2 = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2, parse: ie2 });
59191       ge2 = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
59192       me = Object.assign({}, ge2, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
59193       Ce2 = Object.assign({}, ge2, { tiff: false, ifd1: true, mergeOutput: false });
59194       Ie2 = Object.assign({}, ge2, { firstChunkSize: 4e4, ifd0: [274] });
59195       ke2 = 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 } });
59196       we2 = true;
59197       Te2 = true;
59198       if ("object" == typeof navigator) {
59199         let e3 = navigator.userAgent;
59200         if (e3.includes("iPad") || e3.includes("iPhone")) {
59201           let t2 = e3.match(/OS (\d+)_(\d+)/);
59202           if (t2) {
59203             let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
59204             we2 = n3 < 13.4, Te2 = false;
59205           }
59206         } else if (e3.includes("OS X 10")) {
59207           let [, t2] = e3.match(/OS X 10[_.](\d+)/);
59208           we2 = Te2 = Number(t2) < 15;
59209         }
59210         if (e3.includes("Chrome/")) {
59211           let [, t2] = e3.match(/Chrome\/(\d+)/);
59212           we2 = Te2 = Number(t2) < 81;
59213         } else if (e3.includes("Firefox/")) {
59214           let [, t2] = e3.match(/Firefox\/(\d+)/);
59215           we2 = Te2 = Number(t2) < 77;
59216         }
59217       }
59218       De2 = class extends I2 {
59219         constructor(...e3) {
59220           super(...e3), c(this, "ranges", new Oe2()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
59221         }
59222         _tryExtend(e3, t2, i3) {
59223           if (0 === e3 && 0 === this.byteLength && i3) {
59224             let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
59225             this._swapDataView(e4);
59226           } else {
59227             let i4 = e3 + t2;
59228             if (i4 > this.byteLength) {
59229               let { dataView: e4 } = this._extend(i4);
59230               this._swapDataView(e4);
59231             }
59232           }
59233         }
59234         _extend(e3) {
59235           let t2;
59236           t2 = a3 ? s.allocUnsafe(e3) : new Uint8Array(e3);
59237           let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
59238           return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
59239         }
59240         subarray(e3, t2, i3 = false) {
59241           return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
59242         }
59243         set(e3, t2, i3 = false) {
59244           i3 && this._tryExtend(t2, e3.byteLength, e3);
59245           let n3 = super.set(e3, t2);
59246           return this.ranges.add(t2, n3.byteLength), n3;
59247         }
59248         async ensureChunk(e3, t2) {
59249           this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
59250         }
59251         available(e3, t2) {
59252           return this.ranges.available(e3, t2);
59253         }
59254       };
59255       Oe2 = class {
59256         constructor() {
59257           c(this, "list", []);
59258         }
59259         get length() {
59260           return this.list.length;
59261         }
59262         add(e3, t2, i3 = 0) {
59263           let n3 = e3 + t2, s2 = this.list.filter((t3) => xe2(e3, t3.offset, n3) || xe2(e3, t3.end, n3));
59264           if (s2.length > 0) {
59265             e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
59266             let i4 = s2.shift();
59267             i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
59268           } else this.list.push({ offset: e3, length: t2, end: n3 });
59269         }
59270         available(e3, t2) {
59271           let i3 = e3 + t2;
59272           return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
59273         }
59274       };
59275       ve2 = class extends De2 {
59276         constructor(e3, t2) {
59277           super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
59278         }
59279         async readWhole() {
59280           this.chunked = false, await this.readChunk(this.nextChunkOffset);
59281         }
59282         async readChunked() {
59283           this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
59284         }
59285         async readNextChunk(e3 = this.nextChunkOffset) {
59286           if (this.fullyRead) return this.chunksRead++, false;
59287           let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
59288           return !!i3 && i3.byteLength === t2;
59289         }
59290         async readChunk(e3, t2) {
59291           if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2))) return this._readChunk(e3, t2);
59292         }
59293         safeWrapAddress(e3, t2) {
59294           return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
59295         }
59296         get nextChunkOffset() {
59297           if (0 !== this.ranges.list.length) return this.ranges.list[0].length;
59298         }
59299         get canReadNextChunk() {
59300           return this.chunksRead < this.options.chunkLimit;
59301         }
59302         get fullyRead() {
59303           return void 0 !== this.size && this.nextChunkOffset === this.size;
59304         }
59305         read() {
59306           return this.options.chunked ? this.readChunked() : this.readWhole();
59307         }
59308         close() {
59309         }
59310       };
59311       A2.set("blob", class extends ve2 {
59312         async readWhole() {
59313           this.chunked = false;
59314           let e3 = await R2(this.input);
59315           this._swapArrayBuffer(e3);
59316         }
59317         readChunked() {
59318           return this.chunked = true, this.size = this.input.size, super.readChunked();
59319         }
59320         async _readChunk(e3, t2) {
59321           let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R2(n3);
59322           return this.set(s2, e3, true);
59323         }
59324       });
59325       Me2 = Object.freeze({ __proto__: null, default: pe2, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2, parse: ie2, gpsOnlyOptions: me, gps: Se2, thumbnailOnlyOptions: Ce2, thumbnail: ye2, thumbnailUrl: be2, orientationOnlyOptions: Ie2, orientation: Pe2, rotations: ke2, get rotateCanvas() {
59326         return we2;
59327       }, get rotateCss() {
59328         return Te2;
59329       }, rotation: Ae2 });
59330       A2.set("url", class extends ve2 {
59331         async readWhole() {
59332           this.chunked = false;
59333           let e3 = await M2(this.input);
59334           e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
59335         }
59336         async _readChunk(e3, t2) {
59337           let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
59338           (e3 || i3) && (n3.range = `bytes=${[e3, i3].join("-")}`);
59339           let s2 = await h2(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a4 = r2.byteLength;
59340           if (416 !== s2.status) return a4 !== t2 && (this.size = e3 + a4), this.set(r2, e3, true);
59341         }
59342       });
59343       I2.prototype.getUint64 = function(e3) {
59344         let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
59345         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.");
59346       };
59347       Re2 = class extends se2 {
59348         parseBoxes(e3 = 0) {
59349           let t2 = [];
59350           for (; e3 < this.file.byteLength - 4; ) {
59351             let i3 = this.parseBoxHead(e3);
59352             if (t2.push(i3), 0 === i3.length) break;
59353             e3 += i3.length;
59354           }
59355           return t2;
59356         }
59357         parseSubBoxes(e3) {
59358           e3.boxes = this.parseBoxes(e3.start);
59359         }
59360         findBox(e3, t2) {
59361           return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
59362         }
59363         parseBoxHead(e3) {
59364           let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
59365           return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
59366         }
59367         parseBoxFullHead(e3) {
59368           if (void 0 !== e3.version) return;
59369           let t2 = this.file.getUint32(e3.start);
59370           e3.version = t2 >> 24, e3.start += 4;
59371         }
59372       };
59373       Le2 = class extends Re2 {
59374         static canHandle(e3, t2) {
59375           if (0 !== t2) return false;
59376           let i3 = e3.getUint16(2);
59377           if (i3 > 50) return false;
59378           let n3 = 16, s2 = [];
59379           for (; n3 < i3; ) s2.push(e3.getString(n3, 4)), n3 += 4;
59380           return s2.includes(this.type);
59381         }
59382         async parse() {
59383           let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
59384           for (; "meta" !== t2.kind; ) e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
59385           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);
59386         }
59387         async registerSegment(e3, t2, i3) {
59388           await this.file.ensureChunk(t2, i3);
59389           let n3 = this.file.subarray(t2, i3);
59390           this.createParser(e3, n3);
59391         }
59392         async findIcc(e3) {
59393           let t2 = this.findBox(e3, "iprp");
59394           if (void 0 === t2) return;
59395           let i3 = this.findBox(t2, "ipco");
59396           if (void 0 === i3) return;
59397           let n3 = this.findBox(i3, "colr");
59398           void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
59399         }
59400         async findExif(e3) {
59401           let t2 = this.findBox(e3, "iinf");
59402           if (void 0 === t2) return;
59403           let i3 = this.findBox(e3, "iloc");
59404           if (void 0 === i3) return;
59405           let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
59406           if (void 0 === s2) return;
59407           let [r2, a4] = s2;
59408           await this.file.ensureChunk(r2, a4);
59409           let o2 = 4 + this.file.getUint32(r2);
59410           r2 += o2, a4 -= o2, await this.registerSegment("tiff", r2, a4);
59411         }
59412         findExifLocIdInIinf(e3) {
59413           this.parseBoxFullHead(e3);
59414           let t2, i3, n3, s2, r2 = e3.start, a4 = this.file.getUint16(r2);
59415           for (r2 += 2; a4--; ) {
59416             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);
59417             r2 += t2.length;
59418           }
59419         }
59420         get8bits(e3) {
59421           let t2 = this.file.getUint8(e3);
59422           return [t2 >> 4, 15 & t2];
59423         }
59424         findExtentInIloc(e3, t2) {
59425           this.parseBoxFullHead(e3);
59426           let i3 = e3.start, [n3, s2] = this.get8bits(i3++), [r2, a4] = this.get8bits(i3++), o2 = 2 === e3.version ? 4 : 2, l2 = 1 === e3.version || 2 === e3.version ? 2 : 0, h3 = a4 + n3 + s2, u2 = 2 === e3.version ? 4 : 2, c2 = this.file.getUintBytes(i3, u2);
59427           for (i3 += u2; c2--; ) {
59428             let e4 = this.file.getUintBytes(i3, o2);
59429             i3 += o2 + l2 + 2 + r2;
59430             let u3 = this.file.getUint16(i3);
59431             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 + a4, n3), this.file.getUintBytes(i3 + a4 + n3, s2)];
59432             i3 += u3 * h3;
59433           }
59434         }
59435       };
59436       Ue2 = class extends Le2 {
59437       };
59438       c(Ue2, "type", "heic");
59439       Fe2 = class extends Le2 {
59440       };
59441       c(Fe2, "type", "avif"), w2.set("heic", Ue2), w2.set("avif", Fe2), U2(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"]]), U2(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"]]), U2(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"]]), U2(B2, ["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" }]]);
59442       Ee2 = U2(B2, "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" }]]);
59443       Be2 = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
59444       Ee2.set(37392, Be2), Ee2.set(41488, Be2);
59445       Ne2 = { 0: "Normal", 1: "Low", 2: "High" };
59446       Ee2.set(41992, Ne2), Ee2.set(41993, Ne2), Ee2.set(41994, Ne2), U2(N2, ["ifd0", "ifd1"], [[50827, function(e3) {
59447         return "string" != typeof e3 ? b2(e3) : e3;
59448       }], [306, ze2], [40091, He2], [40092, He2], [40093, He2], [40094, He2], [40095, He2]]), U2(N2, "exif", [[40960, Ve], [36864, Ve], [36867, ze2], [36868, ze2], [40962, Ge2], [40963, Ge2]]), U2(N2, "gps", [[0, (e3) => Array.from(e3).join(".")], [7, (e3) => Array.from(e3).join(":")]]);
59449       We2 = class extends re3 {
59450         static canHandle(e3, t2) {
59451           return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
59452         }
59453         static headerLength(e3, t2) {
59454           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;
59455         }
59456         static findPosition(e3, t2) {
59457           let i3 = super.findPosition(e3, t2);
59458           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;
59459         }
59460         static handleMultiSegments(e3) {
59461           return e3.map((e4) => e4.chunk.getString()).join("");
59462         }
59463         normalizeInput(e3) {
59464           return "string" == typeof e3 ? e3 : I2.from(e3).getString();
59465         }
59466         parse(e3 = this.chunk) {
59467           if (!this.localOptions.parse) return e3;
59468           e3 = function(e4) {
59469             let t3 = {}, i4 = {};
59470             for (let e6 of Ze2) t3[e6] = [], i4[e6] = 0;
59471             return e4.replace(et, (e6, n4, s2) => {
59472               if ("<" === n4) {
59473                 let n5 = ++i4[s2];
59474                 return t3[s2].push(n5), `${e6}#${n5}`;
59475               }
59476               return `${e6}#${t3[s2].pop()}`;
59477             });
59478           }(e3);
59479           let t2 = Xe2.findAll(e3, "rdf", "Description");
59480           0 === t2.length && t2.push(new Xe2("rdf", "Description", void 0, e3));
59481           let i3, n3 = {};
59482           for (let e4 of t2) for (let t3 of e4.properties) i3 = Je2(t3.ns, n3), _e2(t3, i3);
59483           return function(e4) {
59484             let t3;
59485             for (let i4 in e4) t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
59486             return f(e4);
59487           }(n3);
59488         }
59489         assignToOutput(e3, t2) {
59490           if (this.localOptions.parse) for (let [i3, n3] of Object.entries(t2)) switch (i3) {
59491             case "tiff":
59492               this.assignObjectToOutput(e3, "ifd0", n3);
59493               break;
59494             case "exif":
59495               this.assignObjectToOutput(e3, "exif", n3);
59496               break;
59497             case "xmlns":
59498               break;
59499             default:
59500               this.assignObjectToOutput(e3, i3, n3);
59501           }
59502           else e3.xmp = t2;
59503         }
59504       };
59505       c(We2, "type", "xmp"), c(We2, "multiSegment", true), T2.set("xmp", We2);
59506       Ke2 = class _Ke {
59507         static findAll(e3) {
59508           return qe2(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
59509         }
59510         static unpackMatch(e3) {
59511           let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
59512           return n3 = Qe2(n3), new _Ke(t2, i3, n3);
59513         }
59514         constructor(e3, t2, i3) {
59515           this.ns = e3, this.name = t2, this.value = i3;
59516         }
59517         serialize() {
59518           return this.value;
59519         }
59520       };
59521       Xe2 = class _Xe {
59522         static findAll(e3, t2, i3) {
59523           if (void 0 !== t2 || void 0 !== i3) {
59524             t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
59525             var n3 = new RegExp(`<(${t2}):(${i3})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`, "gm");
59526           } else n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
59527           return qe2(e3, n3).map(_Xe.unpackMatch);
59528         }
59529         static unpackMatch(e3) {
59530           let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
59531           return new _Xe(t2, i3, n3, s2);
59532         }
59533         constructor(e3, t2, i3, n3) {
59534           this.ns = e3, this.name = t2, this.attrString = i3, this.innerXml = n3, this.attrs = Ke2.findAll(i3), this.children = _Xe.findAll(n3), this.value = 0 === this.children.length ? Qe2(n3) : void 0, this.properties = [...this.attrs, ...this.children];
59535         }
59536         get isPrimitive() {
59537           return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
59538         }
59539         get isListContainer() {
59540           return 1 === this.children.length && this.children[0].isList;
59541         }
59542         get isList() {
59543           let { ns: e3, name: t2 } = this;
59544           return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
59545         }
59546         get isListItem() {
59547           return "rdf" === this.ns && "li" === this.name;
59548         }
59549         serialize() {
59550           if (0 === this.properties.length && void 0 === this.value) return;
59551           if (this.isPrimitive) return this.value;
59552           if (this.isListContainer) return this.children[0].serialize();
59553           if (this.isList) return $e2(this.children.map(Ye));
59554           if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length) return this.children[0].serialize();
59555           let e3 = {};
59556           for (let t2 of this.properties) _e2(t2, e3);
59557           return void 0 !== this.value && (e3.value = this.value), f(e3);
59558         }
59559       };
59560       Ye = (e3) => e3.serialize();
59561       $e2 = (e3) => 1 === e3.length ? e3[0] : e3;
59562       Je2 = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
59563       Ze2 = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
59564       et = new RegExp(`(<|\\/)(${Ze2.join("|")})`, "g");
59565       tt = Object.freeze({ __proto__: null, default: Me2, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2, parse: ie2, gpsOnlyOptions: me, gps: Se2, thumbnailOnlyOptions: Ce2, thumbnail: ye2, thumbnailUrl: be2, orientationOnlyOptions: Ie2, orientation: Pe2, rotations: ke2, get rotateCanvas() {
59566         return we2;
59567       }, get rotateCss() {
59568         return Te2;
59569       }, rotation: Ae2 });
59570       at = l("fs", (e3) => e3.promises);
59571       A2.set("fs", class extends ve2 {
59572         async readWhole() {
59573           this.chunked = false, this.fs = await at;
59574           let e3 = await this.fs.readFile(this.input);
59575           this._swapBuffer(e3);
59576         }
59577         async readChunked() {
59578           this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
59579         }
59580         async open() {
59581           void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
59582         }
59583         async _readChunk(e3, t2) {
59584           void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
59585           var i3 = this.subarray(e3, t2, true);
59586           return await this.fh.read(i3.dataView, 0, t2, e3), i3;
59587         }
59588         async close() {
59589           if (this.fh) {
59590             let e3 = this.fh;
59591             this.fh = void 0, await e3.close();
59592           }
59593         }
59594       });
59595       A2.set("base64", class extends ve2 {
59596         constructor(...e3) {
59597           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);
59598         }
59599         async _readChunk(e3, t2) {
59600           let i3, n3, r2 = this.input;
59601           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);
59602           let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
59603           r2 = r2.slice(i3, l2);
59604           let h3 = Math.min(t2, this.size - e3);
59605           if (a3) {
59606             let t3 = s.from(r2, "base64").slice(n3, n3 + h3);
59607             return this.set(t3, e3, true);
59608           }
59609           {
59610             let t3 = this.subarray(e3, h3, true), i4 = atob(r2), s2 = t3.toUint8();
59611             for (let e4 = 0; e4 < h3; e4++) s2[e4] = i4.charCodeAt(n3 + e4);
59612             return t3;
59613           }
59614         }
59615       });
59616       ot = class extends se2 {
59617         static canHandle(e3, t2) {
59618           return 18761 === t2 || 19789 === t2;
59619         }
59620         extendOptions(e3) {
59621           let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
59622           i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
59623         }
59624         async parse() {
59625           let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
59626           if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
59627             let e4 = Math.max(S2(this.options), this.options.chunkSize);
59628             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");
59629           }
59630         }
59631         adaptTiffPropAsSegment(e3) {
59632           if (this.parsers.tiff[e3]) {
59633             let t2 = this.parsers.tiff[e3];
59634             this.injectSegment(e3, t2);
59635           }
59636         }
59637       };
59638       c(ot, "type", "tiff"), w2.set("tiff", ot);
59639       lt = l("zlib");
59640       ht = ["ihdr", "iccp", "text", "itxt", "exif"];
59641       ut = class extends se2 {
59642         constructor(...e3) {
59643           super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
59644         }
59645         static canHandle(e3, t2) {
59646           return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
59647         }
59648         async parse() {
59649           let { file: e3 } = this;
59650           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);
59651         }
59652         async findPngChunksInRange(e3, t2) {
59653           let { file: i3 } = this;
59654           for (; e3 < t2; ) {
59655             let t3 = i3.getUint32(e3), n3 = i3.getUint32(e3 + 4), s2 = i3.getString(e3 + 4, 4).toLowerCase(), r2 = t3 + 4 + 4 + 4, a4 = { type: s2, offset: e3, length: r2, start: e3 + 4 + 4, size: t3, marker: n3 };
59656             ht.includes(s2) ? this.metaChunks.push(a4) : this.unknownChunks.push(a4), e3 += r2;
59657           }
59658         }
59659         parseTextChunks() {
59660           let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
59661           for (let t2 of e3) {
59662             let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
59663             this.injectKeyValToIhdr(e4, i3);
59664           }
59665         }
59666         injectKeyValToIhdr(e3, t2) {
59667           let i3 = this.parsers.ihdr;
59668           i3 && i3.raw.set(e3, t2);
59669         }
59670         findIhdr() {
59671           let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
59672           e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
59673         }
59674         async findExif() {
59675           let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
59676           e3 && this.injectSegment("tiff", e3.chunk);
59677         }
59678         async findXmp() {
59679           let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
59680           for (let t2 of e3) {
59681             "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
59682           }
59683         }
59684         async findIcc() {
59685           let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
59686           if (!e3) return;
59687           let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
59688           for (; s2 < 80 && 0 !== i3[s2]; ) s2++;
59689           let r2 = s2 + 2, a4 = t2.getString(0, s2);
59690           if (this.injectKeyValToIhdr("ProfileName", a4), n2) {
59691             let e4 = await lt, i4 = t2.getUint8Array(r2);
59692             i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
59693           }
59694         }
59695       };
59696       c(ut, "type", "png"), w2.set("png", ut), U2(E, "interop", [[1, "InteropIndex"], [2, "InteropVersion"], [4096, "RelatedImageFileFormat"], [4097, "RelatedImageWidth"], [4098, "RelatedImageHeight"]]), F2(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"]]);
59697       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"]];
59698       F2(E, "ifd0", ct), F2(E, "exif", ct), U2(B2, "gps", [[23, { M: "Magnetic North", T: "True North" }], [25, { K: "Kilometers", M: "Miles", N: "Nautical Miles" }]]);
59699       ft = class extends re3 {
59700         static canHandle(e3, t2) {
59701           return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
59702         }
59703         parse() {
59704           return this.parseTags(), this.translate(), this.output;
59705         }
59706         parseTags() {
59707           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)]]);
59708         }
59709       };
59710       c(ft, "type", "jfif"), c(ft, "headerLength", 9), T2.set("jfif", ft), U2(E, "jfif", [[0, "JFIFVersion"], [2, "ResolutionUnit"], [3, "XResolution"], [5, "YResolution"], [7, "ThumbnailWidth"], [8, "ThumbnailHeight"]]);
59711       dt = class extends re3 {
59712         parse() {
59713           return this.parseTags(), this.translate(), this.output;
59714         }
59715         parseTags() {
59716           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)]);
59717         }
59718       };
59719       c(dt, "type", "ihdr"), T2.set("ihdr", dt), U2(E, "ihdr", [[0, "ImageWidth"], [4, "ImageHeight"], [8, "BitDepth"], [9, "ColorType"], [10, "Compression"], [11, "Filter"], [12, "Interlace"]]), U2(B2, "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" }]]);
59720       pt = class extends re3 {
59721         static canHandle(e3, t2) {
59722           return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
59723         }
59724         static findPosition(e3, t2) {
59725           let i3 = super.findPosition(e3, t2);
59726           return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
59727         }
59728         static handleMultiSegments(e3) {
59729           return function(e4) {
59730             let t2 = function(e6) {
59731               let t3 = e6[0].constructor, i3 = 0;
59732               for (let t4 of e6) i3 += t4.length;
59733               let n3 = new t3(i3), s2 = 0;
59734               for (let t4 of e6) n3.set(t4, s2), s2 += t4.length;
59735               return n3;
59736             }(e4.map((e6) => e6.chunk.toUint8()));
59737             return new I2(t2);
59738           }(e3);
59739         }
59740         parse() {
59741           return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
59742         }
59743         parseHeader() {
59744           let { raw: e3 } = this;
59745           this.chunk.byteLength < 84 && g2("ICC header is too short");
59746           for (let [t2, i3] of Object.entries(gt)) {
59747             t2 = parseInt(t2, 10);
59748             let n3 = i3(this.chunk, t2);
59749             "\0\0\0\0" !== n3 && e3.set(t2, n3);
59750           }
59751         }
59752         parseTags() {
59753           let e3, t2, i3, n3, s2, { raw: r2 } = this, a4 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
59754           for (; a4--; ) {
59755             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.");
59756             s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
59757           }
59758         }
59759         parseTag(e3, t2, i3) {
59760           switch (e3) {
59761             case "desc":
59762               return this.parseDesc(t2);
59763             case "mluc":
59764               return this.parseMluc(t2);
59765             case "text":
59766               return this.parseText(t2, i3);
59767             case "sig ":
59768               return this.parseSig(t2);
59769           }
59770           if (!(t2 + i3 > this.chunk.byteLength)) return this.chunk.getUint8Array(t2, i3);
59771         }
59772         parseDesc(e3) {
59773           let t2 = this.chunk.getUint32(e3 + 8) - 1;
59774           return m2(this.chunk.getString(e3 + 12, t2));
59775         }
59776         parseText(e3, t2) {
59777           return m2(this.chunk.getString(e3 + 8, t2 - 8));
59778         }
59779         parseSig(e3) {
59780           return m2(this.chunk.getString(e3 + 8, 4));
59781         }
59782         parseMluc(e3) {
59783           let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
59784           for (let a4 = 0; a4 < i3; a4++) {
59785             let i4 = t2.getString(s2 + 0, 2), a5 = t2.getString(s2 + 2, 2), o2 = t2.getUint32(s2 + 4), l2 = t2.getUint32(s2 + 8) + e3, h3 = m2(t2.getUnicodeString(l2, o2));
59786             r2.push({ lang: i4, country: a5, text: h3 }), s2 += n3;
59787           }
59788           return 1 === i3 ? r2[0].text : r2;
59789         }
59790         translateValue(e3, t2) {
59791           return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
59792         }
59793       };
59794       c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
59795       gt = { 4: mt, 8: function(e3, t2) {
59796         return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
59797       }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
59798         const i3 = e3.getUint16(t2), n3 = e3.getUint16(t2 + 2) - 1, s2 = e3.getUint16(t2 + 4), r2 = e3.getUint16(t2 + 6), a4 = e3.getUint16(t2 + 8), o2 = e3.getUint16(t2 + 10);
59799         return new Date(Date.UTC(i3, n3, s2, r2, a4, o2));
59800       }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
59801       T2.set("icc", pt), U2(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"]]);
59802       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" };
59803       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!)" };
59804       U2(B2, "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" }]]);
59805       yt = class extends re3 {
59806         static canHandle(e3, t2, i3) {
59807           return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
59808         }
59809         static headerLength(e3, t2, i3) {
59810           let n3, s2 = this.containsIptc8bim(e3, t2, i3);
59811           if (void 0 !== s2) return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
59812         }
59813         static containsIptc8bim(e3, t2, i3) {
59814           for (let n3 = 0; n3 < i3; n3++) if (this.isIptcSegmentHead(e3, t2 + n3)) return n3;
59815         }
59816         static isIptcSegmentHead(e3, t2) {
59817           return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
59818         }
59819         parse() {
59820           let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
59821           for (let n3 = 0; n3 < t2; n3++) if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
59822             i3 = true;
59823             let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
59824             e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
59825           } else if (i3) break;
59826           return this.translate(), this.output;
59827         }
59828         pluralizeValue(e3, t2) {
59829           return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
59830         }
59831       };
59832       c(yt, "type", "iptc"), c(yt, "translateValues", false), c(yt, "reviveValues", false), T2.set("iptc", yt), U2(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"]]), U2(B2, "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" }]]);
59833       full_esm_default = tt;
59834     }
59835   });
59836
59837   // modules/svg/local_photos.js
59838   var local_photos_exports = {};
59839   __export(local_photos_exports, {
59840     svgLocalPhotos: () => svgLocalPhotos
59841   });
59842   function svgLocalPhotos(projection2, context, dispatch14) {
59843     const detected = utilDetect();
59844     let layer = select_default2(null);
59845     let _fileList;
59846     let _photos = [];
59847     let _idAutoinc = 0;
59848     let _photoFrame;
59849     let _activePhotoIdx;
59850     function init2() {
59851       if (_initialized2) return;
59852       _enabled2 = true;
59853       function over(d3_event) {
59854         d3_event.stopPropagation();
59855         d3_event.preventDefault();
59856         d3_event.dataTransfer.dropEffect = "copy";
59857       }
59858       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
59859         d3_event.stopPropagation();
59860         d3_event.preventDefault();
59861         if (!detected.filedrop) return;
59862         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
59863           if (loaded.length > 0) {
59864             drawPhotos.fitZoom(false);
59865           }
59866         });
59867       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
59868       _initialized2 = true;
59869     }
59870     function ensureViewerLoaded(context2) {
59871       if (_photoFrame) {
59872         return Promise.resolve(_photoFrame);
59873       }
59874       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
59875       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
59876       viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
59877       const controlsEnter = viewerEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-local");
59878       controlsEnter.append("button").classed("back", true).on("click.back", () => stepPhotos(-1)).text("\u25C0");
59879       controlsEnter.append("button").classed("forward", true).on("click.forward", () => stepPhotos(1)).text("\u25B6");
59880       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
59881         _photoFrame = planePhotoFrame;
59882       });
59883     }
59884     function stepPhotos(stepBy) {
59885       if (!_photos || _photos.length === 0) return;
59886       if (_activePhotoIdx === void 0) _activePhotoIdx = 0;
59887       const newIndex = _activePhotoIdx + stepBy;
59888       _activePhotoIdx = Math.max(0, Math.min(_photos.length - 1, newIndex));
59889       click(null, _photos[_activePhotoIdx], false);
59890     }
59891     function click(d3_event, image, zoomTo) {
59892       _activePhotoIdx = _photos.indexOf(image);
59893       ensureViewerLoaded(context).then(() => {
59894         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
59895         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
59896         const controlsWrap = viewer.select(".photo-controls-wrap");
59897         controlsWrap.select(".back").attr("disabled", _activePhotoIdx <= 0 ? true : null);
59898         controlsWrap.select(".forward").attr("disabled", _activePhotoIdx >= _photos.length - 1 ? true : null);
59899         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
59900         if (image.date) {
59901           attribution.append("span").text(image.date.toLocaleString(_mainLocalizer.localeCode()));
59902         }
59903         if (image.name) {
59904           attribution.append("span").classed("filename", true).text(image.name);
59905         }
59906         _photoFrame.selectPhoto({ image_path: "" });
59907         image.getSrc().then((src) => {
59908           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
59909           setStyles();
59910         });
59911       });
59912       if (zoomTo) {
59913         context.map().centerEase(image.loc);
59914       }
59915     }
59916     function transform2(d2) {
59917       var svgpoint = projection2(d2.loc);
59918       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
59919     }
59920     function setStyles(hovered) {
59921       const viewer = context.container().select(".photoviewer");
59922       const selected = viewer.empty() ? void 0 : viewer.datum();
59923       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));
59924     }
59925     function display_markers(imageList) {
59926       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
59927       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
59928         return d2.id;
59929       });
59930       groups.exit().remove();
59931       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
59932       groupsEnter.append("g").attr("class", "viewfield-scale");
59933       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
59934       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
59935       const showViewfields = context.map().zoom() >= minViewfieldZoom;
59936       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
59937       viewfields.exit().remove();
59938       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
59939         var _a4;
59940         const d2 = this.parentNode.__data__;
59941         return `rotate(${Math.round((_a4 = d2.direction) != null ? _a4 : 0)},0,0),scale(1.5,1.5),translate(-8,-13)`;
59942       }).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() {
59943         const d2 = this.parentNode.__data__;
59944         return isNumber_default(d2.direction) ? "visible" : "hidden";
59945       });
59946     }
59947     function drawPhotos(selection2) {
59948       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
59949       layer.exit().remove();
59950       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
59951       layerEnter.append("g").attr("class", "markers");
59952       layer = layerEnter.merge(layer);
59953       if (_photos) {
59954         display_markers(_photos);
59955       }
59956     }
59957     function readFileAsDataURL(file) {
59958       return new Promise((resolve, reject) => {
59959         const reader = new FileReader();
59960         reader.onload = () => resolve(reader.result);
59961         reader.onerror = (error) => reject(error);
59962         reader.readAsDataURL(file);
59963       });
59964     }
59965     async function readmultifiles(files, callback) {
59966       const loaded = [];
59967       for (const file of files) {
59968         try {
59969           const exifData = await full_esm_default.parse(file);
59970           const photo = {
59971             service: "photo",
59972             id: _idAutoinc++,
59973             name: file.name,
59974             getSrc: () => readFileAsDataURL(file),
59975             file,
59976             loc: [exifData.longitude, exifData.latitude],
59977             direction: exifData.GPSImgDirection,
59978             date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
59979           };
59980           loaded.push(photo);
59981           const sameName = _photos.filter((i3) => i3.name === photo.name);
59982           if (sameName.length === 0) {
59983             _photos.push(photo);
59984           } else {
59985             const thisContent = await photo.getSrc();
59986             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
59987             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
59988               _photos.push(photo);
59989             }
59990           }
59991         } catch {
59992         }
59993       }
59994       if (typeof callback === "function") callback(loaded);
59995       dispatch14.call("change");
59996     }
59997     drawPhotos.setFiles = function(fileList, callback) {
59998       readmultifiles(Array.from(fileList), callback);
59999       return this;
60000     };
60001     drawPhotos.fileList = function(fileList, callback) {
60002       if (!arguments.length) return _fileList;
60003       _fileList = fileList;
60004       if (!fileList || !fileList.length) return this;
60005       drawPhotos.setFiles(_fileList, callback);
60006       return this;
60007     };
60008     drawPhotos.getPhotos = function() {
60009       return _photos;
60010     };
60011     drawPhotos.removePhoto = function(id2) {
60012       _photos = _photos.filter((i3) => i3.id !== id2);
60013       dispatch14.call("change");
60014       return _photos;
60015     };
60016     drawPhotos.openPhoto = click;
60017     drawPhotos.fitZoom = function(force) {
60018       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
60019       if (coords.length === 0) return;
60020       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a4, b3) => a4.extend(b3));
60021       const map2 = context.map();
60022       var viewport = map2.trimmedExtent().polygon();
60023       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
60024         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
60025       }
60026     };
60027     function showLayer() {
60028       layer.style("display", "block");
60029       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60030         dispatch14.call("change");
60031       });
60032     }
60033     function hideLayer() {
60034       layer.transition().duration(250).style("opacity", 0).on("end", () => {
60035         layer.selectAll(".viewfield-group").remove();
60036         layer.style("display", "none");
60037       });
60038     }
60039     drawPhotos.enabled = function(val) {
60040       if (!arguments.length) return _enabled2;
60041       _enabled2 = val;
60042       if (_enabled2) {
60043         showLayer();
60044       } else {
60045         hideLayer();
60046       }
60047       dispatch14.call("change");
60048       return this;
60049     };
60050     drawPhotos.hasData = function() {
60051       return isArray_default(_photos) && _photos.length > 0;
60052     };
60053     init2();
60054     return drawPhotos;
60055   }
60056   var _initialized2, _enabled2, minViewfieldZoom;
60057   var init_local_photos = __esm({
60058     "modules/svg/local_photos.js"() {
60059       "use strict";
60060       init_src5();
60061       init_full_esm();
60062       init_lodash();
60063       init_localizer();
60064       init_detect();
60065       init_geo2();
60066       init_plane_photo();
60067       _initialized2 = false;
60068       _enabled2 = false;
60069       minViewfieldZoom = 16;
60070     }
60071   });
60072
60073   // modules/svg/osmose.js
60074   var osmose_exports2 = {};
60075   __export(osmose_exports2, {
60076     svgOsmose: () => svgOsmose
60077   });
60078   function svgOsmose(projection2, context, dispatch14) {
60079     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
60080     const minZoom5 = 12;
60081     let touchLayer = select_default2(null);
60082     let drawLayer = select_default2(null);
60083     let layerVisible = false;
60084     function markerPath(selection2, klass) {
60085       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");
60086     }
60087     function getService() {
60088       if (services.osmose && !_qaService2) {
60089         _qaService2 = services.osmose;
60090         _qaService2.on("loaded", throttledRedraw);
60091       } else if (!services.osmose && _qaService2) {
60092         _qaService2 = null;
60093       }
60094       return _qaService2;
60095     }
60096     function editOn() {
60097       if (!layerVisible) {
60098         layerVisible = true;
60099         drawLayer.style("display", "block");
60100       }
60101     }
60102     function editOff() {
60103       if (layerVisible) {
60104         layerVisible = false;
60105         drawLayer.style("display", "none");
60106         drawLayer.selectAll(".qaItem.osmose").remove();
60107         touchLayer.selectAll(".qaItem.osmose").remove();
60108       }
60109     }
60110     function layerOn() {
60111       editOn();
60112       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
60113     }
60114     function layerOff() {
60115       throttledRedraw.cancel();
60116       drawLayer.interrupt();
60117       touchLayer.selectAll(".qaItem.osmose").remove();
60118       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
60119         editOff();
60120         dispatch14.call("change");
60121       });
60122     }
60123     function updateMarkers() {
60124       if (!layerVisible || !_layerEnabled2) return;
60125       const service = getService();
60126       const selectedID = context.selectedErrorID();
60127       const data = service ? service.getItems(projection2) : [];
60128       const getTransform = svgPointTransform(projection2);
60129       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
60130       markers.exit().remove();
60131       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
60132       markersEnter.append("polygon").call(markerPath, "shadow");
60133       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
60134       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
60135       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 : "");
60136       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
60137       if (touchLayer.empty()) return;
60138       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
60139       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
60140       targets.exit().remove();
60141       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);
60142       function sortY(a4, b3) {
60143         return a4.id === selectedID ? 1 : b3.id === selectedID ? -1 : b3.loc[1] - a4.loc[1];
60144       }
60145     }
60146     function drawOsmose(selection2) {
60147       const service = getService();
60148       const surface = context.surface();
60149       if (surface && !surface.empty()) {
60150         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
60151       }
60152       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
60153       drawLayer.exit().remove();
60154       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
60155       if (_layerEnabled2) {
60156         if (service && ~~context.map().zoom() >= minZoom5) {
60157           editOn();
60158           service.loadIssues(projection2);
60159           updateMarkers();
60160         } else {
60161           editOff();
60162         }
60163       }
60164     }
60165     drawOsmose.enabled = function(val) {
60166       if (!arguments.length) return _layerEnabled2;
60167       _layerEnabled2 = val;
60168       if (_layerEnabled2) {
60169         getService().loadStrings().then(layerOn).catch((err) => {
60170           console.log(err);
60171         });
60172       } else {
60173         layerOff();
60174         if (context.selectedErrorID()) {
60175           context.enter(modeBrowse(context));
60176         }
60177       }
60178       dispatch14.call("change");
60179       return this;
60180     };
60181     drawOsmose.supported = () => !!getService();
60182     return drawOsmose;
60183   }
60184   var _layerEnabled2, _qaService2;
60185   var init_osmose2 = __esm({
60186     "modules/svg/osmose.js"() {
60187       "use strict";
60188       init_throttle();
60189       init_src5();
60190       init_browse();
60191       init_helpers();
60192       init_services();
60193       _layerEnabled2 = false;
60194     }
60195   });
60196
60197   // modules/svg/streetside.js
60198   var streetside_exports2 = {};
60199   __export(streetside_exports2, {
60200     svgStreetside: () => svgStreetside
60201   });
60202   function svgStreetside(projection2, context, dispatch14) {
60203     var throttledRedraw = throttle_default(function() {
60204       dispatch14.call("change");
60205     }, 1e3);
60206     var minZoom5 = 14;
60207     var minMarkerZoom = 16;
60208     var minViewfieldZoom2 = 18;
60209     var layer = select_default2(null);
60210     var _viewerYaw = 0;
60211     var _selectedSequence = null;
60212     var _streetside;
60213     function init2() {
60214       if (svgStreetside.initialized) return;
60215       svgStreetside.enabled = false;
60216       svgStreetside.initialized = true;
60217     }
60218     function getService() {
60219       if (services.streetside && !_streetside) {
60220         _streetside = services.streetside;
60221         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
60222       } else if (!services.streetside && _streetside) {
60223         _streetside = null;
60224       }
60225       return _streetside;
60226     }
60227     function showLayer() {
60228       var service = getService();
60229       if (!service) return;
60230       editOn();
60231       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60232         dispatch14.call("change");
60233       });
60234     }
60235     function hideLayer() {
60236       throttledRedraw.cancel();
60237       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60238     }
60239     function editOn() {
60240       layer.style("display", "block");
60241     }
60242     function editOff() {
60243       layer.selectAll(".viewfield-group").remove();
60244       layer.style("display", "none");
60245     }
60246     function click(d3_event, d2) {
60247       var service = getService();
60248       if (!service) return;
60249       if (d2.sequenceKey !== _selectedSequence) {
60250         _viewerYaw = 0;
60251       }
60252       _selectedSequence = d2.sequenceKey;
60253       service.ensureViewerLoaded(context).then(function() {
60254         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
60255       });
60256       context.map().centerEase(d2.loc);
60257     }
60258     function mouseover(d3_event, d2) {
60259       var service = getService();
60260       if (service) service.setStyles(context, d2);
60261     }
60262     function mouseout() {
60263       var service = getService();
60264       if (service) service.setStyles(context, null);
60265     }
60266     function transform2(d2) {
60267       var t2 = svgPointTransform(projection2)(d2);
60268       var rot = d2.ca + _viewerYaw;
60269       if (rot) {
60270         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
60271       }
60272       return t2;
60273     }
60274     function viewerChanged() {
60275       var service = getService();
60276       if (!service) return;
60277       var viewer = service.viewer();
60278       if (!viewer) return;
60279       _viewerYaw = viewer.getYaw();
60280       if (context.map().isTransformed()) return;
60281       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
60282     }
60283     function filterBubbles(bubbles) {
60284       var fromDate = context.photos().fromDate();
60285       var toDate = context.photos().toDate();
60286       var usernames = context.photos().usernames();
60287       if (fromDate) {
60288         var fromTimestamp = new Date(fromDate).getTime();
60289         bubbles = bubbles.filter(function(bubble) {
60290           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
60291         });
60292       }
60293       if (toDate) {
60294         var toTimestamp = new Date(toDate).getTime();
60295         bubbles = bubbles.filter(function(bubble) {
60296           return new Date(bubble.captured_at).getTime() <= toTimestamp;
60297         });
60298       }
60299       if (usernames) {
60300         bubbles = bubbles.filter(function(bubble) {
60301           return usernames.indexOf(bubble.captured_by) !== -1;
60302         });
60303       }
60304       return bubbles;
60305     }
60306     function filterSequences(sequences) {
60307       var fromDate = context.photos().fromDate();
60308       var toDate = context.photos().toDate();
60309       var usernames = context.photos().usernames();
60310       if (fromDate) {
60311         var fromTimestamp = new Date(fromDate).getTime();
60312         sequences = sequences.filter(function(sequences2) {
60313           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
60314         });
60315       }
60316       if (toDate) {
60317         var toTimestamp = new Date(toDate).getTime();
60318         sequences = sequences.filter(function(sequences2) {
60319           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
60320         });
60321       }
60322       if (usernames) {
60323         sequences = sequences.filter(function(sequences2) {
60324           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
60325         });
60326       }
60327       return sequences;
60328     }
60329     function update() {
60330       var viewer = context.container().select(".photoviewer");
60331       var selected = viewer.empty() ? void 0 : viewer.datum();
60332       var z3 = ~~context.map().zoom();
60333       var showMarkers = z3 >= minMarkerZoom;
60334       var showViewfields = z3 >= minViewfieldZoom2;
60335       var service = getService();
60336       var sequences = [];
60337       var bubbles = [];
60338       if (context.photos().showsPanoramic()) {
60339         sequences = service ? service.sequences(projection2) : [];
60340         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
60341         sequences = filterSequences(sequences);
60342         bubbles = filterBubbles(bubbles);
60343       }
60344       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
60345         return d2.properties.key;
60346       });
60347       dispatch14.call("photoDatesChanged", this, "streetside", [...bubbles.map((p2) => p2.captured_at), ...sequences.map((t2) => t2.properties.vintageStart)]);
60348       traces.exit().remove();
60349       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60350       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
60351         return d2.key + (d2.sequenceKey ? "v1" : "v0");
60352       });
60353       groups.exit().remove();
60354       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60355       groupsEnter.append("g").attr("class", "viewfield-scale");
60356       var markers = groups.merge(groupsEnter).sort(function(a4, b3) {
60357         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
60358       }).attr("transform", transform2).select(".viewfield-scale");
60359       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60360       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60361       viewfields.exit().remove();
60362       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60363       function viewfieldPath() {
60364         var d2 = this.parentNode.__data__;
60365         if (d2.pano) {
60366           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60367         } else {
60368           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60369         }
60370       }
60371     }
60372     function drawImages(selection2) {
60373       var enabled = svgStreetside.enabled;
60374       var service = getService();
60375       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
60376       layer.exit().remove();
60377       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
60378       layerEnter.append("g").attr("class", "sequences");
60379       layerEnter.append("g").attr("class", "markers");
60380       layer = layerEnter.merge(layer);
60381       if (enabled) {
60382         if (service && ~~context.map().zoom() >= minZoom5) {
60383           editOn();
60384           update();
60385           service.loadBubbles(projection2);
60386         } else {
60387           dispatch14.call("photoDatesChanged", this, "streetside", []);
60388           editOff();
60389         }
60390       } else {
60391         dispatch14.call("photoDatesChanged", this, "streetside", []);
60392       }
60393     }
60394     drawImages.enabled = function(_3) {
60395       if (!arguments.length) return svgStreetside.enabled;
60396       svgStreetside.enabled = _3;
60397       if (svgStreetside.enabled) {
60398         showLayer();
60399         context.photos().on("change.streetside", update);
60400       } else {
60401         hideLayer();
60402         context.photos().on("change.streetside", null);
60403       }
60404       dispatch14.call("change");
60405       return this;
60406     };
60407     drawImages.supported = function() {
60408       return !!getService();
60409     };
60410     drawImages.rendered = function(zoom) {
60411       return zoom >= minZoom5;
60412     };
60413     init2();
60414     return drawImages;
60415   }
60416   var init_streetside2 = __esm({
60417     "modules/svg/streetside.js"() {
60418       "use strict";
60419       init_throttle();
60420       init_src5();
60421       init_helpers();
60422       init_services();
60423     }
60424   });
60425
60426   // modules/svg/vegbilder.js
60427   var vegbilder_exports2 = {};
60428   __export(vegbilder_exports2, {
60429     svgVegbilder: () => svgVegbilder
60430   });
60431   function svgVegbilder(projection2, context, dispatch14) {
60432     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
60433     const minZoom5 = 14;
60434     const minMarkerZoom = 16;
60435     const minViewfieldZoom2 = 18;
60436     let layer = select_default2(null);
60437     let _viewerYaw = 0;
60438     let _vegbilder;
60439     function init2() {
60440       if (svgVegbilder.initialized) return;
60441       svgVegbilder.enabled = false;
60442       svgVegbilder.initialized = true;
60443     }
60444     function getService() {
60445       if (services.vegbilder && !_vegbilder) {
60446         _vegbilder = services.vegbilder;
60447         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
60448       } else if (!services.vegbilder && _vegbilder) {
60449         _vegbilder = null;
60450       }
60451       return _vegbilder;
60452     }
60453     function showLayer() {
60454       const service = getService();
60455       if (!service) return;
60456       editOn();
60457       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
60458     }
60459     function hideLayer() {
60460       throttledRedraw.cancel();
60461       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60462     }
60463     function editOn() {
60464       layer.style("display", "block");
60465     }
60466     function editOff() {
60467       layer.selectAll(".viewfield-group").remove();
60468       layer.style("display", "none");
60469     }
60470     function click(d3_event, d2) {
60471       const service = getService();
60472       if (!service) return;
60473       service.ensureViewerLoaded(context).then(() => {
60474         service.selectImage(context, d2.key).showViewer(context);
60475       });
60476       context.map().centerEase(d2.loc);
60477     }
60478     function mouseover(d3_event, d2) {
60479       const service = getService();
60480       if (service) service.setStyles(context, d2);
60481     }
60482     function mouseout() {
60483       const service = getService();
60484       if (service) service.setStyles(context, null);
60485     }
60486     function transform2(d2, selected) {
60487       let t2 = svgPointTransform(projection2)(d2);
60488       let rot = d2.ca;
60489       if (d2 === selected) {
60490         rot += _viewerYaw;
60491       }
60492       if (rot) {
60493         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
60494       }
60495       return t2;
60496     }
60497     function viewerChanged() {
60498       const service = getService();
60499       if (!service) return;
60500       const frame2 = service.photoFrame();
60501       if (!frame2) return;
60502       _viewerYaw = frame2.getYaw();
60503       if (context.map().isTransformed()) return;
60504       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
60505     }
60506     function filterImages(images) {
60507       const photoContext = context.photos();
60508       const fromDateString = photoContext.fromDate();
60509       const toDateString = photoContext.toDate();
60510       const showsFlat = photoContext.showsFlat();
60511       const showsPano = photoContext.showsPanoramic();
60512       if (fromDateString) {
60513         const fromDate = new Date(fromDateString);
60514         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
60515       }
60516       if (toDateString) {
60517         const toDate = new Date(toDateString);
60518         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
60519       }
60520       if (!showsPano) {
60521         images = images.filter((image) => !image.is_sphere);
60522       }
60523       if (!showsFlat) {
60524         images = images.filter((image) => image.is_sphere);
60525       }
60526       return images;
60527     }
60528     function filterSequences(sequences) {
60529       const photoContext = context.photos();
60530       const fromDateString = photoContext.fromDate();
60531       const toDateString = photoContext.toDate();
60532       const showsFlat = photoContext.showsFlat();
60533       const showsPano = photoContext.showsPanoramic();
60534       if (fromDateString) {
60535         const fromDate = new Date(fromDateString);
60536         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
60537       }
60538       if (toDateString) {
60539         const toDate = new Date(toDateString);
60540         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
60541       }
60542       if (!showsPano) {
60543         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
60544       }
60545       if (!showsFlat) {
60546         sequences = sequences.filter(({ images }) => images[0].is_sphere);
60547       }
60548       return sequences;
60549     }
60550     function update() {
60551       const viewer = context.container().select(".photoviewer");
60552       const selected = viewer.empty() ? void 0 : viewer.datum();
60553       const z3 = ~~context.map().zoom();
60554       const showMarkers = z3 >= minMarkerZoom;
60555       const showViewfields = z3 >= minViewfieldZoom2;
60556       const service = getService();
60557       let sequences = [];
60558       let images = [];
60559       if (service) {
60560         service.loadImages(context);
60561         sequences = service.sequences(projection2);
60562         images = showMarkers ? service.images(projection2) : [];
60563         dispatch14.call("photoDatesChanged", this, "vegbilder", images.map((p2) => p2.captured_at));
60564         images = filterImages(images);
60565         sequences = filterSequences(sequences);
60566       }
60567       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
60568       traces.exit().remove();
60569       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60570       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
60571       groups.exit().remove();
60572       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60573       groupsEnter.append("g").attr("class", "viewfield-scale");
60574       const markers = groups.merge(groupsEnter).sort((a4, b3) => {
60575         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
60576       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
60577       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60578       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60579       viewfields.exit().remove();
60580       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60581       function viewfieldPath() {
60582         const d2 = this.parentNode.__data__;
60583         if (d2.is_sphere) {
60584           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60585         } else {
60586           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60587         }
60588       }
60589     }
60590     function drawImages(selection2) {
60591       const enabled = svgVegbilder.enabled;
60592       const service = getService();
60593       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
60594       layer.exit().remove();
60595       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
60596       layerEnter.append("g").attr("class", "sequences");
60597       layerEnter.append("g").attr("class", "markers");
60598       layer = layerEnter.merge(layer);
60599       if (enabled) {
60600         if (service && ~~context.map().zoom() >= minZoom5) {
60601           editOn();
60602           update();
60603           service.loadImages(context);
60604         } else {
60605           editOff();
60606         }
60607       }
60608     }
60609     drawImages.enabled = function(_3) {
60610       if (!arguments.length) return svgVegbilder.enabled;
60611       svgVegbilder.enabled = _3;
60612       if (svgVegbilder.enabled) {
60613         showLayer();
60614         context.photos().on("change.vegbilder", update);
60615       } else {
60616         hideLayer();
60617         context.photos().on("change.vegbilder", null);
60618       }
60619       dispatch14.call("change");
60620       return this;
60621     };
60622     drawImages.supported = function() {
60623       return !!getService();
60624     };
60625     drawImages.rendered = function(zoom) {
60626       return zoom >= minZoom5;
60627     };
60628     drawImages.validHere = function(extent, zoom) {
60629       return zoom >= minZoom5 - 2 && getService().validHere(extent);
60630     };
60631     init2();
60632     return drawImages;
60633   }
60634   var init_vegbilder2 = __esm({
60635     "modules/svg/vegbilder.js"() {
60636       "use strict";
60637       init_throttle();
60638       init_src5();
60639       init_helpers();
60640       init_services();
60641     }
60642   });
60643
60644   // modules/svg/mapillary_images.js
60645   var mapillary_images_exports = {};
60646   __export(mapillary_images_exports, {
60647     svgMapillaryImages: () => svgMapillaryImages
60648   });
60649   function svgMapillaryImages(projection2, context, dispatch14) {
60650     const throttledRedraw = throttle_default(function() {
60651       dispatch14.call("change");
60652     }, 1e3);
60653     const minZoom5 = 12;
60654     const minMarkerZoom = 16;
60655     const minViewfieldZoom2 = 18;
60656     let layer = select_default2(null);
60657     let _mapillary;
60658     function init2() {
60659       if (svgMapillaryImages.initialized) return;
60660       svgMapillaryImages.enabled = false;
60661       svgMapillaryImages.initialized = true;
60662     }
60663     function getService() {
60664       if (services.mapillary && !_mapillary) {
60665         _mapillary = services.mapillary;
60666         _mapillary.event.on("loadedImages", throttledRedraw);
60667       } else if (!services.mapillary && _mapillary) {
60668         _mapillary = null;
60669       }
60670       return _mapillary;
60671     }
60672     function showLayer() {
60673       const service = getService();
60674       if (!service) return;
60675       editOn();
60676       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60677         dispatch14.call("change");
60678       });
60679     }
60680     function hideLayer() {
60681       throttledRedraw.cancel();
60682       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60683     }
60684     function editOn() {
60685       layer.style("display", "block");
60686     }
60687     function editOff() {
60688       layer.selectAll(".viewfield-group").remove();
60689       layer.style("display", "none");
60690     }
60691     function click(d3_event, image) {
60692       const service = getService();
60693       if (!service) return;
60694       service.ensureViewerLoaded(context).then(function() {
60695         service.selectImage(context, image.id).showViewer(context);
60696       });
60697       context.map().centerEase(image.loc);
60698     }
60699     function mouseover(d3_event, image) {
60700       const service = getService();
60701       if (service) service.setStyles(context, image);
60702     }
60703     function mouseout() {
60704       const service = getService();
60705       if (service) service.setStyles(context, null);
60706     }
60707     function transform2(d2) {
60708       let t2 = svgPointTransform(projection2)(d2);
60709       if (d2.ca) {
60710         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
60711       }
60712       return t2;
60713     }
60714     function filterImages(images) {
60715       const showsPano = context.photos().showsPanoramic();
60716       const showsFlat = context.photos().showsFlat();
60717       const fromDate = context.photos().fromDate();
60718       const toDate = context.photos().toDate();
60719       if (!showsPano || !showsFlat) {
60720         images = images.filter(function(image) {
60721           if (image.is_pano) return showsPano;
60722           return showsFlat;
60723         });
60724       }
60725       if (fromDate) {
60726         images = images.filter(function(image) {
60727           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
60728         });
60729       }
60730       if (toDate) {
60731         images = images.filter(function(image) {
60732           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
60733         });
60734       }
60735       return images;
60736     }
60737     function filterSequences(sequences) {
60738       const showsPano = context.photos().showsPanoramic();
60739       const showsFlat = context.photos().showsFlat();
60740       const fromDate = context.photos().fromDate();
60741       const toDate = context.photos().toDate();
60742       if (!showsPano || !showsFlat) {
60743         sequences = sequences.filter(function(sequence) {
60744           if (sequence.properties.hasOwnProperty("is_pano")) {
60745             if (sequence.properties.is_pano) return showsPano;
60746             return showsFlat;
60747           }
60748           return false;
60749         });
60750       }
60751       if (fromDate) {
60752         sequences = sequences.filter(function(sequence) {
60753           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
60754         });
60755       }
60756       if (toDate) {
60757         sequences = sequences.filter(function(sequence) {
60758           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
60759         });
60760       }
60761       return sequences;
60762     }
60763     function update() {
60764       const z3 = ~~context.map().zoom();
60765       const showMarkers = z3 >= minMarkerZoom;
60766       const showViewfields = z3 >= minViewfieldZoom2;
60767       const service = getService();
60768       let sequences = service ? service.sequences(projection2) : [];
60769       let images = service && showMarkers ? service.images(projection2) : [];
60770       dispatch14.call("photoDatesChanged", this, "mapillary", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
60771       images = filterImages(images);
60772       sequences = filterSequences(sequences, service);
60773       service.filterViewer(context);
60774       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
60775         return d2.properties.id;
60776       });
60777       traces.exit().remove();
60778       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60779       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
60780         return d2.id;
60781       });
60782       groups.exit().remove();
60783       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60784       groupsEnter.append("g").attr("class", "viewfield-scale");
60785       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
60786         return b3.loc[1] - a4.loc[1];
60787       }).attr("transform", transform2).select(".viewfield-scale");
60788       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60789       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60790       viewfields.exit().remove();
60791       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
60792         return this.parentNode.__data__.is_pano;
60793       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60794       function viewfieldPath() {
60795         if (this.parentNode.__data__.is_pano) {
60796           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60797         } else {
60798           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60799         }
60800       }
60801     }
60802     function drawImages(selection2) {
60803       const enabled = svgMapillaryImages.enabled;
60804       const service = getService();
60805       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
60806       layer.exit().remove();
60807       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
60808       layerEnter.append("g").attr("class", "sequences");
60809       layerEnter.append("g").attr("class", "markers");
60810       layer = layerEnter.merge(layer);
60811       if (enabled) {
60812         if (service && ~~context.map().zoom() >= minZoom5) {
60813           editOn();
60814           update();
60815           service.loadImages(projection2);
60816         } else {
60817           dispatch14.call("photoDatesChanged", this, "mapillary", []);
60818           editOff();
60819         }
60820       } else {
60821         dispatch14.call("photoDatesChanged", this, "mapillary", []);
60822       }
60823     }
60824     drawImages.enabled = function(_3) {
60825       if (!arguments.length) return svgMapillaryImages.enabled;
60826       svgMapillaryImages.enabled = _3;
60827       if (svgMapillaryImages.enabled) {
60828         showLayer();
60829         context.photos().on("change.mapillary_images", update);
60830       } else {
60831         hideLayer();
60832         context.photos().on("change.mapillary_images", null);
60833       }
60834       dispatch14.call("change");
60835       return this;
60836     };
60837     drawImages.supported = function() {
60838       return !!getService();
60839     };
60840     drawImages.rendered = function(zoom) {
60841       return zoom >= minZoom5;
60842     };
60843     init2();
60844     return drawImages;
60845   }
60846   var init_mapillary_images = __esm({
60847     "modules/svg/mapillary_images.js"() {
60848       "use strict";
60849       init_throttle();
60850       init_src5();
60851       init_helpers();
60852       init_services();
60853     }
60854   });
60855
60856   // modules/svg/mapillary_position.js
60857   var mapillary_position_exports = {};
60858   __export(mapillary_position_exports, {
60859     svgMapillaryPosition: () => svgMapillaryPosition
60860   });
60861   function svgMapillaryPosition(projection2, context) {
60862     const throttledRedraw = throttle_default(function() {
60863       update();
60864     }, 1e3);
60865     const minZoom5 = 12;
60866     const minViewfieldZoom2 = 18;
60867     let layer = select_default2(null);
60868     let _mapillary;
60869     let viewerCompassAngle;
60870     function init2() {
60871       if (svgMapillaryPosition.initialized) return;
60872       svgMapillaryPosition.initialized = true;
60873     }
60874     function getService() {
60875       if (services.mapillary && !_mapillary) {
60876         _mapillary = services.mapillary;
60877         _mapillary.event.on("imageChanged", throttledRedraw);
60878         _mapillary.event.on("bearingChanged", function(e3) {
60879           viewerCompassAngle = e3.bearing;
60880           if (context.map().isTransformed()) return;
60881           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
60882             return d2.is_pano;
60883           }).attr("transform", transform2);
60884         });
60885       } else if (!services.mapillary && _mapillary) {
60886         _mapillary = null;
60887       }
60888       return _mapillary;
60889     }
60890     function editOn() {
60891       layer.style("display", "block");
60892     }
60893     function editOff() {
60894       layer.selectAll(".viewfield-group").remove();
60895       layer.style("display", "none");
60896     }
60897     function transform2(d2) {
60898       let t2 = svgPointTransform(projection2)(d2);
60899       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
60900         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
60901       } else if (d2.ca) {
60902         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
60903       }
60904       return t2;
60905     }
60906     function update() {
60907       const z3 = ~~context.map().zoom();
60908       const showViewfields = z3 >= minViewfieldZoom2;
60909       const service = getService();
60910       const image = service && service.getActiveImage();
60911       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
60912         return d2.id;
60913       });
60914       groups.exit().remove();
60915       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
60916       groupsEnter.append("g").attr("class", "viewfield-scale");
60917       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
60918       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60919       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60920       viewfields.exit().remove();
60921       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");
60922     }
60923     function drawImages(selection2) {
60924       const service = getService();
60925       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
60926       layer.exit().remove();
60927       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
60928       layerEnter.append("g").attr("class", "markers");
60929       layer = layerEnter.merge(layer);
60930       if (service && ~~context.map().zoom() >= minZoom5) {
60931         editOn();
60932         update();
60933       } else {
60934         editOff();
60935       }
60936     }
60937     drawImages.enabled = function() {
60938       update();
60939       return this;
60940     };
60941     drawImages.supported = function() {
60942       return !!getService();
60943     };
60944     drawImages.rendered = function(zoom) {
60945       return zoom >= minZoom5;
60946     };
60947     init2();
60948     return drawImages;
60949   }
60950   var init_mapillary_position = __esm({
60951     "modules/svg/mapillary_position.js"() {
60952       "use strict";
60953       init_throttle();
60954       init_src5();
60955       init_helpers();
60956       init_services();
60957     }
60958   });
60959
60960   // modules/svg/mapillary_signs.js
60961   var mapillary_signs_exports = {};
60962   __export(mapillary_signs_exports, {
60963     svgMapillarySigns: () => svgMapillarySigns
60964   });
60965   function svgMapillarySigns(projection2, context, dispatch14) {
60966     const throttledRedraw = throttle_default(function() {
60967       dispatch14.call("change");
60968     }, 1e3);
60969     const minZoom5 = 12;
60970     let layer = select_default2(null);
60971     let _mapillary;
60972     function init2() {
60973       if (svgMapillarySigns.initialized) return;
60974       svgMapillarySigns.enabled = false;
60975       svgMapillarySigns.initialized = true;
60976     }
60977     function getService() {
60978       if (services.mapillary && !_mapillary) {
60979         _mapillary = services.mapillary;
60980         _mapillary.event.on("loadedSigns", throttledRedraw);
60981       } else if (!services.mapillary && _mapillary) {
60982         _mapillary = null;
60983       }
60984       return _mapillary;
60985     }
60986     function showLayer() {
60987       const service = getService();
60988       if (!service) return;
60989       service.loadSignResources(context);
60990       editOn();
60991     }
60992     function hideLayer() {
60993       throttledRedraw.cancel();
60994       editOff();
60995     }
60996     function editOn() {
60997       layer.style("display", "block");
60998     }
60999     function editOff() {
61000       layer.selectAll(".icon-sign").remove();
61001       layer.style("display", "none");
61002     }
61003     function click(d3_event, d2) {
61004       const service = getService();
61005       if (!service) return;
61006       context.map().centerEase(d2.loc);
61007       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
61008       service.getDetections(d2.id).then((detections) => {
61009         if (detections.length) {
61010           const imageId = detections[0].image.id;
61011           if (imageId === selectedImageId) {
61012             service.highlightDetection(detections[0]).selectImage(context, imageId);
61013           } else {
61014             service.ensureViewerLoaded(context).then(function() {
61015               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
61016             });
61017           }
61018         }
61019       });
61020     }
61021     function filterData(detectedFeatures) {
61022       var fromDate = context.photos().fromDate();
61023       var toDate = context.photos().toDate();
61024       if (fromDate) {
61025         var fromTimestamp = new Date(fromDate).getTime();
61026         detectedFeatures = detectedFeatures.filter(function(feature3) {
61027           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
61028         });
61029       }
61030       if (toDate) {
61031         var toTimestamp = new Date(toDate).getTime();
61032         detectedFeatures = detectedFeatures.filter(function(feature3) {
61033           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
61034         });
61035       }
61036       return detectedFeatures;
61037     }
61038     function update() {
61039       const service = getService();
61040       let data = service ? service.signs(projection2) : [];
61041       data = filterData(data);
61042       const transform2 = svgPointTransform(projection2);
61043       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
61044         return d2.id;
61045       });
61046       signs.exit().remove();
61047       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
61048       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
61049         return "#" + d2.value;
61050       });
61051       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
61052       signs.merge(enter).attr("transform", transform2);
61053     }
61054     function drawSigns(selection2) {
61055       const enabled = svgMapillarySigns.enabled;
61056       const service = getService();
61057       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
61058       layer.exit().remove();
61059       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
61060       if (enabled) {
61061         if (service && ~~context.map().zoom() >= minZoom5) {
61062           editOn();
61063           update();
61064           service.loadSigns(projection2);
61065           service.showSignDetections(true);
61066         } else {
61067           editOff();
61068         }
61069       } else if (service) {
61070         service.showSignDetections(false);
61071       }
61072     }
61073     drawSigns.enabled = function(_3) {
61074       if (!arguments.length) return svgMapillarySigns.enabled;
61075       svgMapillarySigns.enabled = _3;
61076       if (svgMapillarySigns.enabled) {
61077         showLayer();
61078         context.photos().on("change.mapillary_signs", update);
61079       } else {
61080         hideLayer();
61081         context.photos().on("change.mapillary_signs", null);
61082       }
61083       dispatch14.call("change");
61084       return this;
61085     };
61086     drawSigns.supported = function() {
61087       return !!getService();
61088     };
61089     drawSigns.rendered = function(zoom) {
61090       return zoom >= minZoom5;
61091     };
61092     init2();
61093     return drawSigns;
61094   }
61095   var init_mapillary_signs = __esm({
61096     "modules/svg/mapillary_signs.js"() {
61097       "use strict";
61098       init_throttle();
61099       init_src5();
61100       init_helpers();
61101       init_services();
61102     }
61103   });
61104
61105   // modules/svg/mapillary_map_features.js
61106   var mapillary_map_features_exports = {};
61107   __export(mapillary_map_features_exports, {
61108     svgMapillaryMapFeatures: () => svgMapillaryMapFeatures
61109   });
61110   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
61111     const throttledRedraw = throttle_default(function() {
61112       dispatch14.call("change");
61113     }, 1e3);
61114     const minZoom5 = 12;
61115     let layer = select_default2(null);
61116     let _mapillary;
61117     function init2() {
61118       if (svgMapillaryMapFeatures.initialized) return;
61119       svgMapillaryMapFeatures.enabled = false;
61120       svgMapillaryMapFeatures.initialized = true;
61121     }
61122     function getService() {
61123       if (services.mapillary && !_mapillary) {
61124         _mapillary = services.mapillary;
61125         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
61126       } else if (!services.mapillary && _mapillary) {
61127         _mapillary = null;
61128       }
61129       return _mapillary;
61130     }
61131     function showLayer() {
61132       const service = getService();
61133       if (!service) return;
61134       service.loadObjectResources(context);
61135       editOn();
61136     }
61137     function hideLayer() {
61138       throttledRedraw.cancel();
61139       editOff();
61140     }
61141     function editOn() {
61142       layer.style("display", "block");
61143     }
61144     function editOff() {
61145       layer.selectAll(".icon-map-feature").remove();
61146       layer.style("display", "none");
61147     }
61148     function click(d3_event, d2) {
61149       const service = getService();
61150       if (!service) return;
61151       context.map().centerEase(d2.loc);
61152       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
61153       service.getDetections(d2.id).then((detections) => {
61154         if (detections.length) {
61155           const imageId = detections[0].image.id;
61156           if (imageId === selectedImageId) {
61157             service.highlightDetection(detections[0]).selectImage(context, imageId);
61158           } else {
61159             service.ensureViewerLoaded(context).then(function() {
61160               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
61161             });
61162           }
61163         }
61164       });
61165     }
61166     function filterData(detectedFeatures) {
61167       const fromDate = context.photos().fromDate();
61168       const toDate = context.photos().toDate();
61169       if (fromDate) {
61170         detectedFeatures = detectedFeatures.filter(function(feature3) {
61171           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
61172         });
61173       }
61174       if (toDate) {
61175         detectedFeatures = detectedFeatures.filter(function(feature3) {
61176           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
61177         });
61178       }
61179       return detectedFeatures;
61180     }
61181     function update() {
61182       const service = getService();
61183       let data = service ? service.mapFeatures(projection2) : [];
61184       data = filterData(data);
61185       const transform2 = svgPointTransform(projection2);
61186       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
61187         return d2.id;
61188       });
61189       mapFeatures.exit().remove();
61190       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
61191       enter.append("title").text(function(d2) {
61192         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
61193         return _t("mapillary_map_features." + id2);
61194       });
61195       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
61196         if (d2.value === "object--billboard") {
61197           return "#object--sign--advertisement";
61198         }
61199         return "#" + d2.value;
61200       });
61201       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
61202       mapFeatures.merge(enter).attr("transform", transform2);
61203     }
61204     function drawMapFeatures(selection2) {
61205       const enabled = svgMapillaryMapFeatures.enabled;
61206       const service = getService();
61207       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
61208       layer.exit().remove();
61209       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
61210       if (enabled) {
61211         if (service && ~~context.map().zoom() >= minZoom5) {
61212           editOn();
61213           update();
61214           service.loadMapFeatures(projection2);
61215           service.showFeatureDetections(true);
61216         } else {
61217           editOff();
61218         }
61219       } else if (service) {
61220         service.showFeatureDetections(false);
61221       }
61222     }
61223     drawMapFeatures.enabled = function(_3) {
61224       if (!arguments.length) return svgMapillaryMapFeatures.enabled;
61225       svgMapillaryMapFeatures.enabled = _3;
61226       if (svgMapillaryMapFeatures.enabled) {
61227         showLayer();
61228         context.photos().on("change.mapillary_map_features", update);
61229       } else {
61230         hideLayer();
61231         context.photos().on("change.mapillary_map_features", null);
61232       }
61233       dispatch14.call("change");
61234       return this;
61235     };
61236     drawMapFeatures.supported = function() {
61237       return !!getService();
61238     };
61239     drawMapFeatures.rendered = function(zoom) {
61240       return zoom >= minZoom5;
61241     };
61242     init2();
61243     return drawMapFeatures;
61244   }
61245   var init_mapillary_map_features = __esm({
61246     "modules/svg/mapillary_map_features.js"() {
61247       "use strict";
61248       init_throttle();
61249       init_src5();
61250       init_helpers();
61251       init_services();
61252       init_localizer();
61253     }
61254   });
61255
61256   // modules/svg/kartaview_images.js
61257   var kartaview_images_exports = {};
61258   __export(kartaview_images_exports, {
61259     svgKartaviewImages: () => svgKartaviewImages
61260   });
61261   function svgKartaviewImages(projection2, context, dispatch14) {
61262     var throttledRedraw = throttle_default(function() {
61263       dispatch14.call("change");
61264     }, 1e3);
61265     var minZoom5 = 12;
61266     var minMarkerZoom = 16;
61267     var minViewfieldZoom2 = 18;
61268     var layer = select_default2(null);
61269     var _kartaview;
61270     function init2() {
61271       if (svgKartaviewImages.initialized) return;
61272       svgKartaviewImages.enabled = false;
61273       svgKartaviewImages.initialized = true;
61274     }
61275     function getService() {
61276       if (services.kartaview && !_kartaview) {
61277         _kartaview = services.kartaview;
61278         _kartaview.event.on("loadedImages", throttledRedraw);
61279       } else if (!services.kartaview && _kartaview) {
61280         _kartaview = null;
61281       }
61282       return _kartaview;
61283     }
61284     function showLayer() {
61285       var service = getService();
61286       if (!service) return;
61287       editOn();
61288       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61289         dispatch14.call("change");
61290       });
61291     }
61292     function hideLayer() {
61293       throttledRedraw.cancel();
61294       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61295     }
61296     function editOn() {
61297       layer.style("display", "block");
61298     }
61299     function editOff() {
61300       layer.selectAll(".viewfield-group").remove();
61301       layer.style("display", "none");
61302     }
61303     function click(d3_event, d2) {
61304       var service = getService();
61305       if (!service) return;
61306       service.ensureViewerLoaded(context).then(function() {
61307         service.selectImage(context, d2.key).showViewer(context);
61308       });
61309       context.map().centerEase(d2.loc);
61310     }
61311     function mouseover(d3_event, d2) {
61312       var service = getService();
61313       if (service) service.setStyles(context, d2);
61314     }
61315     function mouseout() {
61316       var service = getService();
61317       if (service) service.setStyles(context, null);
61318     }
61319     function transform2(d2) {
61320       var t2 = svgPointTransform(projection2)(d2);
61321       if (d2.ca) {
61322         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
61323       }
61324       return t2;
61325     }
61326     function filterImages(images) {
61327       var fromDate = context.photos().fromDate();
61328       var toDate = context.photos().toDate();
61329       var usernames = context.photos().usernames();
61330       if (fromDate) {
61331         var fromTimestamp = new Date(fromDate).getTime();
61332         images = images.filter(function(item) {
61333           return new Date(item.captured_at).getTime() >= fromTimestamp;
61334         });
61335       }
61336       if (toDate) {
61337         var toTimestamp = new Date(toDate).getTime();
61338         images = images.filter(function(item) {
61339           return new Date(item.captured_at).getTime() <= toTimestamp;
61340         });
61341       }
61342       if (usernames) {
61343         images = images.filter(function(item) {
61344           return usernames.indexOf(item.captured_by) !== -1;
61345         });
61346       }
61347       return images;
61348     }
61349     function filterSequences(sequences) {
61350       var fromDate = context.photos().fromDate();
61351       var toDate = context.photos().toDate();
61352       var usernames = context.photos().usernames();
61353       if (fromDate) {
61354         var fromTimestamp = new Date(fromDate).getTime();
61355         sequences = sequences.filter(function(sequence) {
61356           return new Date(sequence.properties.captured_at).getTime() >= fromTimestamp;
61357         });
61358       }
61359       if (toDate) {
61360         var toTimestamp = new Date(toDate).getTime();
61361         sequences = sequences.filter(function(sequence) {
61362           return new Date(sequence.properties.captured_at).getTime() <= toTimestamp;
61363         });
61364       }
61365       if (usernames) {
61366         sequences = sequences.filter(function(sequence) {
61367           return usernames.indexOf(sequence.properties.captured_by) !== -1;
61368         });
61369       }
61370       return sequences;
61371     }
61372     function update() {
61373       var viewer = context.container().select(".photoviewer");
61374       var selected = viewer.empty() ? void 0 : viewer.datum();
61375       var z3 = ~~context.map().zoom();
61376       var showMarkers = z3 >= minMarkerZoom;
61377       var showViewfields = z3 >= minViewfieldZoom2;
61378       var service = getService();
61379       var sequences = [];
61380       var images = [];
61381       sequences = service ? service.sequences(projection2) : [];
61382       images = service && showMarkers ? service.images(projection2) : [];
61383       dispatch14.call("photoDatesChanged", this, "kartaview", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
61384       sequences = filterSequences(sequences);
61385       images = filterImages(images);
61386       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61387         return d2.properties.key;
61388       });
61389       traces.exit().remove();
61390       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61391       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61392         return d2.key;
61393       });
61394       groups.exit().remove();
61395       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61396       groupsEnter.append("g").attr("class", "viewfield-scale");
61397       var markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61398         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
61399       }).attr("transform", transform2).select(".viewfield-scale");
61400       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61401       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61402       viewfields.exit().remove();
61403       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");
61404     }
61405     function drawImages(selection2) {
61406       var enabled = svgKartaviewImages.enabled, service = getService();
61407       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
61408       layer.exit().remove();
61409       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
61410       layerEnter.append("g").attr("class", "sequences");
61411       layerEnter.append("g").attr("class", "markers");
61412       layer = layerEnter.merge(layer);
61413       if (enabled) {
61414         if (service && ~~context.map().zoom() >= minZoom5) {
61415           editOn();
61416           update();
61417           service.loadImages(projection2);
61418         } else {
61419           dispatch14.call("photoDatesChanged", this, "kartaview", []);
61420           editOff();
61421         }
61422       } else {
61423         dispatch14.call("photoDatesChanged", this, "kartaview", []);
61424       }
61425     }
61426     drawImages.enabled = function(_3) {
61427       if (!arguments.length) return svgKartaviewImages.enabled;
61428       svgKartaviewImages.enabled = _3;
61429       if (svgKartaviewImages.enabled) {
61430         showLayer();
61431         context.photos().on("change.kartaview_images", update);
61432       } else {
61433         hideLayer();
61434         context.photos().on("change.kartaview_images", null);
61435       }
61436       dispatch14.call("change");
61437       return this;
61438     };
61439     drawImages.supported = function() {
61440       return !!getService();
61441     };
61442     drawImages.rendered = function(zoom) {
61443       return zoom >= minZoom5;
61444     };
61445     init2();
61446     return drawImages;
61447   }
61448   var init_kartaview_images = __esm({
61449     "modules/svg/kartaview_images.js"() {
61450       "use strict";
61451       init_throttle();
61452       init_src5();
61453       init_helpers();
61454       init_services();
61455     }
61456   });
61457
61458   // modules/svg/mapilio_images.js
61459   var mapilio_images_exports = {};
61460   __export(mapilio_images_exports, {
61461     svgMapilioImages: () => svgMapilioImages
61462   });
61463   function svgMapilioImages(projection2, context, dispatch14) {
61464     const throttledRedraw = throttle_default(function() {
61465       dispatch14.call("change");
61466     }, 1e3);
61467     const imageMinZoom2 = 16;
61468     const lineMinZoom2 = 10;
61469     const viewFieldZoomLevel = 18;
61470     let layer = select_default2(null);
61471     let _mapilio;
61472     let _viewerYaw = 0;
61473     function init2() {
61474       if (svgMapilioImages.initialized) return;
61475       svgMapilioImages.enabled = false;
61476       svgMapilioImages.initialized = true;
61477     }
61478     function getService() {
61479       if (services.mapilio && !_mapilio) {
61480         _mapilio = services.mapilio;
61481         _mapilio.event.on("loadedImages", throttledRedraw).on("loadedLines", throttledRedraw);
61482       } else if (!services.mapilio && _mapilio) {
61483         _mapilio = null;
61484       }
61485       return _mapilio;
61486     }
61487     function filterImages(images) {
61488       var fromDate = context.photos().fromDate();
61489       var toDate = context.photos().toDate();
61490       if (fromDate) {
61491         images = images.filter(function(image) {
61492           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
61493         });
61494       }
61495       if (toDate) {
61496         images = images.filter(function(image) {
61497           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
61498         });
61499       }
61500       return images;
61501     }
61502     function filterSequences(sequences) {
61503       var fromDate = context.photos().fromDate();
61504       var toDate = context.photos().toDate();
61505       if (fromDate) {
61506         sequences = sequences.filter(function(sequence) {
61507           return new Date(sequence.properties.capture_time).getTime() >= new Date(fromDate).getTime().toString();
61508         });
61509       }
61510       if (toDate) {
61511         sequences = sequences.filter(function(sequence) {
61512           return new Date(sequence.properties.capture_time).getTime() <= new Date(toDate).getTime().toString();
61513         });
61514       }
61515       return sequences;
61516     }
61517     function showLayer() {
61518       const service = getService();
61519       if (!service) return;
61520       editOn();
61521       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61522         dispatch14.call("change");
61523       });
61524     }
61525     function hideLayer() {
61526       throttledRedraw.cancel();
61527       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61528     }
61529     function transform2(d2, selectedImageId) {
61530       let t2 = svgPointTransform(projection2)(d2);
61531       let rot = d2.heading || 0;
61532       if (d2.id === selectedImageId) {
61533         rot += _viewerYaw;
61534       }
61535       if (rot) {
61536         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
61537       }
61538       return t2;
61539     }
61540     function editOn() {
61541       layer.style("display", "block");
61542     }
61543     function editOff() {
61544       layer.selectAll(".viewfield-group").remove();
61545       layer.style("display", "none");
61546     }
61547     function click(d3_event, image) {
61548       const service = getService();
61549       if (!service) return;
61550       service.ensureViewerLoaded(context, image.id).then(() => {
61551         service.selectImage(context, image.id).showViewer(context);
61552       });
61553       context.map().centerEase(image.loc);
61554     }
61555     function mouseover(d3_event, image) {
61556       const service = getService();
61557       if (service) service.setStyles(context, image);
61558     }
61559     function mouseout() {
61560       const service = getService();
61561       if (service) service.setStyles(context, null);
61562     }
61563     async function update() {
61564       var _a4;
61565       const zoom = ~~context.map().zoom();
61566       const showViewfields = zoom >= viewFieldZoomLevel;
61567       const service = getService();
61568       let sequences = service ? service.sequences(projection2, zoom) : [];
61569       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
61570       dispatch14.call("photoDatesChanged", this, "mapilio", [
61571         ...images.map((p2) => p2.capture_time),
61572         ...sequences.map((s2) => s2.properties.capture_time)
61573       ]);
61574       images = await filterImages(images);
61575       sequences = await filterSequences(sequences, service);
61576       const activeImage = (_a4 = service.getActiveImage) == null ? void 0 : _a4.call(service);
61577       const activeImageId = activeImage ? activeImage.id : null;
61578       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61579         return d2.properties.id;
61580       });
61581       traces.exit().remove();
61582       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61583       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61584         return d2.id;
61585       });
61586       groups.exit().remove();
61587       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61588       groupsEnter.append("g").attr("class", "viewfield-scale");
61589       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61590         if (a4.id === activeImageId) return 1;
61591         if (b3.id === activeImageId) return -1;
61592         return a4.capture_time_parsed - b3.capture_time_parsed;
61593       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
61594       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61595       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61596       viewfields.exit().remove();
61597       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
61598       service.setStyles(context, null);
61599       function viewfieldPath() {
61600         if (this.parentNode.__data__.isPano) {
61601           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
61602         } else {
61603           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
61604         }
61605       }
61606     }
61607     function drawImages(selection2) {
61608       const enabled = svgMapilioImages.enabled;
61609       const service = getService();
61610       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
61611       layer.exit().remove();
61612       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
61613       layerEnter.append("g").attr("class", "sequences");
61614       layerEnter.append("g").attr("class", "markers");
61615       layer = layerEnter.merge(layer);
61616       if (enabled) {
61617         let zoom = ~~context.map().zoom();
61618         if (service) {
61619           if (zoom >= imageMinZoom2) {
61620             editOn();
61621             update();
61622             service.loadImages(projection2);
61623             service.loadLines(projection2, zoom);
61624           } else if (zoom >= lineMinZoom2) {
61625             editOn();
61626             update();
61627             service.loadImages(projection2);
61628             service.loadLines(projection2, zoom);
61629           } else {
61630             editOff();
61631             dispatch14.call("photoDatesChanged", this, "mapilio", []);
61632             service.selectImage(context, null);
61633           }
61634         } else {
61635           editOff();
61636         }
61637       } else {
61638         dispatch14.call("photoDatesChanged", this, "mapilio", []);
61639       }
61640     }
61641     drawImages.enabled = function(_3) {
61642       if (!arguments.length) return svgMapilioImages.enabled;
61643       svgMapilioImages.enabled = _3;
61644       if (svgMapilioImages.enabled) {
61645         showLayer();
61646         context.photos().on("change.mapilio_images", update);
61647       } else {
61648         hideLayer();
61649         context.photos().on("change.mapilio_images", null);
61650       }
61651       dispatch14.call("change");
61652       return this;
61653     };
61654     drawImages.supported = function() {
61655       return !!getService();
61656     };
61657     drawImages.rendered = function(zoom) {
61658       return zoom >= lineMinZoom2;
61659     };
61660     init2();
61661     return drawImages;
61662   }
61663   var init_mapilio_images = __esm({
61664     "modules/svg/mapilio_images.js"() {
61665       "use strict";
61666       init_throttle();
61667       init_src5();
61668       init_services();
61669       init_helpers();
61670     }
61671   });
61672
61673   // modules/svg/panoramax_images.js
61674   var panoramax_images_exports = {};
61675   __export(panoramax_images_exports, {
61676     svgPanoramaxImages: () => svgPanoramaxImages
61677   });
61678   function svgPanoramaxImages(projection2, context, dispatch14) {
61679     const throttledRedraw = throttle_default(function() {
61680       dispatch14.call("change");
61681     }, 1e3);
61682     const imageMinZoom2 = 15;
61683     const lineMinZoom2 = 10;
61684     const viewFieldZoomLevel = 18;
61685     let layer = select_default2(null);
61686     let _panoramax;
61687     let _viewerYaw = 0;
61688     let _activeUsernameFilter;
61689     let _activeIds;
61690     function init2() {
61691       if (svgPanoramaxImages.initialized) return;
61692       svgPanoramaxImages.enabled = false;
61693       svgPanoramaxImages.initialized = true;
61694     }
61695     function getService() {
61696       if (services.panoramax && !_panoramax) {
61697         _panoramax = services.panoramax;
61698         _panoramax.event.on("viewerChanged", viewerChanged).on("loadedLines", throttledRedraw).on("loadedImages", throttledRedraw);
61699       } else if (!services.panoramax && _panoramax) {
61700         _panoramax = null;
61701       }
61702       return _panoramax;
61703     }
61704     async function filterImages(images) {
61705       const showsPano = context.photos().showsPanoramic();
61706       const showsFlat = context.photos().showsFlat();
61707       const fromDate = context.photos().fromDate();
61708       const toDate = context.photos().toDate();
61709       const username = context.photos().usernames();
61710       const service = getService();
61711       if (!showsPano || !showsFlat) {
61712         images = images.filter(function(image) {
61713           if (image.isPano) return showsPano;
61714           return showsFlat;
61715         });
61716       }
61717       if (fromDate) {
61718         images = images.filter(function(image) {
61719           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
61720         });
61721       }
61722       if (toDate) {
61723         images = images.filter(function(image) {
61724           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
61725         });
61726       }
61727       if (username && service) {
61728         if (_activeUsernameFilter !== username) {
61729           _activeUsernameFilter = username;
61730           const tempIds = await service.getUserIds(username);
61731           _activeIds = {};
61732           tempIds.forEach((id2) => {
61733             _activeIds[id2] = true;
61734           });
61735         }
61736         images = images.filter(function(image) {
61737           return _activeIds[image.account_id];
61738         });
61739       }
61740       return images;
61741     }
61742     async function filterSequences(sequences) {
61743       const showsPano = context.photos().showsPanoramic();
61744       const showsFlat = context.photos().showsFlat();
61745       const fromDate = context.photos().fromDate();
61746       const toDate = context.photos().toDate();
61747       const username = context.photos().usernames();
61748       const service = getService();
61749       if (!showsPano || !showsFlat) {
61750         sequences = sequences.filter(function(sequence) {
61751           if (sequence.properties.type === "equirectangular") return showsPano;
61752           return showsFlat;
61753         });
61754       }
61755       if (fromDate) {
61756         sequences = sequences.filter(function(sequence) {
61757           return new Date(sequence.properties.date).getTime() >= new Date(fromDate).getTime().toString();
61758         });
61759       }
61760       if (toDate) {
61761         sequences = sequences.filter(function(sequence) {
61762           return new Date(sequence.properties.date).getTime() <= new Date(toDate).getTime().toString();
61763         });
61764       }
61765       if (username && service) {
61766         if (_activeUsernameFilter !== username) {
61767           _activeUsernameFilter = username;
61768           const tempIds = await service.getUserIds(username);
61769           _activeIds = {};
61770           tempIds.forEach((id2) => {
61771             _activeIds[id2] = true;
61772           });
61773         }
61774         sequences = sequences.filter(function(sequence) {
61775           return _activeIds[sequence.properties.account_id];
61776         });
61777       }
61778       return sequences;
61779     }
61780     function showLayer() {
61781       const service = getService();
61782       if (!service) return;
61783       editOn();
61784       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61785         dispatch14.call("change");
61786       });
61787     }
61788     function hideLayer() {
61789       throttledRedraw.cancel();
61790       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61791     }
61792     function transform2(d2, selectedImageId) {
61793       let t2 = svgPointTransform(projection2)(d2);
61794       let rot = d2.heading;
61795       if (d2.id === selectedImageId) {
61796         rot += _viewerYaw;
61797       }
61798       if (rot) {
61799         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
61800       }
61801       return t2;
61802     }
61803     function editOn() {
61804       layer.style("display", "block");
61805     }
61806     function editOff() {
61807       layer.selectAll(".viewfield-group").remove();
61808       layer.style("display", "none");
61809     }
61810     function click(d3_event, image) {
61811       const service = getService();
61812       if (!service) return;
61813       service.ensureViewerLoaded(context).then(function() {
61814         service.selectImage(context, image.id).showViewer(context);
61815       });
61816       context.map().centerEase(image.loc);
61817     }
61818     function mouseover(d3_event, image) {
61819       const service = getService();
61820       if (service) service.setStyles(context, image);
61821     }
61822     function mouseout() {
61823       const service = getService();
61824       if (service) service.setStyles(context, null);
61825     }
61826     async function update() {
61827       var _a4;
61828       const zoom = ~~context.map().zoom();
61829       const showViewfields = zoom >= viewFieldZoomLevel;
61830       const service = getService();
61831       let sequences = service ? service.sequences(projection2, zoom) : [];
61832       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
61833       dispatch14.call("photoDatesChanged", this, "panoramax", [...images.map((p2) => p2.capture_time), ...sequences.map((s2) => s2.properties.date)]);
61834       images = await filterImages(images);
61835       sequences = await filterSequences(sequences, service);
61836       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61837         return d2.properties.id;
61838       });
61839       traces.exit().remove();
61840       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61841       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61842         return d2.id;
61843       });
61844       groups.exit().remove();
61845       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61846       groupsEnter.append("g").attr("class", "viewfield-scale");
61847       const activeImageId = (_a4 = service.getActiveImage()) == null ? void 0 : _a4.id;
61848       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61849         if (a4.id === activeImageId) return 1;
61850         if (b3.id === activeImageId) return -1;
61851         return a4.capture_time_parsed - b3.capture_time_parsed;
61852       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
61853       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61854       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61855       viewfields.exit().remove();
61856       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
61857       service.setStyles(context, null);
61858       function viewfieldPath() {
61859         if (this.parentNode.__data__.isPano) {
61860           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
61861         } else {
61862           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
61863         }
61864       }
61865     }
61866     function viewerChanged() {
61867       const service = getService();
61868       if (!service) return;
61869       const frame2 = service.photoFrame();
61870       if (!frame2) return;
61871       _viewerYaw = frame2.getYaw();
61872       if (context.map().isTransformed()) return;
61873       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2.id));
61874     }
61875     function drawImages(selection2) {
61876       const enabled = svgPanoramaxImages.enabled;
61877       const service = getService();
61878       layer = selection2.selectAll(".layer-panoramax").data(service ? [0] : []);
61879       layer.exit().remove();
61880       const layerEnter = layer.enter().append("g").attr("class", "layer-panoramax").style("display", enabled ? "block" : "none");
61881       layerEnter.append("g").attr("class", "sequences");
61882       layerEnter.append("g").attr("class", "markers");
61883       layer = layerEnter.merge(layer);
61884       if (enabled) {
61885         let zoom = ~~context.map().zoom();
61886         if (service) {
61887           if (zoom >= imageMinZoom2) {
61888             editOn();
61889             update();
61890             service.loadImages(projection2);
61891           } else if (zoom >= lineMinZoom2) {
61892             editOn();
61893             update();
61894             service.loadLines(projection2, zoom);
61895           } else {
61896             editOff();
61897             dispatch14.call("photoDatesChanged", this, "panoramax", []);
61898           }
61899         } else {
61900           editOff();
61901         }
61902       } else {
61903         dispatch14.call("photoDatesChanged", this, "panoramax", []);
61904       }
61905     }
61906     drawImages.enabled = function(_3) {
61907       if (!arguments.length) return svgPanoramaxImages.enabled;
61908       svgPanoramaxImages.enabled = _3;
61909       if (svgPanoramaxImages.enabled) {
61910         showLayer();
61911         context.photos().on("change.panoramax_images", update);
61912       } else {
61913         hideLayer();
61914         context.photos().on("change.panoramax_images", null);
61915       }
61916       dispatch14.call("change");
61917       return this;
61918     };
61919     drawImages.supported = function() {
61920       return !!getService();
61921     };
61922     drawImages.rendered = function(zoom) {
61923       return zoom >= lineMinZoom2;
61924     };
61925     init2();
61926     return drawImages;
61927   }
61928   var init_panoramax_images = __esm({
61929     "modules/svg/panoramax_images.js"() {
61930       "use strict";
61931       init_throttle();
61932       init_src5();
61933       init_services();
61934       init_helpers();
61935     }
61936   });
61937
61938   // modules/svg/osm.js
61939   var osm_exports3 = {};
61940   __export(osm_exports3, {
61941     svgOsm: () => svgOsm
61942   });
61943   function svgOsm(projection2, context, dispatch14) {
61944     var enabled = true;
61945     function drawOsm(selection2) {
61946       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
61947         return "layer-osm " + d2;
61948       });
61949       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["vertices", "midpoints", "points", "turns"]).enter().append("g").attr("class", function(d2) {
61950         return "points-group " + d2;
61951       });
61952     }
61953     function showLayer() {
61954       var layer = context.surface().selectAll(".data-layer.osm");
61955       layer.interrupt();
61956       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
61957         dispatch14.call("change");
61958       });
61959     }
61960     function hideLayer() {
61961       var layer = context.surface().selectAll(".data-layer.osm");
61962       layer.interrupt();
61963       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
61964         layer.classed("disabled", true);
61965         dispatch14.call("change");
61966       });
61967     }
61968     drawOsm.enabled = function(val) {
61969       if (!arguments.length) return enabled;
61970       enabled = val;
61971       if (enabled) {
61972         showLayer();
61973       } else {
61974         hideLayer();
61975       }
61976       dispatch14.call("change");
61977       return this;
61978     };
61979     return drawOsm;
61980   }
61981   var init_osm3 = __esm({
61982     "modules/svg/osm.js"() {
61983       "use strict";
61984     }
61985   });
61986
61987   // modules/svg/notes.js
61988   var notes_exports = {};
61989   __export(notes_exports, {
61990     svgNotes: () => svgNotes
61991   });
61992   function svgNotes(projection2, context, dispatch14) {
61993     if (!dispatch14) {
61994       dispatch14 = dispatch_default("change");
61995     }
61996     var throttledRedraw = throttle_default(function() {
61997       dispatch14.call("change");
61998     }, 1e3);
61999     var minZoom5 = 12;
62000     var touchLayer = select_default2(null);
62001     var drawLayer = select_default2(null);
62002     var _notesVisible = false;
62003     function markerPath(selection2, klass) {
62004       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");
62005     }
62006     function getService() {
62007       if (services.osm && !_osmService) {
62008         _osmService = services.osm;
62009         _osmService.on("loadedNotes", throttledRedraw);
62010       } else if (!services.osm && _osmService) {
62011         _osmService = null;
62012       }
62013       return _osmService;
62014     }
62015     function editOn() {
62016       if (!_notesVisible) {
62017         _notesVisible = true;
62018         drawLayer.style("display", "block");
62019       }
62020     }
62021     function editOff() {
62022       if (_notesVisible) {
62023         _notesVisible = false;
62024         drawLayer.style("display", "none");
62025         drawLayer.selectAll(".note").remove();
62026         touchLayer.selectAll(".note").remove();
62027       }
62028     }
62029     function layerOn() {
62030       editOn();
62031       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
62032         dispatch14.call("change");
62033       });
62034     }
62035     function layerOff() {
62036       throttledRedraw.cancel();
62037       drawLayer.interrupt();
62038       touchLayer.selectAll(".note").remove();
62039       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
62040         editOff();
62041         dispatch14.call("change");
62042       });
62043     }
62044     function updateMarkers() {
62045       if (!_notesVisible || !_notesEnabled) return;
62046       var service = getService();
62047       var selectedID = context.selectedNoteID();
62048       var data = service ? service.notes(projection2) : [];
62049       var getTransform = svgPointTransform(projection2);
62050       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
62051         return d2.status + d2.id;
62052       });
62053       notes.exit().remove();
62054       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
62055         return "note note-" + d2.id + " " + d2.status;
62056       }).classed("new", function(d2) {
62057         return d2.id < 0;
62058       });
62059       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
62060       notesEnter.append("path").call(markerPath, "shadow");
62061       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");
62062       notesEnter.selectAll(".icon-annotation").data(function(d2) {
62063         return [d2];
62064       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
62065         if (d2.id < 0) return "#iD-icon-plus";
62066         if (d2.status === "open") return "#iD-icon-close";
62067         return "#iD-icon-apply";
62068       });
62069       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
62070         var mode = context.mode();
62071         var isMoving = mode && mode.id === "drag-note";
62072         return !isMoving && d2.id === selectedID;
62073       }).attr("transform", getTransform);
62074       if (touchLayer.empty()) return;
62075       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62076       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
62077         return d2.id;
62078       });
62079       targets.exit().remove();
62080       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
62081         var newClass = d2.id < 0 ? "new" : "";
62082         return "note target note-" + d2.id + " " + fillClass + newClass;
62083       }).attr("transform", getTransform);
62084       function sortY(a4, b3) {
62085         if (a4.id === selectedID) return 1;
62086         if (b3.id === selectedID) return -1;
62087         return b3.loc[1] - a4.loc[1];
62088       }
62089     }
62090     function drawNotes(selection2) {
62091       var service = getService();
62092       var surface = context.surface();
62093       if (surface && !surface.empty()) {
62094         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
62095       }
62096       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
62097       drawLayer.exit().remove();
62098       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
62099       if (_notesEnabled) {
62100         if (service && ~~context.map().zoom() >= minZoom5) {
62101           editOn();
62102           service.loadNotes(projection2);
62103           updateMarkers();
62104         } else {
62105           editOff();
62106         }
62107       }
62108     }
62109     drawNotes.enabled = function(val) {
62110       if (!arguments.length) return _notesEnabled;
62111       _notesEnabled = val;
62112       if (_notesEnabled) {
62113         layerOn();
62114       } else {
62115         layerOff();
62116         if (context.selectedNoteID()) {
62117           context.enter(modeBrowse(context));
62118         }
62119       }
62120       dispatch14.call("change");
62121       return this;
62122     };
62123     return drawNotes;
62124   }
62125   var hash, _notesEnabled, _osmService;
62126   var init_notes = __esm({
62127     "modules/svg/notes.js"() {
62128       "use strict";
62129       init_throttle();
62130       init_src5();
62131       init_src4();
62132       init_browse();
62133       init_helpers();
62134       init_services();
62135       init_util();
62136       hash = utilStringQs(window.location.hash);
62137       _notesEnabled = !!hash.notes;
62138     }
62139   });
62140
62141   // modules/svg/touch.js
62142   var touch_exports = {};
62143   __export(touch_exports, {
62144     svgTouch: () => svgTouch
62145   });
62146   function svgTouch() {
62147     function drawTouch(selection2) {
62148       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
62149         return "layer-touch " + d2;
62150       });
62151     }
62152     return drawTouch;
62153   }
62154   var init_touch = __esm({
62155     "modules/svg/touch.js"() {
62156       "use strict";
62157     }
62158   });
62159
62160   // modules/util/dimensions.js
62161   var dimensions_exports = {};
62162   __export(dimensions_exports, {
62163     utilGetDimensions: () => utilGetDimensions,
62164     utilSetDimensions: () => utilSetDimensions
62165   });
62166   function refresh(selection2, node) {
62167     var cr = node.getBoundingClientRect();
62168     var prop = [cr.width, cr.height];
62169     selection2.property("__dimensions__", prop);
62170     return prop;
62171   }
62172   function utilGetDimensions(selection2, force) {
62173     if (!selection2 || selection2.empty()) {
62174       return [0, 0];
62175     }
62176     var node = selection2.node(), cached = selection2.property("__dimensions__");
62177     return !cached || force ? refresh(selection2, node) : cached;
62178   }
62179   function utilSetDimensions(selection2, dimensions) {
62180     if (!selection2 || selection2.empty()) {
62181       return selection2;
62182     }
62183     var node = selection2.node();
62184     if (dimensions === null) {
62185       refresh(selection2, node);
62186       return selection2;
62187     }
62188     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
62189   }
62190   var init_dimensions = __esm({
62191     "modules/util/dimensions.js"() {
62192       "use strict";
62193     }
62194   });
62195
62196   // modules/svg/layers.js
62197   var layers_exports = {};
62198   __export(layers_exports, {
62199     svgLayers: () => svgLayers
62200   });
62201   function svgLayers(projection2, context) {
62202     var dispatch14 = dispatch_default("change", "photoDatesChanged");
62203     var svg2 = select_default2(null);
62204     var _layers = [
62205       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
62206       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
62207       { id: "data", layer: svgData(projection2, context, dispatch14) },
62208       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
62209       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
62210       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
62211       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
62212       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
62213       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
62214       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
62215       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
62216       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
62217       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
62218       { id: "panoramax", layer: svgPanoramaxImages(projection2, context, dispatch14) },
62219       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
62220       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
62221       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
62222       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
62223     ];
62224     function drawLayers(selection2) {
62225       svg2 = selection2.selectAll(".surface").data([0]);
62226       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
62227       var defs = svg2.selectAll(".surface-defs").data([0]);
62228       defs.enter().append("defs").attr("class", "surface-defs");
62229       var groups = svg2.selectAll(".data-layer").data(_layers);
62230       groups.exit().remove();
62231       groups.enter().append("g").attr("class", function(d2) {
62232         return "data-layer " + d2.id;
62233       }).merge(groups).each(function(d2) {
62234         select_default2(this).call(d2.layer);
62235       });
62236     }
62237     drawLayers.all = function() {
62238       return _layers;
62239     };
62240     drawLayers.layer = function(id2) {
62241       var obj = _layers.find(function(o2) {
62242         return o2.id === id2;
62243       });
62244       return obj && obj.layer;
62245     };
62246     drawLayers.only = function(what) {
62247       var arr = [].concat(what);
62248       var all = _layers.map(function(layer) {
62249         return layer.id;
62250       });
62251       return drawLayers.remove(utilArrayDifference(all, arr));
62252     };
62253     drawLayers.remove = function(what) {
62254       var arr = [].concat(what);
62255       arr.forEach(function(id2) {
62256         _layers = _layers.filter(function(o2) {
62257           return o2.id !== id2;
62258         });
62259       });
62260       dispatch14.call("change");
62261       return this;
62262     };
62263     drawLayers.add = function(what) {
62264       var arr = [].concat(what);
62265       arr.forEach(function(obj) {
62266         if ("id" in obj && "layer" in obj) {
62267           _layers.push(obj);
62268         }
62269       });
62270       dispatch14.call("change");
62271       return this;
62272     };
62273     drawLayers.dimensions = function(val) {
62274       if (!arguments.length) return utilGetDimensions(svg2);
62275       utilSetDimensions(svg2, val);
62276       return this;
62277     };
62278     return utilRebind(drawLayers, dispatch14, "on");
62279   }
62280   var init_layers = __esm({
62281     "modules/svg/layers.js"() {
62282       "use strict";
62283       init_src4();
62284       init_src5();
62285       init_data2();
62286       init_local_photos();
62287       init_debug();
62288       init_geolocate();
62289       init_keepRight2();
62290       init_osmose2();
62291       init_streetside2();
62292       init_vegbilder2();
62293       init_mapillary_images();
62294       init_mapillary_position();
62295       init_mapillary_signs();
62296       init_mapillary_map_features();
62297       init_kartaview_images();
62298       init_mapilio_images();
62299       init_panoramax_images();
62300       init_osm3();
62301       init_notes();
62302       init_touch();
62303       init_util();
62304       init_dimensions();
62305     }
62306   });
62307
62308   // modules/svg/lines.js
62309   var lines_exports = {};
62310   __export(lines_exports, {
62311     svgLines: () => svgLines
62312   });
62313   function onewayArrowColour(tags) {
62314     if (tags.highway === "construction" && tags.bridge) return "white";
62315     if (tags.highway === "pedestrian") return "gray";
62316     if (tags.railway && !tags.highway) return "gray";
62317     if (tags.aeroway === "runway") return "white";
62318     return "black";
62319   }
62320   function svgLines(projection2, context) {
62321     var detected = utilDetect();
62322     var highway_stack = {
62323       motorway: 0,
62324       motorway_link: 1,
62325       trunk: 2,
62326       trunk_link: 3,
62327       primary: 4,
62328       primary_link: 5,
62329       secondary: 6,
62330       tertiary: 7,
62331       unclassified: 8,
62332       residential: 9,
62333       service: 10,
62334       busway: 11,
62335       footway: 12
62336     };
62337     function drawTargets(selection2, graph, entities, filter2) {
62338       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
62339       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
62340       var getPath = svgPath(projection2).geojson;
62341       var activeID = context.activeID();
62342       var base = context.history().base();
62343       var data = { targets: [], nopes: [] };
62344       entities.forEach(function(way) {
62345         var features = svgSegmentWay(way, graph, activeID);
62346         data.targets.push.apply(data.targets, features.passive);
62347         data.nopes.push.apply(data.nopes, features.active);
62348       });
62349       var targetData = data.targets.filter(getPath);
62350       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
62351         return filter2(d2.properties.entity);
62352       }).data(targetData, function key(d2) {
62353         return d2.id;
62354       });
62355       targets.exit().remove();
62356       var segmentWasEdited = function(d2) {
62357         var wayID = d2.properties.entity.id;
62358         if (!base.entities[wayID] || !(0, import_fast_deep_equal7.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
62359           return false;
62360         }
62361         return d2.properties.nodes.some(function(n3) {
62362           return !base.entities[n3.id] || !(0, import_fast_deep_equal7.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
62363         });
62364       };
62365       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
62366         return "way line target target-allowed " + targetClass + d2.id;
62367       }).classed("segment-edited", segmentWasEdited);
62368       var nopeData = data.nopes.filter(getPath);
62369       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
62370         return filter2(d2.properties.entity);
62371       }).data(nopeData, function key(d2) {
62372         return d2.id;
62373       });
62374       nopes.exit().remove();
62375       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
62376         return "way line target target-nope " + nopeClass + d2.id;
62377       }).classed("segment-edited", segmentWasEdited);
62378     }
62379     function drawLines(selection2, graph, entities, filter2) {
62380       var base = context.history().base();
62381       function waystack(a4, b3) {
62382         var selected = context.selectedIDs();
62383         var scoreA = selected.indexOf(a4.id) !== -1 ? 20 : 0;
62384         var scoreB = selected.indexOf(b3.id) !== -1 ? 20 : 0;
62385         if (a4.tags.highway) {
62386           scoreA -= highway_stack[a4.tags.highway];
62387         }
62388         if (b3.tags.highway) {
62389           scoreB -= highway_stack[b3.tags.highway];
62390         }
62391         return scoreA - scoreB;
62392       }
62393       function drawLineGroup(selection3, klass, isSelected) {
62394         var mode = context.mode();
62395         var isDrawing = mode && /^draw/.test(mode.id);
62396         var selectedClass = !isDrawing && isSelected ? "selected " : "";
62397         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
62398         lines.exit().remove();
62399         lines.enter().append("path").attr("class", function(d2) {
62400           var prefix = "way line";
62401           if (!d2.hasInterestingTags()) {
62402             var parentRelations = graph.parentRelations(d2);
62403             var parentMultipolygons = parentRelations.filter(function(relation) {
62404               return relation.isMultipolygon();
62405             });
62406             if (parentMultipolygons.length > 0 && // and only multipolygon relations
62407             parentRelations.length === parentMultipolygons.length) {
62408               prefix = "relation area";
62409             }
62410           }
62411           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
62412           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
62413         }).classed("added", function(d2) {
62414           return !base.entities[d2.id];
62415         }).classed("geometry-edited", function(d2) {
62416           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
62417         }).classed("retagged", function(d2) {
62418           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
62419         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
62420         return selection3;
62421       }
62422       function getPathData(isSelected) {
62423         return function() {
62424           var layer = this.parentNode.__data__;
62425           var data = pathdata[layer] || [];
62426           return data.filter(function(d2) {
62427             if (isSelected) {
62428               return context.selectedIDs().indexOf(d2.id) !== -1;
62429             } else {
62430               return context.selectedIDs().indexOf(d2.id) === -1;
62431             }
62432           });
62433         };
62434       }
62435       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
62436         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
62437         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
62438         var markers = markergroup.selectAll("path").filter(filter2).data(
62439           function data() {
62440             return groupdata[this.parentNode.__data__] || [];
62441           },
62442           function key(d2) {
62443             return [d2.id, d2.index];
62444           }
62445         );
62446         markers.exit().remove();
62447         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
62448           return d2.d;
62449         });
62450         if (detected.ie) {
62451           markers.each(function() {
62452             this.parentNode.insertBefore(this, this);
62453           });
62454         }
62455       }
62456       var getPath = svgPath(projection2, graph);
62457       var ways = [];
62458       var onewaydata = {};
62459       var sideddata = {};
62460       var oldMultiPolygonOuters = {};
62461       for (var i3 = 0; i3 < entities.length; i3++) {
62462         var entity = entities[i3];
62463         if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
62464           ways.push(entity);
62465         }
62466       }
62467       ways = ways.filter(getPath);
62468       const pathdata = utilArrayGroupBy(ways, (way) => Math.trunc(way.layer()));
62469       Object.keys(pathdata).forEach(function(k3) {
62470         var v3 = pathdata[k3];
62471         var onewayArr = v3.filter(function(d2) {
62472           return d2.isOneWay();
62473         });
62474         var onewaySegments = svgMarkerSegments(
62475           projection2,
62476           graph,
62477           36,
62478           (entity2) => entity2.isOneWayBackwards(),
62479           (entity2) => entity2.isBiDirectional()
62480         );
62481         onewaydata[k3] = utilArrayFlatten(onewayArr.map(onewaySegments));
62482         var sidedArr = v3.filter(function(d2) {
62483           return d2.isSided();
62484         });
62485         var sidedSegments = svgMarkerSegments(
62486           projection2,
62487           graph,
62488           30
62489         );
62490         sideddata[k3] = utilArrayFlatten(sidedArr.map(sidedSegments));
62491       });
62492       var covered = selection2.selectAll(".layer-osm.covered");
62493       var uncovered = selection2.selectAll(".layer-osm.lines");
62494       var touchLayer = selection2.selectAll(".layer-touch.lines");
62495       [covered, uncovered].forEach(function(selection3) {
62496         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
62497         var layergroup = selection3.selectAll("g.layergroup").data(range3);
62498         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
62499           return "layergroup layer" + String(d2);
62500         }).merge(layergroup);
62501         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
62502           return "linegroup line-" + d2;
62503         });
62504         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
62505         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
62506         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
62507         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
62508         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
62509         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
62510         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, (d2) => {
62511           const category = onewayArrowColour(graph.entity(d2.id).tags);
62512           return `url(#ideditor-oneway-marker-${category})`;
62513         });
62514         addMarkers(
62515           layergroup,
62516           "sided",
62517           "sidedgroup",
62518           sideddata,
62519           function marker(d2) {
62520             var category = graph.entity(d2.id).sidednessIdentifier();
62521             return "url(#ideditor-sided-marker-" + category + ")";
62522           }
62523         );
62524       });
62525       touchLayer.call(drawTargets, graph, ways, filter2);
62526     }
62527     return drawLines;
62528   }
62529   var import_fast_deep_equal7;
62530   var init_lines = __esm({
62531     "modules/svg/lines.js"() {
62532       "use strict";
62533       import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
62534       init_src();
62535       init_helpers();
62536       init_tag_classes();
62537       init_osm();
62538       init_util();
62539       init_detect();
62540     }
62541   });
62542
62543   // modules/svg/midpoints.js
62544   var midpoints_exports = {};
62545   __export(midpoints_exports, {
62546     svgMidpoints: () => svgMidpoints
62547   });
62548   function svgMidpoints(projection2, context) {
62549     var targetRadius = 8;
62550     function drawTargets(selection2, graph, entities, filter2) {
62551       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62552       var getTransform = svgPointTransform(projection2).geojson;
62553       var data = entities.map(function(midpoint) {
62554         return {
62555           type: "Feature",
62556           id: midpoint.id,
62557           properties: {
62558             target: true,
62559             entity: midpoint
62560           },
62561           geometry: {
62562             type: "Point",
62563             coordinates: midpoint.loc
62564           }
62565         };
62566       });
62567       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
62568         return filter2(d2.properties.entity);
62569       }).data(data, function key(d2) {
62570         return d2.id;
62571       });
62572       targets.exit().remove();
62573       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
62574         return "node midpoint target " + fillClass + d2.id;
62575       }).attr("transform", getTransform);
62576     }
62577     function drawMidpoints(selection2, graph, entities, filter2, extent) {
62578       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
62579       var touchLayer = selection2.selectAll(".layer-touch.points");
62580       var mode = context.mode();
62581       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
62582         drawLayer.selectAll(".midpoint").remove();
62583         touchLayer.selectAll(".midpoint.target").remove();
62584         return;
62585       }
62586       var poly = extent.polygon();
62587       var midpoints = {};
62588       for (var i3 = 0; i3 < entities.length; i3++) {
62589         var entity = entities[i3];
62590         if (entity.type !== "way") continue;
62591         if (!filter2(entity)) continue;
62592         if (context.selectedIDs().indexOf(entity.id) < 0) continue;
62593         var nodes = graph.childNodes(entity);
62594         for (var j3 = 0; j3 < nodes.length - 1; j3++) {
62595           var a4 = nodes[j3];
62596           var b3 = nodes[j3 + 1];
62597           var id2 = [a4.id, b3.id].sort().join("-");
62598           if (midpoints[id2]) {
62599             midpoints[id2].parents.push(entity);
62600           } else if (geoVecLength(projection2(a4.loc), projection2(b3.loc)) > 40) {
62601             var point = geoVecInterp(a4.loc, b3.loc, 0.5);
62602             var loc = null;
62603             if (extent.intersects(point)) {
62604               loc = point;
62605             } else {
62606               for (var k3 = 0; k3 < 4; k3++) {
62607                 point = geoLineIntersection([a4.loc, b3.loc], [poly[k3], poly[k3 + 1]]);
62608                 if (point && geoVecLength(projection2(a4.loc), projection2(point)) > 20 && geoVecLength(projection2(b3.loc), projection2(point)) > 20) {
62609                   loc = point;
62610                   break;
62611                 }
62612               }
62613             }
62614             if (loc) {
62615               midpoints[id2] = {
62616                 type: "midpoint",
62617                 id: id2,
62618                 loc,
62619                 edge: [a4.id, b3.id],
62620                 parents: [entity]
62621               };
62622             }
62623           }
62624         }
62625       }
62626       function midpointFilter(d2) {
62627         if (midpoints[d2.id]) return true;
62628         for (var i4 = 0; i4 < d2.parents.length; i4++) {
62629           if (filter2(d2.parents[i4])) {
62630             return true;
62631           }
62632         }
62633         return false;
62634       }
62635       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
62636         return d2.id;
62637       });
62638       groups.exit().remove();
62639       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
62640       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
62641       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
62642       groups = groups.merge(enter).attr("transform", function(d2) {
62643         var translate = svgPointTransform(projection2);
62644         var a5 = graph.entity(d2.edge[0]);
62645         var b4 = graph.entity(d2.edge[1]);
62646         var angle2 = geoAngle(a5, b4, projection2) * (180 / Math.PI);
62647         return translate(d2) + " rotate(" + angle2 + ")";
62648       }).call(svgTagClasses().tags(
62649         function(d2) {
62650           return d2.parents[0].tags;
62651         }
62652       ));
62653       groups.select("polygon.shadow");
62654       groups.select("polygon.fill");
62655       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
62656     }
62657     return drawMidpoints;
62658   }
62659   var init_midpoints = __esm({
62660     "modules/svg/midpoints.js"() {
62661       "use strict";
62662       init_helpers();
62663       init_tag_classes();
62664       init_geo2();
62665     }
62666   });
62667
62668   // node_modules/d3-axis/src/index.js
62669   var init_src19 = __esm({
62670     "node_modules/d3-axis/src/index.js"() {
62671     }
62672   });
62673
62674   // node_modules/d3-brush/src/constant.js
62675   var init_constant7 = __esm({
62676     "node_modules/d3-brush/src/constant.js"() {
62677     }
62678   });
62679
62680   // node_modules/d3-brush/src/event.js
62681   var init_event3 = __esm({
62682     "node_modules/d3-brush/src/event.js"() {
62683     }
62684   });
62685
62686   // node_modules/d3-brush/src/noevent.js
62687   var init_noevent3 = __esm({
62688     "node_modules/d3-brush/src/noevent.js"() {
62689     }
62690   });
62691
62692   // node_modules/d3-brush/src/brush.js
62693   function number1(e3) {
62694     return [+e3[0], +e3[1]];
62695   }
62696   function number22(e3) {
62697     return [number1(e3[0]), number1(e3[1])];
62698   }
62699   function type(t2) {
62700     return { type: t2 };
62701   }
62702   var abs2, max2, min2, X4, Y3, XY;
62703   var init_brush = __esm({
62704     "node_modules/d3-brush/src/brush.js"() {
62705       init_src11();
62706       init_constant7();
62707       init_event3();
62708       init_noevent3();
62709       ({ abs: abs2, max: max2, min: min2 } = Math);
62710       X4 = {
62711         name: "x",
62712         handles: ["w", "e"].map(type),
62713         input: function(x2, e3) {
62714           return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
62715         },
62716         output: function(xy) {
62717           return xy && [xy[0][0], xy[1][0]];
62718         }
62719       };
62720       Y3 = {
62721         name: "y",
62722         handles: ["n", "s"].map(type),
62723         input: function(y2, e3) {
62724           return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
62725         },
62726         output: function(xy) {
62727           return xy && [xy[0][1], xy[1][1]];
62728         }
62729       };
62730       XY = {
62731         name: "xy",
62732         handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
62733         input: function(xy) {
62734           return xy == null ? null : number22(xy);
62735         },
62736         output: function(xy) {
62737           return xy;
62738         }
62739       };
62740     }
62741   });
62742
62743   // node_modules/d3-brush/src/index.js
62744   var init_src20 = __esm({
62745     "node_modules/d3-brush/src/index.js"() {
62746       init_brush();
62747     }
62748   });
62749
62750   // node_modules/d3-path/src/index.js
62751   var init_src21 = __esm({
62752     "node_modules/d3-path/src/index.js"() {
62753     }
62754   });
62755
62756   // node_modules/d3-chord/src/index.js
62757   var init_src22 = __esm({
62758     "node_modules/d3-chord/src/index.js"() {
62759     }
62760   });
62761
62762   // node_modules/d3-contour/src/index.js
62763   var init_src23 = __esm({
62764     "node_modules/d3-contour/src/index.js"() {
62765     }
62766   });
62767
62768   // node_modules/d3-delaunay/src/index.js
62769   var init_src24 = __esm({
62770     "node_modules/d3-delaunay/src/index.js"() {
62771     }
62772   });
62773
62774   // node_modules/d3-quadtree/src/index.js
62775   var init_src25 = __esm({
62776     "node_modules/d3-quadtree/src/index.js"() {
62777     }
62778   });
62779
62780   // node_modules/d3-force/src/index.js
62781   var init_src26 = __esm({
62782     "node_modules/d3-force/src/index.js"() {
62783     }
62784   });
62785
62786   // node_modules/d3-hierarchy/src/index.js
62787   var init_src27 = __esm({
62788     "node_modules/d3-hierarchy/src/index.js"() {
62789     }
62790   });
62791
62792   // node_modules/d3-random/src/index.js
62793   var init_src28 = __esm({
62794     "node_modules/d3-random/src/index.js"() {
62795     }
62796   });
62797
62798   // node_modules/d3-scale-chromatic/src/index.js
62799   var init_src29 = __esm({
62800     "node_modules/d3-scale-chromatic/src/index.js"() {
62801     }
62802   });
62803
62804   // node_modules/d3-shape/src/index.js
62805   var init_src30 = __esm({
62806     "node_modules/d3-shape/src/index.js"() {
62807     }
62808   });
62809
62810   // node_modules/d3/src/index.js
62811   var init_src31 = __esm({
62812     "node_modules/d3/src/index.js"() {
62813       init_src();
62814       init_src19();
62815       init_src20();
62816       init_src22();
62817       init_src7();
62818       init_src23();
62819       init_src24();
62820       init_src4();
62821       init_src6();
62822       init_src17();
62823       init_src10();
62824       init_src18();
62825       init_src26();
62826       init_src13();
62827       init_src2();
62828       init_src27();
62829       init_src8();
62830       init_src21();
62831       init_src3();
62832       init_src25();
62833       init_src28();
62834       init_src16();
62835       init_src29();
62836       init_src5();
62837       init_src30();
62838       init_src14();
62839       init_src15();
62840       init_src9();
62841       init_src11();
62842       init_src12();
62843     }
62844   });
62845
62846   // modules/svg/points.js
62847   var points_exports = {};
62848   __export(points_exports, {
62849     svgPoints: () => svgPoints
62850   });
62851   function svgPoints(projection2, context) {
62852     function markerPath(selection2, klass) {
62853       selection2.attr("class", klass).attr("transform", (d2) => isAddressPoint(d2.tags) ? `translate(-${addressShieldWidth(d2, selection2) / 2}, -8)` : "translate(-8, -23)").attr("d", (d2) => {
62854         if (!isAddressPoint(d2.tags)) {
62855           return "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";
62856         }
62857         const w3 = addressShieldWidth(d2, selection2);
62858         return `M ${w3 - 3.5} 0 a 3.5 3.5 0 0 0 3.5 3.5 l 0 9 a 3.5 3.5 0 0 0 -3.5 3.5 l -${w3 - 7} 0 a 3.5 3.5 0 0 0 -3.5 -3.5 l 0 -9 a 3.5 3.5 0 0 0 3.5 -3.5 z`;
62859       });
62860     }
62861     function sortY(a4, b3) {
62862       return b3.loc[1] - a4.loc[1];
62863     }
62864     function addressShieldWidth(d2, selection2) {
62865       const width = textWidth(d2.tags["addr:housenumber"] || d2.tags["addr:housename"] || "", 10, selection2.node().parentElement);
62866       return clamp_default(width, 10, 34) + 8;
62867     }
62868     ;
62869     function fastEntityKey(d2) {
62870       const mode = context.mode();
62871       const isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
62872       return isMoving ? d2.id : osmEntity.key(d2);
62873     }
62874     function drawTargets(selection2, graph, entities, filter2) {
62875       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62876       var getTransform = svgPointTransform(projection2).geojson;
62877       var activeID = context.activeID();
62878       var data = [];
62879       entities.forEach(function(node) {
62880         if (activeID === node.id) return;
62881         data.push({
62882           type: "Feature",
62883           id: node.id,
62884           properties: {
62885             target: true,
62886             entity: node,
62887             isAddr: isAddressPoint(node.tags)
62888           },
62889           geometry: node.asGeoJSON()
62890         });
62891       });
62892       var targets = selection2.selectAll(".point.target").filter((d2) => filter2(d2.properties.entity)).data(data, (d2) => fastEntityKey(d2.properties.entity));
62893       targets.exit().remove();
62894       targets.enter().append("rect").attr("x", (d2) => d2.properties.isAddr ? -addressShieldWidth(d2.properties.entity, selection2) / 2 : -10).attr("y", (d2) => d2.properties.isAddr ? -8 : -26).attr("width", (d2) => d2.properties.isAddr ? addressShieldWidth(d2.properties.entity, selection2) : 20).attr("height", (d2) => d2.properties.isAddr ? 16 : 30).attr("class", function(d2) {
62895         return "node point target " + fillClass + d2.id;
62896       }).merge(targets).attr("transform", getTransform);
62897     }
62898     function drawPoints(selection2, graph, entities, filter2) {
62899       var wireframe = context.surface().classed("fill-wireframe");
62900       var zoom = geoScaleToZoom(projection2.scale());
62901       var base = context.history().base();
62902       function renderAsPoint(entity) {
62903         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
62904       }
62905       var points = wireframe ? [] : entities.filter(renderAsPoint);
62906       points.sort(sortY);
62907       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
62908       var touchLayer = selection2.selectAll(".layer-touch.points");
62909       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
62910       groups.exit().remove();
62911       var enter = groups.enter().append("g").attr("class", function(d2) {
62912         return "node point " + d2.id;
62913       }).order();
62914       enter.append("path").call(markerPath, "shadow");
62915       enter.each(function(d2) {
62916         if (isAddressPoint(d2.tags)) return;
62917         select_default2(this).append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
62918       });
62919       enter.append("path").call(markerPath, "stroke");
62920       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
62921       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
62922         return !base.entities[d2.id];
62923       }).classed("moved", function(d2) {
62924         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
62925       }).classed("retagged", function(d2) {
62926         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
62927       }).call(svgTagClasses());
62928       groups.select(".shadow");
62929       groups.select(".stroke");
62930       groups.select(".icon").attr("xlink:href", function(entity) {
62931         var preset = _mainPresetIndex.match(entity, graph);
62932         var picon = preset && preset.icon;
62933         return picon ? "#" + picon : "";
62934       });
62935       touchLayer.call(drawTargets, graph, points, filter2);
62936     }
62937     return drawPoints;
62938   }
62939   var import_fast_deep_equal8;
62940   var init_points = __esm({
62941     "modules/svg/points.js"() {
62942       "use strict";
62943       import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
62944       init_lodash();
62945       init_src31();
62946       init_geo2();
62947       init_osm();
62948       init_helpers();
62949       init_tag_classes();
62950       init_presets();
62951       init_labels();
62952     }
62953   });
62954
62955   // modules/svg/turns.js
62956   var turns_exports = {};
62957   __export(turns_exports, {
62958     svgTurns: () => svgTurns
62959   });
62960   function svgTurns(projection2, context) {
62961     function icon2(turn) {
62962       var u2 = turn.u ? "-u" : "";
62963       if (turn.no) return "#iD-turn-no" + u2;
62964       if (turn.only) return "#iD-turn-only" + u2;
62965       return "#iD-turn-yes" + u2;
62966     }
62967     function drawTurns(selection2, graph, turns) {
62968       function turnTransform(d2) {
62969         var pxRadius = 50;
62970         var toWay = graph.entity(d2.to.way);
62971         var toPoints = graph.childNodes(toWay).map(function(n3) {
62972           return n3.loc;
62973         }).map(projection2);
62974         var toLength = geoPathLength(toPoints);
62975         var mid = toLength / 2;
62976         var toNode = graph.entity(d2.to.node);
62977         var toVertex = graph.entity(d2.to.vertex);
62978         var a4 = geoAngle(toVertex, toNode, projection2);
62979         var o2 = projection2(toVertex.loc);
62980         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
62981         return "translate(" + (r2 * Math.cos(a4) + o2[0]) + "," + (r2 * Math.sin(a4) + o2[1]) + ") rotate(" + a4 * 180 / Math.PI + ")";
62982       }
62983       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
62984       var touchLayer = selection2.selectAll(".layer-touch.turns");
62985       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
62986         return d2.key;
62987       });
62988       groups.exit().remove();
62989       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
62990         return "turn " + d2.key;
62991       });
62992       var turnsEnter = groupsEnter.filter(function(d2) {
62993         return !d2.u;
62994       });
62995       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
62996       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
62997       var uEnter = groupsEnter.filter(function(d2) {
62998         return d2.u;
62999       });
63000       uEnter.append("circle").attr("r", "16");
63001       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
63002       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
63003         return d2.direct === false ? "0.7" : null;
63004       }).attr("transform", turnTransform);
63005       groups.select("use").attr("xlink:href", icon2);
63006       groups.select("rect");
63007       groups.select("circle");
63008       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
63009       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
63010         return d2.key;
63011       });
63012       groups.exit().remove();
63013       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
63014         return "turn " + d2.key;
63015       });
63016       turnsEnter = groupsEnter.filter(function(d2) {
63017         return !d2.u;
63018       });
63019       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
63020       uEnter = groupsEnter.filter(function(d2) {
63021         return d2.u;
63022       });
63023       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
63024       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
63025       groups.select("rect");
63026       groups.select("circle");
63027       return this;
63028     }
63029     return drawTurns;
63030   }
63031   var init_turns = __esm({
63032     "modules/svg/turns.js"() {
63033       "use strict";
63034       init_geo2();
63035     }
63036   });
63037
63038   // modules/svg/vertices.js
63039   var vertices_exports = {};
63040   __export(vertices_exports, {
63041     svgVertices: () => svgVertices
63042   });
63043   function svgVertices(projection2, context) {
63044     var radiuses = {
63045       //       z16-, z17,   z18+,  w/icon
63046       shadow: [6, 7.5, 7.5, 12],
63047       stroke: [2.5, 3.5, 3.5, 8],
63048       fill: [1, 1.5, 1.5, 1.5]
63049     };
63050     var _currHoverTarget;
63051     var _currPersistent = {};
63052     var _currHover = {};
63053     var _prevHover = {};
63054     var _currSelected = {};
63055     var _prevSelected = {};
63056     var _radii = {};
63057     function sortY(a4, b3) {
63058       return b3.loc[1] - a4.loc[1];
63059     }
63060     function fastEntityKey(d2) {
63061       var mode = context.mode();
63062       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
63063       return isMoving ? d2.id : osmEntity.key(d2);
63064     }
63065     function draw(selection2, graph, vertices, sets2, filter2) {
63066       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
63067       var icons = {};
63068       var directions = {};
63069       var wireframe = context.surface().classed("fill-wireframe");
63070       var zoom = geoScaleToZoom(projection2.scale());
63071       var z3 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
63072       var activeID = context.activeID();
63073       var base = context.history().base();
63074       function getIcon(d2) {
63075         var entity = graph.entity(d2.id);
63076         if (entity.id in icons) return icons[entity.id];
63077         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
63078         return icons[entity.id];
63079       }
63080       function getDirections(entity) {
63081         if (entity.id in directions) return directions[entity.id];
63082         var angles = entity.directions(graph, projection2);
63083         directions[entity.id] = angles.length ? angles : false;
63084         return angles;
63085       }
63086       function updateAttributes(selection3) {
63087         ["shadow", "stroke", "fill"].forEach(function(klass) {
63088           var rads = radiuses[klass];
63089           selection3.selectAll("." + klass).each(function(entity) {
63090             var i3 = z3 && getIcon(entity);
63091             var r2 = rads[i3 ? 3 : z3];
63092             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
63093               r2 += 1.5;
63094             }
63095             if (klass === "shadow") {
63096               _radii[entity.id] = r2;
63097             }
63098             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
63099           });
63100         });
63101       }
63102       vertices.sort(sortY);
63103       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
63104       groups.exit().remove();
63105       var enter = groups.enter().append("g").attr("class", function(d2) {
63106         return "node vertex " + d2.id;
63107       }).order();
63108       enter.append("circle").attr("class", "shadow");
63109       enter.append("circle").attr("class", "stroke");
63110       enter.filter(function(d2) {
63111         return d2.hasInterestingTags();
63112       }).append("circle").attr("class", "fill");
63113       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
63114         return d2.id in sets2.selected;
63115       }).classed("shared", function(d2) {
63116         return graph.isShared(d2);
63117       }).classed("endpoint", function(d2) {
63118         return d2.isEndpoint(graph);
63119       }).classed("added", function(d2) {
63120         return !base.entities[d2.id];
63121       }).classed("moved", function(d2) {
63122         return base.entities[d2.id] && !(0, import_fast_deep_equal9.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
63123       }).classed("retagged", function(d2) {
63124         return base.entities[d2.id] && !(0, import_fast_deep_equal9.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
63125       }).call(svgTagClasses()).call(updateAttributes);
63126       var iconUse = groups.selectAll(".icon").data(function data(d2) {
63127         return zoom >= 17 && getIcon(d2) ? [d2] : [];
63128       }, fastEntityKey);
63129       iconUse.exit().remove();
63130       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
63131         var picon = getIcon(d2);
63132         return picon ? "#" + picon : "";
63133       });
63134       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
63135         return zoom >= 18 && getDirections(d2) ? [d2] : [];
63136       }, fastEntityKey);
63137       dgroups.exit().remove();
63138       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
63139       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
63140         return osmEntity.key(d2);
63141       });
63142       viewfields.exit().remove();
63143       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) {
63144         return "rotate(" + d2 + ")";
63145       });
63146     }
63147     function drawTargets(selection2, graph, entities, filter2) {
63148       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
63149       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
63150       var getTransform = svgPointTransform(projection2).geojson;
63151       var activeID = context.activeID();
63152       var data = { targets: [], nopes: [] };
63153       entities.forEach(function(node) {
63154         if (activeID === node.id) return;
63155         var vertexType = svgPassiveVertex(node, graph, activeID);
63156         if (vertexType !== 0) {
63157           data.targets.push({
63158             type: "Feature",
63159             id: node.id,
63160             properties: {
63161               target: true,
63162               entity: node
63163             },
63164             geometry: node.asGeoJSON()
63165           });
63166         } else {
63167           data.nopes.push({
63168             type: "Feature",
63169             id: node.id + "-nope",
63170             properties: {
63171               nope: true,
63172               target: true,
63173               entity: node
63174             },
63175             geometry: node.asGeoJSON()
63176           });
63177         }
63178       });
63179       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
63180         return filter2(d2.properties.entity);
63181       }).data(data.targets, function key(d2) {
63182         return d2.id;
63183       });
63184       targets.exit().remove();
63185       targets.enter().append("circle").attr("r", function(d2) {
63186         return _radii[d2.id] || radiuses.shadow[3];
63187       }).merge(targets).attr("class", function(d2) {
63188         return "node vertex target target-allowed " + targetClass + d2.id;
63189       }).attr("transform", getTransform);
63190       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
63191         return filter2(d2.properties.entity);
63192       }).data(data.nopes, function key(d2) {
63193         return d2.id;
63194       });
63195       nopes.exit().remove();
63196       nopes.enter().append("circle").attr("r", function(d2) {
63197         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
63198       }).merge(nopes).attr("class", function(d2) {
63199         return "node vertex target target-nope " + nopeClass + d2.id;
63200       }).attr("transform", getTransform);
63201     }
63202     function renderAsVertex(entity, graph, wireframe, zoom) {
63203       var geometry = entity.geometry(graph);
63204       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
63205     }
63206     function isEditedNode(node, base, head) {
63207       var baseNode = base.entities[node.id];
63208       var headNode = head.entities[node.id];
63209       return !headNode || !baseNode || !(0, import_fast_deep_equal9.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal9.default)(headNode.loc, baseNode.loc);
63210     }
63211     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
63212       var results = {};
63213       var seenIds = {};
63214       function addChildVertices(entity) {
63215         if (seenIds[entity.id]) return;
63216         seenIds[entity.id] = true;
63217         var geometry = entity.geometry(graph);
63218         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
63219           var i3;
63220           if (entity.type === "way") {
63221             for (i3 = 0; i3 < entity.nodes.length; i3++) {
63222               var child = graph.hasEntity(entity.nodes[i3]);
63223               if (child) {
63224                 addChildVertices(child);
63225               }
63226             }
63227           } else if (entity.type === "relation") {
63228             for (i3 = 0; i3 < entity.members.length; i3++) {
63229               var member = graph.hasEntity(entity.members[i3].id);
63230               if (member) {
63231                 addChildVertices(member);
63232               }
63233             }
63234           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
63235             results[entity.id] = entity;
63236           }
63237         }
63238       }
63239       ids.forEach(function(id2) {
63240         var entity = graph.hasEntity(id2);
63241         if (!entity) return;
63242         if (entity.type === "node") {
63243           if (renderAsVertex(entity, graph, wireframe, zoom)) {
63244             results[entity.id] = entity;
63245             graph.parentWays(entity).forEach(function(entity2) {
63246               addChildVertices(entity2);
63247             });
63248           }
63249         } else {
63250           addChildVertices(entity);
63251         }
63252       });
63253       return results;
63254     }
63255     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
63256       var wireframe = context.surface().classed("fill-wireframe");
63257       var visualDiff = context.surface().classed("highlight-edited");
63258       var zoom = geoScaleToZoom(projection2.scale());
63259       var mode = context.mode();
63260       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
63261       var base = context.history().base();
63262       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
63263       var touchLayer = selection2.selectAll(".layer-touch.points");
63264       if (fullRedraw) {
63265         _currPersistent = {};
63266         _radii = {};
63267       }
63268       for (var i3 = 0; i3 < entities.length; i3++) {
63269         var entity = entities[i3];
63270         var geometry = entity.geometry(graph);
63271         var keep = false;
63272         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
63273           _currPersistent[entity.id] = entity;
63274           keep = true;
63275         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
63276           _currPersistent[entity.id] = entity;
63277           keep = true;
63278         }
63279         if (!keep && !fullRedraw) {
63280           delete _currPersistent[entity.id];
63281         }
63282       }
63283       var sets2 = {
63284         persistent: _currPersistent,
63285         // persistent = important vertices (render always)
63286         selected: _currSelected,
63287         // selected + siblings of selected (render always)
63288         hovered: _currHover
63289         // hovered + siblings of hovered (render only in draw modes)
63290       };
63291       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
63292       var filterRendered = function(d2) {
63293         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
63294       };
63295       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
63296       var filterTouch = function(d2) {
63297         return isMoving ? true : filterRendered(d2);
63298       };
63299       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
63300       function currentVisible(which) {
63301         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
63302           return entity2 && entity2.intersects(extent, graph);
63303         });
63304       }
63305     }
63306     drawVertices.drawSelected = function(selection2, graph, extent) {
63307       var wireframe = context.surface().classed("fill-wireframe");
63308       var zoom = geoScaleToZoom(projection2.scale());
63309       _prevSelected = _currSelected || {};
63310       if (context.map().isInWideSelection()) {
63311         _currSelected = {};
63312         context.selectedIDs().forEach(function(id2) {
63313           var entity = graph.hasEntity(id2);
63314           if (!entity) return;
63315           if (entity.type === "node") {
63316             if (renderAsVertex(entity, graph, wireframe, zoom)) {
63317               _currSelected[entity.id] = entity;
63318             }
63319           }
63320         });
63321       } else {
63322         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
63323       }
63324       var filter2 = function(d2) {
63325         return d2.id in _prevSelected;
63326       };
63327       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
63328     };
63329     drawVertices.drawHover = function(selection2, graph, target, extent) {
63330       if (target === _currHoverTarget) return;
63331       var wireframe = context.surface().classed("fill-wireframe");
63332       var zoom = geoScaleToZoom(projection2.scale());
63333       _prevHover = _currHover || {};
63334       _currHoverTarget = target;
63335       var entity = target && target.properties && target.properties.entity;
63336       if (entity) {
63337         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
63338       } else {
63339         _currHover = {};
63340       }
63341       var filter2 = function(d2) {
63342         return d2.id in _prevHover;
63343       };
63344       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
63345     };
63346     return drawVertices;
63347   }
63348   var import_fast_deep_equal9;
63349   var init_vertices = __esm({
63350     "modules/svg/vertices.js"() {
63351       "use strict";
63352       import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
63353       init_src5();
63354       init_presets();
63355       init_geo2();
63356       init_osm();
63357       init_helpers();
63358       init_tag_classes();
63359     }
63360   });
63361
63362   // modules/svg/index.js
63363   var svg_exports = {};
63364   __export(svg_exports, {
63365     svgAreas: () => svgAreas,
63366     svgData: () => svgData,
63367     svgDebug: () => svgDebug,
63368     svgDefs: () => svgDefs,
63369     svgGeolocate: () => svgGeolocate,
63370     svgIcon: () => svgIcon,
63371     svgKartaviewImages: () => svgKartaviewImages,
63372     svgKeepRight: () => svgKeepRight,
63373     svgLabels: () => svgLabels,
63374     svgLayers: () => svgLayers,
63375     svgLines: () => svgLines,
63376     svgMapilioImages: () => svgMapilioImages,
63377     svgMapillaryImages: () => svgMapillaryImages,
63378     svgMapillarySigns: () => svgMapillarySigns,
63379     svgMarkerSegments: () => svgMarkerSegments,
63380     svgMidpoints: () => svgMidpoints,
63381     svgNotes: () => svgNotes,
63382     svgOsm: () => svgOsm,
63383     svgPanoramaxImages: () => svgPanoramaxImages,
63384     svgPassiveVertex: () => svgPassiveVertex,
63385     svgPath: () => svgPath,
63386     svgPointTransform: () => svgPointTransform,
63387     svgPoints: () => svgPoints,
63388     svgRelationMemberTags: () => svgRelationMemberTags,
63389     svgSegmentWay: () => svgSegmentWay,
63390     svgStreetside: () => svgStreetside,
63391     svgTagClasses: () => svgTagClasses,
63392     svgTagPattern: () => svgTagPattern,
63393     svgTouch: () => svgTouch,
63394     svgTurns: () => svgTurns,
63395     svgVegbilder: () => svgVegbilder,
63396     svgVertices: () => svgVertices
63397   });
63398   var init_svg = __esm({
63399     "modules/svg/index.js"() {
63400       "use strict";
63401       init_areas();
63402       init_data2();
63403       init_debug();
63404       init_defs();
63405       init_keepRight2();
63406       init_icon();
63407       init_geolocate();
63408       init_labels();
63409       init_layers();
63410       init_lines();
63411       init_mapillary_images();
63412       init_mapillary_signs();
63413       init_midpoints();
63414       init_notes();
63415       init_helpers();
63416       init_kartaview_images();
63417       init_osm3();
63418       init_helpers();
63419       init_helpers();
63420       init_helpers();
63421       init_points();
63422       init_helpers();
63423       init_helpers();
63424       init_streetside2();
63425       init_vegbilder2();
63426       init_tag_classes();
63427       init_tag_pattern();
63428       init_touch();
63429       init_turns();
63430       init_vertices();
63431       init_mapilio_images();
63432       init_panoramax_images();
63433     }
63434   });
63435
63436   // modules/ui/length_indicator.js
63437   var length_indicator_exports = {};
63438   __export(length_indicator_exports, {
63439     uiLengthIndicator: () => uiLengthIndicator
63440   });
63441   function uiLengthIndicator(maxChars) {
63442     var _wrap = select_default2(null);
63443     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
63444       selection2.text("");
63445       selection2.call(svgIcon("#iD-icon-alert", "inline"));
63446       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
63447     });
63448     var _silent = false;
63449     var lengthIndicator = function(selection2) {
63450       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
63451       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
63452       selection2.call(_tooltip);
63453     };
63454     lengthIndicator.update = function(val) {
63455       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
63456       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
63457       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");
63458       if (_silent) return;
63459       if (strLen > maxChars) {
63460         _tooltip.show();
63461       } else {
63462         _tooltip.hide();
63463       }
63464     };
63465     lengthIndicator.silent = function(val) {
63466       if (!arguments.length) return _silent;
63467       _silent = val;
63468       return lengthIndicator;
63469     };
63470     return lengthIndicator;
63471   }
63472   var init_length_indicator = __esm({
63473     "modules/ui/length_indicator.js"() {
63474       "use strict";
63475       init_src5();
63476       init_localizer();
63477       init_svg();
63478       init_util();
63479       init_popover();
63480     }
63481   });
63482
63483   // modules/ui/fields/combo.js
63484   var combo_exports = {};
63485   __export(combo_exports, {
63486     uiFieldCombo: () => uiFieldCombo,
63487     uiFieldManyCombo: () => uiFieldCombo,
63488     uiFieldMultiCombo: () => uiFieldCombo,
63489     uiFieldNetworkCombo: () => uiFieldCombo,
63490     uiFieldSemiCombo: () => uiFieldCombo,
63491     uiFieldTypeCombo: () => uiFieldCombo
63492   });
63493   function uiFieldCombo(field, context) {
63494     var dispatch14 = dispatch_default("change");
63495     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
63496     var _isNetwork = field.type === "networkCombo";
63497     var _isSemi = field.type === "semiCombo";
63498     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
63499     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
63500     var _snake_case = field.snake_case || field.snake_case === void 0;
63501     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
63502     var _container = select_default2(null);
63503     var _inputWrap = select_default2(null);
63504     var _input = select_default2(null);
63505     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
63506     var _comboData = [];
63507     var _multiData = [];
63508     var _entityIDs = [];
63509     var _tags;
63510     var _countryCode;
63511     var _staticPlaceholder;
63512     var _customOptions = [];
63513     var _dataDeprecated = [];
63514     _mainFileFetcher.get("deprecated").then(function(d2) {
63515       _dataDeprecated = d2;
63516     }).catch(function() {
63517     });
63518     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
63519       field.key += ":";
63520     }
63521     function snake(s2) {
63522       return s2.replace(/\s+/g, "_");
63523     }
63524     function clean2(s2) {
63525       return s2.split(";").map(function(s3) {
63526         return s3.trim();
63527       }).join(";");
63528     }
63529     function tagValue(dval) {
63530       dval = clean2(dval || "");
63531       var found = getOptions(true).find(function(o2) {
63532         return o2.key && clean2(o2.value) === dval;
63533       });
63534       if (found) return found.key;
63535       if (field.type === "typeCombo" && !dval) {
63536         return "yes";
63537       }
63538       return restrictTagValueSpelling(dval) || void 0;
63539     }
63540     function restrictTagValueSpelling(dval) {
63541       if (_snake_case) {
63542         dval = snake(dval);
63543       }
63544       if (!field.caseSensitive) {
63545         dval = dval.toLowerCase();
63546       }
63547       return dval;
63548     }
63549     function getLabelId(field2, v3) {
63550       return field2.hasTextForStringId(`options.${v3}.title`) ? `options.${v3}.title` : `options.${v3}`;
63551     }
63552     function displayValue(tval) {
63553       tval = tval || "";
63554       var stringsField = field.resolveReference("stringsCrossReference");
63555       const labelId = getLabelId(stringsField, tval);
63556       if (stringsField.hasTextForStringId(labelId)) {
63557         return stringsField.t(labelId, { default: tval });
63558       }
63559       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
63560         return "";
63561       }
63562       return tval;
63563     }
63564     function renderValue(tval) {
63565       tval = tval || "";
63566       var stringsField = field.resolveReference("stringsCrossReference");
63567       const labelId = getLabelId(stringsField, tval);
63568       if (stringsField.hasTextForStringId(labelId)) {
63569         return stringsField.t.append(labelId, { default: tval });
63570       }
63571       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
63572         tval = "";
63573       }
63574       return (selection2) => selection2.text(tval);
63575     }
63576     function objectDifference(a4, b3) {
63577       return a4.filter(function(d1) {
63578         return !b3.some(function(d2) {
63579           return d1.value === d2.value;
63580         });
63581       });
63582     }
63583     function initCombo(selection2, attachTo) {
63584       if (!_allowCustomValues) {
63585         selection2.attr("readonly", "readonly");
63586       }
63587       if (_showTagInfoSuggestions && services.taginfo) {
63588         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
63589         setTaginfoValues("", setPlaceholder);
63590       } else {
63591         selection2.call(_combobox, attachTo);
63592         setTimeout(() => setStaticValues(setPlaceholder), 0);
63593       }
63594     }
63595     function getOptions(allOptions) {
63596       var stringsField = field.resolveReference("stringsCrossReference");
63597       if (!(field.options || stringsField.options)) return [];
63598       let options;
63599       if (allOptions !== true) {
63600         options = field.options || stringsField.options;
63601       } else {
63602         options = [].concat(field.options, stringsField.options).filter(Boolean);
63603       }
63604       const result = options.map(function(v3) {
63605         const labelId = getLabelId(stringsField, v3);
63606         return {
63607           key: v3,
63608           value: stringsField.t(labelId, { default: v3 }),
63609           title: stringsField.t(`options.${v3}.description`, { default: v3 }),
63610           display: addComboboxIcons(stringsField.t.append(labelId, { default: v3 }), v3),
63611           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
63612         };
63613       });
63614       return [...result, ..._customOptions];
63615     }
63616     function hasStaticValues() {
63617       return getOptions().length > 0;
63618     }
63619     function setStaticValues(callback, filter2) {
63620       _comboData = getOptions();
63621       if (filter2 !== void 0) {
63622         _comboData = _comboData.filter(filter2);
63623       }
63624       _comboData = objectDifference(_comboData, _multiData);
63625       _combobox.data(_comboData);
63626       _container.classed("empty-combobox", _comboData.length === 0);
63627       if (callback) callback(_comboData);
63628     }
63629     function setTaginfoValues(q3, callback) {
63630       var queryFilter = (d2) => d2.value.toLowerCase().includes(q3.toLowerCase()) || d2.key.toLowerCase().includes(q3.toLowerCase());
63631       if (hasStaticValues()) {
63632         setStaticValues(callback, queryFilter);
63633       }
63634       var stringsField = field.resolveReference("stringsCrossReference");
63635       var fn = _isMulti ? "multikeys" : "values";
63636       var query = (_isMulti ? field.key : "") + q3;
63637       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q3.toLowerCase()) === 0;
63638       if (hasCountryPrefix) {
63639         query = _countryCode + ":";
63640       }
63641       var params = {
63642         debounce: q3 !== "",
63643         key: field.key,
63644         query
63645       };
63646       if (_entityIDs.length) {
63647         params.geometry = context.graph().geometry(_entityIDs[0]);
63648       }
63649       services.taginfo[fn](params, function(err, data) {
63650         if (err) return;
63651         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
63652         data = data.filter((d2) => {
63653           var value = d2.value;
63654           if (_isMulti) {
63655             value = value.slice(field.key.length);
63656           }
63657           return value === restrictTagValueSpelling(value);
63658         });
63659         var deprecatedValues = deprecatedTagValuesByKey(_dataDeprecated)[field.key];
63660         if (deprecatedValues) {
63661           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
63662         }
63663         if (hasCountryPrefix) {
63664           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
63665         }
63666         const additionalOptions = (field.options || stringsField.options || []).filter((v3) => !data.some((dv) => dv.value === (_isMulti ? field.key + v3 : v3))).map((v3) => ({ value: v3 }));
63667         _container.classed("empty-combobox", data.length === 0);
63668         _comboData = data.concat(additionalOptions).map(function(d2) {
63669           var v3 = d2.value;
63670           if (_isMulti) v3 = v3.replace(field.key, "");
63671           const labelId = getLabelId(stringsField, v3);
63672           var isLocalizable = stringsField.hasTextForStringId(labelId);
63673           var label = stringsField.t(labelId, { default: v3 });
63674           return {
63675             key: v3,
63676             value: label,
63677             title: stringsField.t(`options.${v3}.description`, { default: isLocalizable ? v3 : d2.title !== label ? d2.title : "" }),
63678             display: addComboboxIcons(stringsField.t.append(labelId, { default: v3 }), v3),
63679             klass: isLocalizable ? "" : "raw-option"
63680           };
63681         });
63682         _comboData = _comboData.filter(queryFilter);
63683         _comboData = objectDifference(_comboData, _multiData);
63684         if (callback) callback(_comboData, hasStaticValues());
63685       });
63686     }
63687     function addComboboxIcons(disp, value) {
63688       const iconsField = field.resolveReference("iconsCrossReference");
63689       if (iconsField.icons) {
63690         return function(selection2) {
63691           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
63692           if (iconsField.icons[value]) {
63693             span.call(svgIcon(`#${iconsField.icons[value]}`));
63694           }
63695           disp.call(this, selection2);
63696         };
63697       }
63698       return disp;
63699     }
63700     function setPlaceholder(values) {
63701       if (_isMulti || _isSemi) {
63702         _staticPlaceholder = field.placeholder() || _t("inspector.add");
63703       } else {
63704         var vals = values.map(function(d2) {
63705           return d2.value;
63706         }).filter(function(s2) {
63707           return s2.length < 20;
63708         });
63709         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
63710           return d2.key;
63711         });
63712         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
63713       }
63714       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
63715         _staticPlaceholder += "\u2026";
63716       }
63717       var ph;
63718       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
63719         ph = _t("inspector.multiple_values");
63720       } else {
63721         ph = _staticPlaceholder;
63722       }
63723       _container.selectAll("input").attr("placeholder", ph);
63724       var hideAdd = !_allowCustomValues && !values.length;
63725       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
63726     }
63727     function change() {
63728       var t2 = {};
63729       var val;
63730       if (_isMulti || _isSemi) {
63731         var vals;
63732         if (_isMulti) {
63733           vals = [tagValue(utilGetSetValue(_input))];
63734         } else if (_isSemi) {
63735           val = tagValue(utilGetSetValue(_input)) || "";
63736           val = val.replace(/,/g, ";");
63737           vals = val.split(";");
63738         }
63739         vals = vals.filter(Boolean);
63740         if (!vals.length) return;
63741         _container.classed("active", false);
63742         utilGetSetValue(_input, "");
63743         if (_isMulti) {
63744           utilArrayUniq(vals).forEach(function(v3) {
63745             var key = (field.key || "") + v3;
63746             if (_tags) {
63747               var old = _tags[key];
63748               if (typeof old === "string" && old.toLowerCase() !== "no") return;
63749             }
63750             key = context.cleanTagKey(key);
63751             field.keys.push(key);
63752             t2[key] = "yes";
63753           });
63754         } else if (_isSemi) {
63755           var arr = _multiData.map(function(d2) {
63756             return d2.key;
63757           });
63758           arr = arr.concat(vals);
63759           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
63760         }
63761         window.setTimeout(function() {
63762           _input.node().focus();
63763         }, 10);
63764       } else {
63765         var rawValue = utilGetSetValue(_input);
63766         if (!rawValue && Array.isArray(_tags[field.key])) return;
63767         val = context.cleanTagValue(tagValue(rawValue));
63768         t2[field.key] = val || void 0;
63769       }
63770       dispatch14.call("change", this, t2);
63771     }
63772     function removeMultikey(d3_event, d2) {
63773       d3_event.preventDefault();
63774       d3_event.stopPropagation();
63775       var t2 = {};
63776       if (_isMulti) {
63777         t2[d2.key] = void 0;
63778       } else if (_isSemi) {
63779         var arr = _multiData.map(function(md) {
63780           return md.key === d2.key ? null : md.key;
63781         }).filter(Boolean);
63782         arr = utilArrayUniq(arr);
63783         t2[field.key] = arr.length ? arr.join(";") : void 0;
63784         _lengthIndicator.update(t2[field.key]);
63785       }
63786       dispatch14.call("change", this, t2);
63787     }
63788     function invertMultikey(d3_event, d2) {
63789       d3_event.preventDefault();
63790       d3_event.stopPropagation();
63791       var t2 = {};
63792       if (_isMulti) {
63793         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
63794       }
63795       dispatch14.call("change", this, t2);
63796     }
63797     function combo(selection2) {
63798       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
63799       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
63800       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
63801       if (_isMulti || _isSemi) {
63802         _container = _container.selectAll(".chiplist").data([0]);
63803         var listClass = "chiplist";
63804         if (field.key === "destination" || field.key === "via") {
63805           listClass += " full-line-chips";
63806         }
63807         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
63808           window.setTimeout(function() {
63809             _input.node().focus();
63810           }, 10);
63811         }).merge(_container);
63812         _inputWrap = _container.selectAll(".input-wrap").data([0]);
63813         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
63814         var hideAdd = !_allowCustomValues && !_comboData.length;
63815         _inputWrap.style("display", hideAdd ? "none" : null);
63816         _input = _inputWrap.selectAll("input").data([0]);
63817       } else {
63818         _input = _container.selectAll("input").data([0]);
63819       }
63820       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
63821       if (_isSemi) {
63822         _inputWrap.call(_lengthIndicator);
63823       } else if (!_isMulti) {
63824         _container.call(_lengthIndicator);
63825       }
63826       if (_isNetwork) {
63827         var extent = combinedEntityExtent();
63828         var countryCode = extent && iso1A2Code(extent.center());
63829         _countryCode = countryCode && countryCode.toLowerCase();
63830       }
63831       _input.on("change", change).on("blur", change).on("input", function() {
63832         let val = utilGetSetValue(_input);
63833         updateIcon(val);
63834         if (_isSemi && _tags[field.key]) {
63835           val += ";" + _tags[field.key];
63836         }
63837         _lengthIndicator.update(val);
63838       });
63839       _input.on("keydown.field", function(d3_event) {
63840         switch (d3_event.keyCode) {
63841           case 13:
63842             _input.node().blur();
63843             d3_event.stopPropagation();
63844             break;
63845         }
63846       });
63847       if (_isMulti || _isSemi) {
63848         _combobox.on("accept", function() {
63849           _input.node().blur();
63850           _input.node().focus();
63851         });
63852         _input.on("focus", function() {
63853           _container.classed("active", true);
63854         });
63855       }
63856       _combobox.on("cancel", function() {
63857         _input.node().blur();
63858       }).on("update", function() {
63859         updateIcon(utilGetSetValue(_input));
63860       });
63861     }
63862     function updateIcon(value) {
63863       value = tagValue(value);
63864       let container = _container;
63865       if (field.type === "multiCombo" || field.type === "semiCombo") {
63866         container = _container.select(".input-wrap");
63867       }
63868       const iconsField = field.resolveReference("iconsCrossReference");
63869       if (iconsField.icons) {
63870         container.selectAll(".tag-value-icon").remove();
63871         if (iconsField.icons[value]) {
63872           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
63873         }
63874       }
63875     }
63876     combo.tags = function(tags) {
63877       _tags = tags;
63878       var stringsField = field.resolveReference("stringsCrossReference");
63879       var isMixed = Array.isArray(tags[field.key]);
63880       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
63881       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
63882       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
63883       var isReadOnly = !_allowCustomValues;
63884       if (_isMulti || _isSemi) {
63885         _multiData = [];
63886         var maxLength;
63887         if (_isMulti) {
63888           for (var k3 in tags) {
63889             if (field.key && k3.indexOf(field.key) !== 0) continue;
63890             if (!field.key && field.keys.indexOf(k3) === -1) continue;
63891             var v3 = tags[k3];
63892             var suffix = field.key ? k3.slice(field.key.length) : k3;
63893             _multiData.push({
63894               key: k3,
63895               value: displayValue(suffix),
63896               display: addComboboxIcons(renderValue(suffix), suffix),
63897               state: typeof v3 === "string" ? v3.toLowerCase() : "",
63898               isMixed: Array.isArray(v3)
63899             });
63900           }
63901           if (field.key) {
63902             field.keys = _multiData.map(function(d2) {
63903               return d2.key;
63904             });
63905             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
63906           } else {
63907             maxLength = context.maxCharsForTagKey();
63908           }
63909         } else if (_isSemi) {
63910           var allValues = [];
63911           var commonValues;
63912           if (Array.isArray(tags[field.key])) {
63913             tags[field.key].forEach(function(tagVal) {
63914               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
63915               allValues = allValues.concat(thisVals);
63916               if (!commonValues) {
63917                 commonValues = thisVals;
63918               } else {
63919                 commonValues = commonValues.filter((value) => thisVals.includes(value));
63920               }
63921             });
63922             allValues = utilArrayUniq(allValues).filter(Boolean);
63923           } else {
63924             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
63925             commonValues = allValues;
63926           }
63927           _multiData = allValues.map(function(v4) {
63928             return {
63929               key: v4,
63930               value: displayValue(v4),
63931               display: addComboboxIcons(renderValue(v4), v4),
63932               isMixed: !commonValues.includes(v4)
63933             };
63934           });
63935           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
63936           maxLength = context.maxCharsForTagValue() - currLength;
63937           if (currLength > 0) {
63938             maxLength -= 1;
63939           }
63940         }
63941         maxLength = Math.max(0, maxLength);
63942         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
63943         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
63944         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
63945         var chips = _container.selectAll(".chip").data(_multiData);
63946         chips.exit().remove();
63947         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
63948         enter.append("span");
63949         const field_buttons = enter.append("div").attr("class", "field_buttons");
63950         field_buttons.append("a").attr("class", "remove");
63951         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
63952           var k4 = d2.key;
63953           if (_isMulti) k4 = k4.replace(field.key, "");
63954           return !stringsField.hasTextForStringId("options." + k4);
63955         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
63956           return d2.isMixed;
63957         }).attr("title", function(d2) {
63958           if (d2.isMixed) {
63959             return _t("inspector.unshared_value_tooltip");
63960           }
63961           if (!["yes", "no"].includes(d2.state)) {
63962             return d2.state;
63963           }
63964           return null;
63965         }).classed("negated", (d2) => d2.state === "no");
63966         if (!_isSemi) {
63967           chips.selectAll("input[type=checkbox]").remove();
63968           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);
63969         }
63970         if (allowDragAndDrop) {
63971           registerDragAndDrop(chips);
63972         }
63973         chips.each(function(d2) {
63974           const selection2 = select_default2(this);
63975           const text_span = selection2.select("span");
63976           const field_buttons2 = selection2.select(".field_buttons");
63977           const clean_value = d2.value.trim();
63978           text_span.text("");
63979           if (!field_buttons2.select("button").empty()) {
63980             field_buttons2.select("button").remove();
63981           }
63982           if (clean_value.startsWith("https://")) {
63983             text_span.text(clean_value);
63984             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) {
63985               d3_event.preventDefault();
63986               window.open(clean_value, "_blank");
63987             });
63988             return;
63989           }
63990           if (d2.display) {
63991             d2.display(text_span);
63992             return;
63993           }
63994           text_span.text(d2.value);
63995         });
63996         chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
63997         updateIcon("");
63998       } else {
63999         var mixedValues = isMixed && tags[field.key].map(function(val) {
64000           return displayValue(val);
64001         }).filter(Boolean);
64002         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) {
64003           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
64004             d3_event.preventDefault();
64005             d3_event.stopPropagation();
64006             var t2 = {};
64007             t2[field.key] = void 0;
64008             dispatch14.call("change", this, t2);
64009           }
64010         });
64011         if (!Array.isArray(tags[field.key])) {
64012           updateIcon(tags[field.key]);
64013         }
64014         if (!isMixed) {
64015           _lengthIndicator.update(tags[field.key]);
64016         }
64017       }
64018       const refreshStyles = () => {
64019         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
64020       };
64021       _input.on("input.refreshStyles", refreshStyles);
64022       _combobox.on("update.refreshStyles", refreshStyles);
64023       refreshStyles();
64024     };
64025     function registerDragAndDrop(selection2) {
64026       var dragOrigin, targetIndex;
64027       selection2.call(
64028         drag_default().on("start", function(d3_event) {
64029           dragOrigin = {
64030             x: d3_event.x,
64031             y: d3_event.y
64032           };
64033           targetIndex = null;
64034         }).on("drag", function(d3_event) {
64035           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
64036           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
64037           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
64038           var index = selection2.nodes().indexOf(this);
64039           select_default2(this).classed("dragging", true);
64040           targetIndex = null;
64041           var targetIndexOffsetTop = null;
64042           var draggedTagWidth = select_default2(this).node().offsetWidth;
64043           if (field.key === "destination" || field.key === "via") {
64044             _container.selectAll(".chip").style("transform", function(d2, index2) {
64045               var node = select_default2(this).node();
64046               if (index === index2) {
64047                 return "translate(" + x2 + "px, " + y2 + "px)";
64048               } else if (index2 > index && d3_event.y > node.offsetTop) {
64049                 if (targetIndex === null || index2 > targetIndex) {
64050                   targetIndex = index2;
64051                 }
64052                 return "translateY(-100%)";
64053               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
64054                 if (targetIndex === null || index2 < targetIndex) {
64055                   targetIndex = index2;
64056                 }
64057                 return "translateY(100%)";
64058               }
64059               return null;
64060             });
64061           } else {
64062             _container.selectAll(".chip").each(function(d2, index2) {
64063               var node = select_default2(this).node();
64064               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) {
64065                 targetIndex = index2;
64066                 targetIndexOffsetTop = node.offsetTop;
64067               }
64068             }).style("transform", function(d2, index2) {
64069               var node = select_default2(this).node();
64070               if (index === index2) {
64071                 return "translate(" + x2 + "px, " + y2 + "px)";
64072               }
64073               if (node.offsetTop === targetIndexOffsetTop) {
64074                 if (index2 < index && index2 >= targetIndex) {
64075                   return "translateX(" + draggedTagWidth + "px)";
64076                 } else if (index2 > index && index2 <= targetIndex) {
64077                   return "translateX(-" + draggedTagWidth + "px)";
64078                 }
64079               }
64080               return null;
64081             });
64082           }
64083         }).on("end", function() {
64084           if (!select_default2(this).classed("dragging")) {
64085             return;
64086           }
64087           var index = selection2.nodes().indexOf(this);
64088           select_default2(this).classed("dragging", false);
64089           _container.selectAll(".chip").style("transform", null);
64090           if (typeof targetIndex === "number") {
64091             var element = _multiData[index];
64092             _multiData.splice(index, 1);
64093             _multiData.splice(targetIndex, 0, element);
64094             var t2 = {};
64095             if (_multiData.length) {
64096               t2[field.key] = _multiData.map(function(element2) {
64097                 return element2.key;
64098               }).join(";");
64099             } else {
64100               t2[field.key] = void 0;
64101             }
64102             dispatch14.call("change", this, t2);
64103           }
64104           dragOrigin = void 0;
64105           targetIndex = void 0;
64106         })
64107       );
64108     }
64109     combo.setCustomOptions = (newValue) => {
64110       _customOptions = newValue;
64111     };
64112     combo.focus = function() {
64113       _input.node().focus();
64114     };
64115     combo.entityIDs = function(val) {
64116       if (!arguments.length) return _entityIDs;
64117       _entityIDs = val;
64118       return combo;
64119     };
64120     function combinedEntityExtent() {
64121       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64122     }
64123     return utilRebind(combo, dispatch14, "on");
64124   }
64125   var init_combo = __esm({
64126     "modules/ui/fields/combo.js"() {
64127       "use strict";
64128       init_src4();
64129       init_src5();
64130       init_src6();
64131       init_country_coder();
64132       init_file_fetcher();
64133       init_localizer();
64134       init_services();
64135       init_combobox();
64136       init_icon();
64137       init_keybinding();
64138       init_util();
64139       init_length_indicator();
64140       init_deprecated();
64141     }
64142   });
64143
64144   // modules/behavior/hash.js
64145   var hash_exports = {};
64146   __export(hash_exports, {
64147     behaviorHash: () => behaviorHash
64148   });
64149   function behaviorHash(context) {
64150     var _cachedHash = null;
64151     var _latitudeLimit = 90 - 1e-8;
64152     function computedHashParameters() {
64153       var map2 = context.map();
64154       var center = map2.center();
64155       var zoom = map2.zoom();
64156       var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
64157       var oldParams = utilObjectOmit(
64158         utilStringQs(window.location.hash),
64159         ["comment", "source", "hashtags", "walkthrough"]
64160       );
64161       var newParams = {};
64162       delete oldParams.id;
64163       var selected = context.selectedIDs().filter(function(id2) {
64164         return context.hasEntity(id2);
64165       });
64166       if (selected.length) {
64167         newParams.id = selected.join(",");
64168       } else if (context.selectedNoteID()) {
64169         newParams.id = `note/${context.selectedNoteID()}`;
64170       }
64171       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
64172       return Object.assign(oldParams, newParams);
64173     }
64174     function computedHash() {
64175       return "#" + utilQsString(computedHashParameters(), true);
64176     }
64177     function computedTitle(includeChangeCount) {
64178       var baseTitle = context.documentTitleBase() || "iD";
64179       var contextual;
64180       var changeCount;
64181       var titleID;
64182       var selected = context.selectedIDs().filter(function(id2) {
64183         return context.hasEntity(id2);
64184       });
64185       if (selected.length) {
64186         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
64187         if (selected.length > 1) {
64188           contextual = _t("title.labeled_and_more", {
64189             labeled: firstLabel,
64190             count: selected.length - 1
64191           });
64192         } else {
64193           contextual = firstLabel;
64194         }
64195         titleID = "context";
64196       }
64197       if (includeChangeCount) {
64198         changeCount = context.history().difference().summary().length;
64199         if (changeCount > 0) {
64200           titleID = contextual ? "changes_context" : "changes";
64201         }
64202       }
64203       if (titleID) {
64204         return _t("title.format." + titleID, {
64205           changes: changeCount,
64206           base: baseTitle,
64207           context: contextual
64208         });
64209       }
64210       return baseTitle;
64211     }
64212     function updateTitle(includeChangeCount) {
64213       if (!context.setsDocumentTitle()) return;
64214       var newTitle = computedTitle(includeChangeCount);
64215       if (document.title !== newTitle) {
64216         document.title = newTitle;
64217       }
64218     }
64219     function updateHashIfNeeded() {
64220       if (context.inIntro()) return;
64221       var latestHash = computedHash();
64222       if (_cachedHash !== latestHash) {
64223         _cachedHash = latestHash;
64224         window.history.replaceState(null, "", latestHash);
64225         updateTitle(
64226           true
64227           /* includeChangeCount */
64228         );
64229         const q3 = utilStringQs(latestHash);
64230         if (q3.map) {
64231           corePreferences("map-location", q3.map);
64232         }
64233       }
64234     }
64235     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
64236     var _throttledUpdateTitle = throttle_default(function() {
64237       updateTitle(
64238         true
64239         /* includeChangeCount */
64240       );
64241     }, 500);
64242     function hashchange() {
64243       if (window.location.hash === _cachedHash) return;
64244       _cachedHash = window.location.hash;
64245       var q3 = utilStringQs(_cachedHash);
64246       var mapArgs = (q3.map || "").split("/").map(Number);
64247       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
64248         updateHashIfNeeded();
64249       } else {
64250         if (_cachedHash === computedHash()) return;
64251         var mode = context.mode();
64252         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
64253         if (q3.id && mode) {
64254           var ids = q3.id.split(",").filter(function(id2) {
64255             return context.hasEntity(id2) || id2.startsWith("note/");
64256           });
64257           if (ids.length && ["browse", "select-note", "select"].includes(mode.id)) {
64258             if (ids.length === 1 && ids[0].startsWith("note/")) {
64259               context.enter(modeSelectNote(context, ids[0]));
64260             } else if (!utilArrayIdentical(mode.selectedIDs(), ids)) {
64261               context.enter(modeSelect(context, ids));
64262             }
64263             return;
64264           }
64265         }
64266         var center = context.map().center();
64267         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
64268         var maxdist = 500;
64269         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
64270           context.enter(modeBrowse(context));
64271           return;
64272         }
64273       }
64274     }
64275     function behavior() {
64276       context.map().on("move.behaviorHash", _throttledUpdate);
64277       context.history().on("change.behaviorHash", _throttledUpdateTitle);
64278       context.on("enter.behaviorHash", _throttledUpdate);
64279       select_default2(window).on("hashchange.behaviorHash", hashchange);
64280       var q3 = utilStringQs(window.location.hash);
64281       if (q3.id) {
64282         const selectIds = q3.id.split(",");
64283         if (selectIds.length === 1 && selectIds[0].startsWith("note/")) {
64284           const noteId = selectIds[0].split("/")[1];
64285           context.moveToNote(noteId, !q3.map);
64286         } else {
64287           context.zoomToEntities(
64288             // convert ids to short form id: node/123 -> n123
64289             selectIds.map((id2) => id2.replace(/([nwr])[^/]*\//, "$1")),
64290             !q3.map
64291           );
64292         }
64293       }
64294       if (q3.walkthrough === "true") {
64295         behavior.startWalkthrough = true;
64296       }
64297       if (q3.map) {
64298         behavior.hadLocation = true;
64299       } else if (!q3.id && corePreferences("map-location")) {
64300         const mapArgs = corePreferences("map-location").split("/").map(Number);
64301         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
64302         updateHashIfNeeded();
64303         behavior.hadLocation = true;
64304       }
64305       hashchange();
64306       updateTitle(false);
64307     }
64308     behavior.off = function() {
64309       _throttledUpdate.cancel();
64310       _throttledUpdateTitle.cancel();
64311       context.map().on("move.behaviorHash", null);
64312       context.on("enter.behaviorHash", null);
64313       select_default2(window).on("hashchange.behaviorHash", null);
64314       window.location.hash = "";
64315     };
64316     return behavior;
64317   }
64318   var init_hash = __esm({
64319     "modules/behavior/hash.js"() {
64320       "use strict";
64321       init_throttle();
64322       init_src5();
64323       init_geo2();
64324       init_browse();
64325       init_modes2();
64326       init_util();
64327       init_array3();
64328       init_utilDisplayLabel();
64329       init_localizer();
64330       init_preferences();
64331     }
64332   });
64333
64334   // modules/behavior/index.js
64335   var behavior_exports = {};
64336   __export(behavior_exports, {
64337     behaviorAddWay: () => behaviorAddWay,
64338     behaviorBreathe: () => behaviorBreathe,
64339     behaviorDrag: () => behaviorDrag,
64340     behaviorDraw: () => behaviorDraw,
64341     behaviorDrawWay: () => behaviorDrawWay,
64342     behaviorEdit: () => behaviorEdit,
64343     behaviorHash: () => behaviorHash,
64344     behaviorHover: () => behaviorHover,
64345     behaviorLasso: () => behaviorLasso,
64346     behaviorOperation: () => behaviorOperation,
64347     behaviorPaste: () => behaviorPaste,
64348     behaviorSelect: () => behaviorSelect
64349   });
64350   var init_behavior = __esm({
64351     "modules/behavior/index.js"() {
64352       "use strict";
64353       init_add_way();
64354       init_breathe();
64355       init_drag2();
64356       init_draw_way();
64357       init_draw();
64358       init_edit();
64359       init_hash();
64360       init_hover();
64361       init_lasso2();
64362       init_operation();
64363       init_paste();
64364       init_select4();
64365     }
64366   });
64367
64368   // modules/ui/account.js
64369   var account_exports = {};
64370   __export(account_exports, {
64371     uiAccount: () => uiAccount
64372   });
64373   function uiAccount(context) {
64374     const osm = context.connection();
64375     function updateUserDetails(selection2) {
64376       if (!osm) return;
64377       if (!osm.authenticated()) {
64378         render(selection2, null);
64379       } else {
64380         osm.userDetails((err, user) => {
64381           if (err && err.status === 401) {
64382             osm.logout();
64383           }
64384           render(selection2, user);
64385         });
64386       }
64387     }
64388     function render(selection2, user) {
64389       let userInfo = selection2.select(".userInfo");
64390       let loginLogout = selection2.select(".loginLogout");
64391       if (user) {
64392         userInfo.html("").classed("hide", false);
64393         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
64394         if (user.image_url) {
64395           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
64396         } else {
64397           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
64398         }
64399         userLink.append("span").attr("class", "label").text(user.display_name);
64400         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
64401           e3.preventDefault();
64402           osm.logout();
64403           osm.authenticate(void 0, { switchUser: true });
64404         });
64405       } else {
64406         userInfo.html("").classed("hide", true);
64407         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
64408           e3.preventDefault();
64409           osm.authenticate();
64410         });
64411       }
64412     }
64413     return function(selection2) {
64414       if (!osm) return;
64415       selection2.append("li").attr("class", "userInfo").classed("hide", true);
64416       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
64417       osm.on("change.account", () => updateUserDetails(selection2));
64418       updateUserDetails(selection2);
64419     };
64420   }
64421   var init_account = __esm({
64422     "modules/ui/account.js"() {
64423       "use strict";
64424       init_localizer();
64425       init_icon();
64426     }
64427   });
64428
64429   // modules/ui/attribution.js
64430   var attribution_exports = {};
64431   __export(attribution_exports, {
64432     uiAttribution: () => uiAttribution
64433   });
64434   function uiAttribution(context) {
64435     let _selection = select_default2(null);
64436     function render(selection2, data, klass) {
64437       let div = selection2.selectAll(`.${klass}`).data([0]);
64438       div = div.enter().append("div").attr("class", klass).merge(div);
64439       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
64440       attributions.exit().remove();
64441       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
64442         let attribution = select_default2(nodes[i3]);
64443         if (d2.terms_html) {
64444           attribution.html(d2.terms_html);
64445           return;
64446         }
64447         if (d2.terms_url) {
64448           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
64449         }
64450         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
64451         const terms_text = _t(
64452           `imagery.${sourceID}.attribution.text`,
64453           { default: d2.terms_text || d2.id || d2.name() }
64454         );
64455         if (d2.icon && !d2.overlay) {
64456           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
64457         }
64458         attribution.append("span").attr("class", "attribution-text").text(terms_text);
64459       }).merge(attributions);
64460       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
64461         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
64462         return notice ? [notice] : [];
64463       });
64464       copyright.exit().remove();
64465       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
64466       copyright.text(String);
64467     }
64468     function update() {
64469       let baselayer = context.background().baseLayerSource();
64470       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
64471       const z3 = context.map().zoom();
64472       let overlays = context.background().overlayLayerSources() || [];
64473       _selection.call(render, overlays.filter((s2) => s2.validZoom(z3)), "overlay-layer-attribution");
64474     }
64475     return function(selection2) {
64476       _selection = selection2;
64477       context.background().on("change.attribution", update);
64478       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
64479       update();
64480     };
64481   }
64482   var init_attribution = __esm({
64483     "modules/ui/attribution.js"() {
64484       "use strict";
64485       init_throttle();
64486       init_src5();
64487       init_localizer();
64488     }
64489   });
64490
64491   // modules/ui/contributors.js
64492   var contributors_exports = {};
64493   __export(contributors_exports, {
64494     uiContributors: () => uiContributors
64495   });
64496   function uiContributors(context) {
64497     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
64498       update();
64499     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
64500     function update() {
64501       if (!osm) return;
64502       var users = {}, entities = context.history().intersects(context.map().extent());
64503       entities.forEach(function(entity) {
64504         if (entity && entity.user) users[entity.user] = true;
64505       });
64506       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
64507       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
64508       var userList = select_default2(document.createElement("span"));
64509       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
64510         return osm.userURL(d2);
64511       }).attr("target", "_blank").text(String);
64512       if (u2.length > limit) {
64513         var count = select_default2(document.createElement("span"));
64514         var othersNum = u2.length - limit + 1;
64515         count.append("a").attr("target", "_blank").attr("href", function() {
64516           return osm.changesetsURL(context.map().center(), context.map().zoom());
64517         }).text(othersNum);
64518         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
64519       } else {
64520         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
64521       }
64522       if (!u2.length) {
64523         hidden = true;
64524         wrap2.transition().style("opacity", 0);
64525       } else if (hidden) {
64526         wrap2.transition().style("opacity", 1);
64527       }
64528     }
64529     return function(selection2) {
64530       if (!osm) return;
64531       wrap2 = selection2;
64532       update();
64533       osm.on("loaded.contributors", debouncedUpdate);
64534       context.map().on("move.contributors", debouncedUpdate);
64535     };
64536   }
64537   var init_contributors = __esm({
64538     "modules/ui/contributors.js"() {
64539       "use strict";
64540       init_debounce();
64541       init_src5();
64542       init_localizer();
64543       init_svg();
64544     }
64545   });
64546
64547   // modules/ui/edit_menu.js
64548   var edit_menu_exports = {};
64549   __export(edit_menu_exports, {
64550     uiEditMenu: () => uiEditMenu
64551   });
64552   function uiEditMenu(context) {
64553     var dispatch14 = dispatch_default("toggled");
64554     var _menu = select_default2(null);
64555     var _operations = [];
64556     var _anchorLoc = [0, 0];
64557     var _anchorLocLonLat = [0, 0];
64558     var _triggerType = "";
64559     var _vpTopMargin = 85;
64560     var _vpBottomMargin = 45;
64561     var _vpSideMargin = 35;
64562     var _menuTop = false;
64563     var _menuHeight;
64564     var _menuWidth;
64565     var _verticalPadding = 4;
64566     var _tooltipWidth = 210;
64567     var _menuSideMargin = 10;
64568     var _tooltips = [];
64569     var editMenu = function(selection2) {
64570       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
64571       var ops = _operations.filter(function(op) {
64572         return !isTouchMenu || !op.mouseOnly;
64573       });
64574       if (!ops.length) return;
64575       _tooltips = [];
64576       _menuTop = isTouchMenu;
64577       var showLabels = isTouchMenu;
64578       var buttonHeight = showLabels ? 32 : 34;
64579       if (showLabels) {
64580         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
64581           return op.title.length;
64582         })));
64583       } else {
64584         _menuWidth = 44;
64585       }
64586       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
64587       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
64588       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
64589       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
64590         return "edit-menu-item edit-menu-item-" + d2.id;
64591       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
64592         d3_event.stopPropagation();
64593       }).on("mouseenter.highlight", function(d3_event, d2) {
64594         if (!d2.relatedEntityIds || select_default2(this).classed("disabled")) return;
64595         utilHighlightEntities(d2.relatedEntityIds(), true, context);
64596       }).on("mouseleave.highlight", function(d3_event, d2) {
64597         if (!d2.relatedEntityIds) return;
64598         utilHighlightEntities(d2.relatedEntityIds(), false, context);
64599       });
64600       buttonsEnter.each(function(d2) {
64601         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
64602         _tooltips.push(tooltip);
64603         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
64604       });
64605       if (showLabels) {
64606         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
64607           select_default2(this).call(d2.title);
64608         });
64609       }
64610       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
64611         return d2.disabled();
64612       });
64613       updatePosition();
64614       var initialScale = context.projection.scale();
64615       context.map().on("move.edit-menu", function() {
64616         if (initialScale !== context.projection.scale()) {
64617           editMenu.close();
64618         }
64619       }).on("drawn.edit-menu", function(info) {
64620         if (info.full) updatePosition();
64621       });
64622       var lastPointerUpType;
64623       function pointerup(d3_event) {
64624         lastPointerUpType = d3_event.pointerType;
64625       }
64626       function click(d3_event, operation2) {
64627         d3_event.stopPropagation();
64628         if (operation2.relatedEntityIds) {
64629           utilHighlightEntities(operation2.relatedEntityIds(), false, context);
64630         }
64631         if (operation2.disabled()) {
64632           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64633             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
64634           }
64635         } else {
64636           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64637             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
64638           }
64639           operation2();
64640           editMenu.close();
64641         }
64642         lastPointerUpType = null;
64643       }
64644       dispatch14.call("toggled", this, true);
64645     };
64646     function updatePosition() {
64647       if (!_menu || _menu.empty()) return;
64648       var anchorLoc = context.projection(_anchorLocLonLat);
64649       var viewport = context.surfaceRect();
64650       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
64651         editMenu.close();
64652         return;
64653       }
64654       var menuLeft = displayOnLeft(viewport);
64655       var offset = [0, 0];
64656       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
64657       if (_menuTop) {
64658         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
64659           offset[1] = -anchorLoc[1] + _vpTopMargin;
64660         } else {
64661           offset[1] = -_menuHeight;
64662         }
64663       } else {
64664         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
64665           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
64666         } else {
64667           offset[1] = 0;
64668         }
64669       }
64670       var origin = geoVecAdd(anchorLoc, offset);
64671       var _verticalOffset = parseFloat(utilGetDimensions(select_default2(".top-toolbar-wrap"))[1]);
64672       origin[1] -= _verticalOffset;
64673       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
64674       var tooltipSide = tooltipPosition(viewport, menuLeft);
64675       _tooltips.forEach(function(tooltip) {
64676         tooltip.placement(tooltipSide);
64677       });
64678       function displayOnLeft(viewport2) {
64679         if (_mainLocalizer.textDirection() === "ltr") {
64680           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
64681             return true;
64682           }
64683           return false;
64684         } else {
64685           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
64686             return false;
64687           }
64688           return true;
64689         }
64690       }
64691       function tooltipPosition(viewport2, menuLeft2) {
64692         if (_mainLocalizer.textDirection() === "ltr") {
64693           if (menuLeft2) {
64694             return "left";
64695           }
64696           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
64697             return "left";
64698           }
64699           return "right";
64700         } else {
64701           if (!menuLeft2) {
64702             return "right";
64703           }
64704           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
64705             return "right";
64706           }
64707           return "left";
64708         }
64709       }
64710     }
64711     editMenu.close = function() {
64712       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
64713       _menu.remove();
64714       _tooltips = [];
64715       dispatch14.call("toggled", this, false);
64716     };
64717     editMenu.anchorLoc = function(val) {
64718       if (!arguments.length) return _anchorLoc;
64719       _anchorLoc = val;
64720       _anchorLocLonLat = context.projection.invert(_anchorLoc);
64721       return editMenu;
64722     };
64723     editMenu.triggerType = function(val) {
64724       if (!arguments.length) return _triggerType;
64725       _triggerType = val;
64726       return editMenu;
64727     };
64728     editMenu.operations = function(val) {
64729       if (!arguments.length) return _operations;
64730       _operations = val;
64731       return editMenu;
64732     };
64733     return utilRebind(editMenu, dispatch14, "on");
64734   }
64735   var init_edit_menu = __esm({
64736     "modules/ui/edit_menu.js"() {
64737       "use strict";
64738       init_src5();
64739       init_src4();
64740       init_geo2();
64741       init_localizer();
64742       init_tooltip();
64743       init_rebind();
64744       init_util2();
64745       init_dimensions();
64746       init_icon();
64747     }
64748   });
64749
64750   // modules/ui/feature_info.js
64751   var feature_info_exports = {};
64752   __export(feature_info_exports, {
64753     uiFeatureInfo: () => uiFeatureInfo
64754   });
64755   function uiFeatureInfo(context) {
64756     function update(selection2) {
64757       var features = context.features();
64758       var stats = features.stats();
64759       var count = 0;
64760       var hiddenList = features.hidden().map(function(k3) {
64761         if (stats[k3]) {
64762           count += stats[k3];
64763           return _t.append("inspector.title_count", {
64764             title: _t("feature." + k3 + ".description"),
64765             count: stats[k3]
64766           });
64767         }
64768         return null;
64769       }).filter(Boolean);
64770       selection2.text("");
64771       if (hiddenList.length) {
64772         var tooltipBehavior = uiTooltip().placement("top").title(function() {
64773           return (selection3) => {
64774             hiddenList.forEach((hiddenFeature) => {
64775               selection3.append("div").call(hiddenFeature);
64776             });
64777           };
64778         });
64779         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
64780           tooltipBehavior.hide();
64781           d3_event.preventDefault();
64782           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
64783         });
64784       }
64785       selection2.classed("hide", !hiddenList.length);
64786     }
64787     return function(selection2) {
64788       update(selection2);
64789       context.features().on("change.feature_info", function() {
64790         update(selection2);
64791       });
64792     };
64793   }
64794   var init_feature_info = __esm({
64795     "modules/ui/feature_info.js"() {
64796       "use strict";
64797       init_localizer();
64798       init_tooltip();
64799     }
64800   });
64801
64802   // modules/ui/flash.js
64803   var flash_exports = {};
64804   __export(flash_exports, {
64805     uiFlash: () => uiFlash
64806   });
64807   function uiFlash(context) {
64808     var _flashTimer;
64809     var _duration = 2e3;
64810     var _iconName = "#iD-icon-no";
64811     var _iconClass = "disabled";
64812     var _label = (s2) => s2.text("");
64813     function flash() {
64814       if (_flashTimer) {
64815         _flashTimer.stop();
64816       }
64817       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
64818       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
64819       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
64820       var contentEnter = content.enter().append("div").attr("class", "flash-content");
64821       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
64822       iconEnter.append("circle").attr("r", 9);
64823       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
64824       contentEnter.append("div").attr("class", "flash-text");
64825       content = content.merge(contentEnter);
64826       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
64827       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
64828       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
64829       _flashTimer = timeout_default(function() {
64830         _flashTimer = null;
64831         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
64832         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
64833       }, _duration);
64834       return content;
64835     }
64836     flash.duration = function(_3) {
64837       if (!arguments.length) return _duration;
64838       _duration = _3;
64839       return flash;
64840     };
64841     flash.label = function(_3) {
64842       if (!arguments.length) return _label;
64843       if (typeof _3 !== "function") {
64844         _label = (selection2) => selection2.text(_3);
64845       } else {
64846         _label = (selection2) => selection2.text("").call(_3);
64847       }
64848       return flash;
64849     };
64850     flash.iconName = function(_3) {
64851       if (!arguments.length) return _iconName;
64852       _iconName = _3;
64853       return flash;
64854     };
64855     flash.iconClass = function(_3) {
64856       if (!arguments.length) return _iconClass;
64857       _iconClass = _3;
64858       return flash;
64859     };
64860     return flash;
64861   }
64862   var init_flash = __esm({
64863     "modules/ui/flash.js"() {
64864       "use strict";
64865       init_src9();
64866     }
64867   });
64868
64869   // modules/ui/full_screen.js
64870   var full_screen_exports = {};
64871   __export(full_screen_exports, {
64872     uiFullScreen: () => uiFullScreen
64873   });
64874   function uiFullScreen(context) {
64875     var element = context.container().node();
64876     function getFullScreenFn() {
64877       if (element.requestFullscreen) {
64878         return element.requestFullscreen;
64879       } else if (element.msRequestFullscreen) {
64880         return element.msRequestFullscreen;
64881       } else if (element.mozRequestFullScreen) {
64882         return element.mozRequestFullScreen;
64883       } else if (element.webkitRequestFullscreen) {
64884         return element.webkitRequestFullscreen;
64885       }
64886     }
64887     function getExitFullScreenFn() {
64888       if (document.exitFullscreen) {
64889         return document.exitFullscreen;
64890       } else if (document.msExitFullscreen) {
64891         return document.msExitFullscreen;
64892       } else if (document.mozCancelFullScreen) {
64893         return document.mozCancelFullScreen;
64894       } else if (document.webkitExitFullscreen) {
64895         return document.webkitExitFullscreen;
64896       }
64897     }
64898     function isFullScreen() {
64899       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
64900     }
64901     function isSupported() {
64902       return !!getFullScreenFn();
64903     }
64904     function fullScreen(d3_event) {
64905       d3_event.preventDefault();
64906       if (!isFullScreen()) {
64907         getFullScreenFn().apply(element);
64908       } else {
64909         getExitFullScreenFn().apply(document);
64910       }
64911     }
64912     return function() {
64913       if (!isSupported()) return;
64914       var detected = utilDetect();
64915       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
64916       context.keybinding().on(keys2, fullScreen);
64917     };
64918   }
64919   var init_full_screen = __esm({
64920     "modules/ui/full_screen.js"() {
64921       "use strict";
64922       init_cmd();
64923       init_detect();
64924     }
64925   });
64926
64927   // modules/ui/geolocate.js
64928   var geolocate_exports2 = {};
64929   __export(geolocate_exports2, {
64930     uiGeolocate: () => uiGeolocate
64931   });
64932   function uiGeolocate(context) {
64933     var _geolocationOptions = {
64934       // prioritize speed and power usage over precision
64935       enableHighAccuracy: false,
64936       // don't hang indefinitely getting the location
64937       timeout: 6e3
64938       // 6sec
64939     };
64940     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
64941     var _layer = context.layers().layer("geolocate");
64942     var _position;
64943     var _extent;
64944     var _timeoutID;
64945     var _button = select_default2(null);
64946     function click() {
64947       if (context.inIntro()) return;
64948       if (!_layer.enabled() && !_locating.isShown()) {
64949         _timeoutID = setTimeout(
64950           error,
64951           1e4
64952           /* 10sec */
64953         );
64954         context.container().call(_locating);
64955         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
64956       } else {
64957         _locating.close();
64958         _layer.enabled(null, false);
64959         updateButtonState();
64960       }
64961     }
64962     function zoomTo() {
64963       context.enter(modeBrowse(context));
64964       var map2 = context.map();
64965       _layer.enabled(_position, true);
64966       updateButtonState();
64967       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
64968     }
64969     function success(geolocation) {
64970       _position = geolocation;
64971       var coords = _position.coords;
64972       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
64973       zoomTo();
64974       finish();
64975     }
64976     function error() {
64977       if (_position) {
64978         zoomTo();
64979       } else {
64980         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
64981       }
64982       finish();
64983     }
64984     function finish() {
64985       _locating.close();
64986       if (_timeoutID) {
64987         clearTimeout(_timeoutID);
64988       }
64989       _timeoutID = void 0;
64990     }
64991     function updateButtonState() {
64992       _button.classed("active", _layer.enabled());
64993       _button.attr("aria-pressed", _layer.enabled());
64994     }
64995     return function(selection2) {
64996       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
64997       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
64998         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title"))
64999       );
65000     };
65001   }
65002   var init_geolocate2 = __esm({
65003     "modules/ui/geolocate.js"() {
65004       "use strict";
65005       init_src5();
65006       init_localizer();
65007       init_tooltip();
65008       init_geo2();
65009       init_browse();
65010       init_icon();
65011       init_loading();
65012     }
65013   });
65014
65015   // modules/ui/panels/background.js
65016   var background_exports = {};
65017   __export(background_exports, {
65018     uiPanelBackground: () => uiPanelBackground
65019   });
65020   function uiPanelBackground(context) {
65021     var background = context.background();
65022     var _currSourceName = null;
65023     var _metadata = {};
65024     var _metadataKeys = [
65025       "zoom",
65026       "vintage",
65027       "source",
65028       "description",
65029       "resolution",
65030       "accuracy"
65031     ];
65032     var debouncedRedraw = debounce_default(redraw, 250);
65033     function redraw(selection2) {
65034       var source = background.baseLayerSource();
65035       if (!source) return;
65036       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
65037       var sourceLabel = source.label();
65038       if (_currSourceName !== sourceLabel) {
65039         _currSourceName = sourceLabel;
65040         _metadata = {};
65041       }
65042       selection2.text("");
65043       var list = selection2.append("ul").attr("class", "background-info");
65044       list.append("li").call(_currSourceName);
65045       _metadataKeys.forEach(function(k3) {
65046         if (isDG && k3 === "vintage") return;
65047         list.append("li").attr("class", "background-info-list-" + k3).classed("hide", !_metadata[k3]).call(_t.append("info_panels.background." + k3, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k3).text(_metadata[k3]);
65048       });
65049       debouncedGetMetadata(selection2);
65050       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
65051       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
65052         d3_event.preventDefault();
65053         context.setDebug("tile", !context.getDebug("tile"));
65054         selection2.call(redraw);
65055       });
65056       if (isDG) {
65057         var key = source.id + "-vintage";
65058         var sourceVintage = context.background().findSource(key);
65059         var showsVintage = context.background().showsLayer(sourceVintage);
65060         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
65061         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
65062           d3_event.preventDefault();
65063           context.background().toggleOverlayLayer(sourceVintage);
65064           selection2.call(redraw);
65065         });
65066       }
65067       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
65068         if (source.id !== layerId) {
65069           var key2 = layerId + "-vintage";
65070           var sourceVintage2 = context.background().findSource(key2);
65071           if (context.background().showsLayer(sourceVintage2)) {
65072             context.background().toggleOverlayLayer(sourceVintage2);
65073           }
65074         }
65075       });
65076     }
65077     var debouncedGetMetadata = debounce_default(getMetadata, 250);
65078     function getMetadata(selection2) {
65079       var tile = context.container().select(".layer-background img.tile-center");
65080       if (tile.empty()) return;
65081       var sourceName = _currSourceName;
65082       var d2 = tile.datum();
65083       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
65084       var center = context.map().center();
65085       _metadata.zoom = String(zoom);
65086       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
65087       if (!d2 || !d2.length >= 3) return;
65088       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
65089         if (err || _currSourceName !== sourceName) return;
65090         var vintage = result.vintage;
65091         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
65092         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
65093         _metadataKeys.forEach(function(k3) {
65094           if (k3 === "zoom" || k3 === "vintage") return;
65095           var val = result[k3];
65096           _metadata[k3] = val;
65097           selection2.selectAll(".background-info-list-" + k3).classed("hide", !val).selectAll(".background-info-span-" + k3).text(val);
65098         });
65099       });
65100     }
65101     var panel = function(selection2) {
65102       selection2.call(redraw);
65103       context.map().on("drawn.info-background", function() {
65104         selection2.call(debouncedRedraw);
65105       }).on("move.info-background", function() {
65106         selection2.call(debouncedGetMetadata);
65107       });
65108     };
65109     panel.off = function() {
65110       context.map().on("drawn.info-background", null).on("move.info-background", null);
65111     };
65112     panel.id = "background";
65113     panel.label = _t.append("info_panels.background.title");
65114     panel.key = _t("info_panels.background.key");
65115     return panel;
65116   }
65117   var init_background = __esm({
65118     "modules/ui/panels/background.js"() {
65119       "use strict";
65120       init_debounce();
65121       init_localizer();
65122     }
65123   });
65124
65125   // modules/ui/panels/history.js
65126   var history_exports2 = {};
65127   __export(history_exports2, {
65128     uiPanelHistory: () => uiPanelHistory
65129   });
65130   function uiPanelHistory(context) {
65131     var osm;
65132     function displayTimestamp(timestamp) {
65133       if (!timestamp) return _t("info_panels.history.unknown");
65134       var options = {
65135         day: "numeric",
65136         month: "short",
65137         year: "numeric",
65138         hour: "numeric",
65139         minute: "numeric",
65140         second: "numeric"
65141       };
65142       var d2 = new Date(timestamp);
65143       if (isNaN(d2.getTime())) return _t("info_panels.history.unknown");
65144       return d2.toLocaleString(_mainLocalizer.localeCode(), options);
65145     }
65146     function displayUser(selection2, userName) {
65147       if (!userName) {
65148         selection2.append("span").call(_t.append("info_panels.history.unknown"));
65149         return;
65150       }
65151       selection2.append("span").attr("class", "user-name").text(userName);
65152       var links = selection2.append("div").attr("class", "links");
65153       if (osm) {
65154         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
65155       }
65156       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
65157     }
65158     function displayChangeset(selection2, changeset) {
65159       if (!changeset) {
65160         selection2.append("span").call(_t.append("info_panels.history.unknown"));
65161         return;
65162       }
65163       selection2.append("span").attr("class", "changeset-id").text(changeset);
65164       var links = selection2.append("div").attr("class", "links");
65165       if (osm) {
65166         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
65167       }
65168       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
65169       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
65170     }
65171     function redraw(selection2) {
65172       var selectedNoteID = context.selectedNoteID();
65173       osm = context.connection();
65174       var selected, note, entity;
65175       if (selectedNoteID && osm) {
65176         selected = [_t.html("note.note") + " " + selectedNoteID];
65177         note = osm.getNote(selectedNoteID);
65178       } else {
65179         selected = context.selectedIDs().filter(function(e3) {
65180           return context.hasEntity(e3);
65181         });
65182         if (selected.length) {
65183           entity = context.entity(selected[0]);
65184         }
65185       }
65186       var singular = selected.length === 1 ? selected[0] : null;
65187       selection2.html("");
65188       if (singular) {
65189         selection2.append("h4").attr("class", "history-heading").html(singular);
65190       } else {
65191         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
65192       }
65193       if (!singular) return;
65194       if (entity) {
65195         selection2.call(redrawEntity, entity);
65196       } else if (note) {
65197         selection2.call(redrawNote, note);
65198       }
65199     }
65200     function redrawNote(selection2, note) {
65201       if (!note || note.isNew()) {
65202         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
65203         return;
65204       }
65205       var list = selection2.append("ul");
65206       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
65207       if (note.comments.length) {
65208         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
65209         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
65210       }
65211       if (osm) {
65212         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"));
65213       }
65214     }
65215     function redrawEntity(selection2, entity) {
65216       if (!entity || entity.isNew()) {
65217         selection2.append("div").call(_t.append("info_panels.history.no_history"));
65218         return;
65219       }
65220       var links = selection2.append("div").attr("class", "links");
65221       if (osm) {
65222         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"));
65223       }
65224       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");
65225       var list = selection2.append("ul");
65226       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
65227       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
65228       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
65229       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
65230     }
65231     var panel = function(selection2) {
65232       selection2.call(redraw);
65233       context.map().on("drawn.info-history", function() {
65234         selection2.call(redraw);
65235       });
65236       context.on("enter.info-history", function() {
65237         selection2.call(redraw);
65238       });
65239     };
65240     panel.off = function() {
65241       context.map().on("drawn.info-history", null);
65242       context.on("enter.info-history", null);
65243     };
65244     panel.id = "history";
65245     panel.label = _t.append("info_panels.history.title");
65246     panel.key = _t("info_panels.history.key");
65247     return panel;
65248   }
65249   var init_history2 = __esm({
65250     "modules/ui/panels/history.js"() {
65251       "use strict";
65252       init_localizer();
65253       init_svg();
65254     }
65255   });
65256
65257   // modules/ui/panels/location.js
65258   var location_exports = {};
65259   __export(location_exports, {
65260     uiPanelLocation: () => uiPanelLocation
65261   });
65262   function uiPanelLocation(context) {
65263     var currLocation = "";
65264     function redraw(selection2) {
65265       selection2.html("");
65266       var list = selection2.append("ul");
65267       var coord2 = context.map().mouseCoordinates();
65268       if (coord2.some(isNaN)) {
65269         coord2 = context.map().center();
65270       }
65271       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
65272       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
65273       debouncedGetLocation(selection2, coord2);
65274     }
65275     var debouncedGetLocation = debounce_default(getLocation, 250);
65276     function getLocation(selection2, coord2) {
65277       if (!services.geocoder) {
65278         currLocation = _t("info_panels.location.unknown_location");
65279         selection2.selectAll(".location-info").text(currLocation);
65280       } else {
65281         services.geocoder.reverse(coord2, function(err, result) {
65282           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
65283           selection2.selectAll(".location-info").text(currLocation);
65284         });
65285       }
65286     }
65287     var panel = function(selection2) {
65288       selection2.call(redraw);
65289       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
65290         selection2.call(redraw);
65291       });
65292     };
65293     panel.off = function() {
65294       context.surface().on(".info-location", null);
65295     };
65296     panel.id = "location";
65297     panel.label = _t.append("info_panels.location.title");
65298     panel.key = _t("info_panels.location.key");
65299     return panel;
65300   }
65301   var init_location = __esm({
65302     "modules/ui/panels/location.js"() {
65303       "use strict";
65304       init_debounce();
65305       init_units();
65306       init_localizer();
65307       init_services();
65308     }
65309   });
65310
65311   // modules/ui/panels/measurement.js
65312   var measurement_exports = {};
65313   __export(measurement_exports, {
65314     uiPanelMeasurement: () => uiPanelMeasurement
65315   });
65316   function uiPanelMeasurement(context) {
65317     function radiansToMeters(r2) {
65318       return r2 * 63710071809e-4;
65319     }
65320     function steradiansToSqmeters(r2) {
65321       return r2 / (4 * Math.PI) * 510065621724e3;
65322     }
65323     function toLineString(feature3) {
65324       if (feature3.type === "LineString") return feature3;
65325       var result = { type: "LineString", coordinates: [] };
65326       if (feature3.type === "Polygon") {
65327         result.coordinates = feature3.coordinates[0];
65328       } else if (feature3.type === "MultiPolygon") {
65329         result.coordinates = feature3.coordinates[0][0];
65330       }
65331       return result;
65332     }
65333     var _isImperial = !_mainLocalizer.usesMetric();
65334     function redraw(selection2) {
65335       var graph = context.graph();
65336       var selectedNoteID = context.selectedNoteID();
65337       var osm = services.osm;
65338       var localeCode = _mainLocalizer.localeCode();
65339       var heading;
65340       var center, location, centroid;
65341       var closed, geometry;
65342       var totalNodeCount, length2 = 0, area = 0, distance;
65343       if (selectedNoteID && osm) {
65344         var note = osm.getNote(selectedNoteID);
65345         heading = _t.html("note.note") + " " + selectedNoteID;
65346         location = note.loc;
65347         geometry = "note";
65348       } else {
65349         var selectedIDs = context.selectedIDs().filter(function(id2) {
65350           return context.hasEntity(id2);
65351         });
65352         var selected = selectedIDs.map(function(id2) {
65353           return context.entity(id2);
65354         });
65355         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
65356         if (selected.length) {
65357           var extent = geoExtent();
65358           for (var i3 in selected) {
65359             var entity = selected[i3];
65360             extent._extend(entity.extent(graph));
65361             geometry = entity.geometry(graph);
65362             if (geometry === "line" || geometry === "area") {
65363               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
65364               var feature3 = entity.asGeoJSON(graph);
65365               length2 += radiansToMeters(length_default(toLineString(feature3)));
65366               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
65367               centroid = centroid && context.projection.invert(centroid);
65368               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
65369                 centroid = entity.extent(graph).center();
65370               }
65371               if (closed) {
65372                 area += steradiansToSqmeters(entity.area(graph));
65373               }
65374             }
65375           }
65376           if (selected.length > 1) {
65377             geometry = null;
65378             closed = null;
65379             centroid = null;
65380           }
65381           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
65382             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
65383           }
65384           if (selected.length === 1 && selected[0].type === "node") {
65385             location = selected[0].loc;
65386           } else {
65387             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
65388           }
65389           if (!location && !centroid) {
65390             center = extent.center();
65391           }
65392         }
65393       }
65394       selection2.html("");
65395       if (heading) {
65396         selection2.append("h4").attr("class", "measurement-heading").html(heading);
65397       }
65398       var list = selection2.append("ul");
65399       var coordItem;
65400       if (geometry) {
65401         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
65402           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
65403         );
65404       }
65405       if (totalNodeCount) {
65406         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
65407       }
65408       if (area) {
65409         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
65410       }
65411       if (length2) {
65412         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
65413       }
65414       if (typeof distance === "number") {
65415         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
65416       }
65417       if (location) {
65418         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
65419         coordItem.append("span").text(dmsCoordinatePair(location));
65420         coordItem.append("span").text(decimalCoordinatePair(location));
65421       }
65422       if (centroid) {
65423         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
65424         coordItem.append("span").text(dmsCoordinatePair(centroid));
65425         coordItem.append("span").text(decimalCoordinatePair(centroid));
65426       }
65427       if (center) {
65428         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
65429         coordItem.append("span").text(dmsCoordinatePair(center));
65430         coordItem.append("span").text(decimalCoordinatePair(center));
65431       }
65432       if (length2 || area || typeof distance === "number") {
65433         var toggle = _isImperial ? "imperial" : "metric";
65434         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
65435           d3_event.preventDefault();
65436           _isImperial = !_isImperial;
65437           selection2.call(redraw);
65438         });
65439       }
65440     }
65441     var panel = function(selection2) {
65442       selection2.call(redraw);
65443       context.map().on("drawn.info-measurement", function() {
65444         selection2.call(redraw);
65445       });
65446       context.on("enter.info-measurement", function() {
65447         selection2.call(redraw);
65448       });
65449     };
65450     panel.off = function() {
65451       context.map().on("drawn.info-measurement", null);
65452       context.on("enter.info-measurement", null);
65453     };
65454     panel.id = "measurement";
65455     panel.label = _t.append("info_panels.measurement.title");
65456     panel.key = _t("info_panels.measurement.key");
65457     return panel;
65458   }
65459   var init_measurement = __esm({
65460     "modules/ui/panels/measurement.js"() {
65461       "use strict";
65462       init_src2();
65463       init_localizer();
65464       init_units();
65465       init_geo2();
65466       init_services();
65467       init_util();
65468     }
65469   });
65470
65471   // modules/ui/panels/index.js
65472   var panels_exports = {};
65473   __export(panels_exports, {
65474     uiInfoPanels: () => uiInfoPanels,
65475     uiPanelBackground: () => uiPanelBackground,
65476     uiPanelHistory: () => uiPanelHistory,
65477     uiPanelLocation: () => uiPanelLocation,
65478     uiPanelMeasurement: () => uiPanelMeasurement
65479   });
65480   var uiInfoPanels;
65481   var init_panels = __esm({
65482     "modules/ui/panels/index.js"() {
65483       "use strict";
65484       init_background();
65485       init_history2();
65486       init_location();
65487       init_measurement();
65488       init_background();
65489       init_history2();
65490       init_location();
65491       init_measurement();
65492       uiInfoPanels = {
65493         background: uiPanelBackground,
65494         history: uiPanelHistory,
65495         location: uiPanelLocation,
65496         measurement: uiPanelMeasurement
65497       };
65498     }
65499   });
65500
65501   // modules/ui/info.js
65502   var info_exports = {};
65503   __export(info_exports, {
65504     uiInfo: () => uiInfo
65505   });
65506   function uiInfo(context) {
65507     var ids = Object.keys(uiInfoPanels);
65508     var wasActive = ["measurement"];
65509     var panels = {};
65510     var active = {};
65511     ids.forEach(function(k3) {
65512       if (!panels[k3]) {
65513         panels[k3] = uiInfoPanels[k3](context);
65514         active[k3] = false;
65515       }
65516     });
65517     function info(selection2) {
65518       function redraw() {
65519         var activeids = ids.filter(function(k3) {
65520           return active[k3];
65521         }).sort();
65522         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k3) {
65523           return k3;
65524         });
65525         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
65526           select_default2(this).call(panels[d2].off).remove();
65527         });
65528         var enter = containers.enter().append("div").attr("class", function(d2) {
65529           return "fillD2 panel-container panel-container-" + d2;
65530         });
65531         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
65532         var title = enter.append("div").attr("class", "panel-title fillD2");
65533         title.append("h3").each(function(d2) {
65534           return panels[d2].label(select_default2(this));
65535         });
65536         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
65537           d3_event.stopImmediatePropagation();
65538           d3_event.preventDefault();
65539           info.toggle(d2);
65540         }).call(svgIcon("#iD-icon-close"));
65541         enter.append("div").attr("class", function(d2) {
65542           return "panel-content panel-content-" + d2;
65543         });
65544         infoPanels.selectAll(".panel-content").each(function(d2) {
65545           select_default2(this).call(panels[d2]);
65546         });
65547       }
65548       info.toggle = function(which) {
65549         var activeids = ids.filter(function(k3) {
65550           return active[k3];
65551         });
65552         if (which) {
65553           active[which] = !active[which];
65554           if (activeids.length === 1 && activeids[0] === which) {
65555             wasActive = [which];
65556           }
65557           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
65558         } else {
65559           if (activeids.length) {
65560             wasActive = activeids;
65561             activeids.forEach(function(k3) {
65562               active[k3] = false;
65563             });
65564           } else {
65565             wasActive.forEach(function(k3) {
65566               active[k3] = true;
65567             });
65568           }
65569         }
65570         redraw();
65571       };
65572       var infoPanels = selection2.selectAll(".info-panels").data([0]);
65573       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
65574       redraw();
65575       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
65576         if (d3_event.shiftKey) return;
65577         d3_event.stopImmediatePropagation();
65578         d3_event.preventDefault();
65579         info.toggle();
65580       });
65581       ids.forEach(function(k3) {
65582         var key = _t("info_panels." + k3 + ".key", { default: null });
65583         if (!key) return;
65584         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
65585           d3_event.stopImmediatePropagation();
65586           d3_event.preventDefault();
65587           info.toggle(k3);
65588         });
65589       });
65590     }
65591     return info;
65592   }
65593   var init_info = __esm({
65594     "modules/ui/info.js"() {
65595       "use strict";
65596       init_src5();
65597       init_localizer();
65598       init_icon();
65599       init_cmd();
65600       init_panels();
65601     }
65602   });
65603
65604   // modules/ui/curtain.js
65605   var curtain_exports = {};
65606   __export(curtain_exports, {
65607     uiCurtain: () => uiCurtain
65608   });
65609   function uiCurtain(containerNode) {
65610     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
65611     function curtain(selection2) {
65612       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
65613       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
65614       select_default2(window).on("resize.curtain", resize);
65615       tooltip = selection2.append("div").attr("class", "tooltip");
65616       tooltip.append("div").attr("class", "popover-arrow");
65617       tooltip.append("div").attr("class", "popover-inner");
65618       resize();
65619       function resize() {
65620         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
65621         curtain.cut(darkness.datum());
65622       }
65623     }
65624     curtain.reveal = function(box, html2, options) {
65625       options = options || {};
65626       if (typeof box === "string") {
65627         box = select_default2(box).node();
65628       }
65629       if (box && box.getBoundingClientRect) {
65630         box = copyBox(box.getBoundingClientRect());
65631       }
65632       if (box) {
65633         var containerRect = containerNode.getBoundingClientRect();
65634         box.top -= containerRect.top;
65635         box.left -= containerRect.left;
65636       }
65637       if (box && options.padding) {
65638         box.top -= options.padding;
65639         box.left -= options.padding;
65640         box.bottom += options.padding;
65641         box.right += options.padding;
65642         box.height += options.padding * 2;
65643         box.width += options.padding * 2;
65644       }
65645       var tooltipBox;
65646       if (options.tooltipBox) {
65647         tooltipBox = options.tooltipBox;
65648         if (typeof tooltipBox === "string") {
65649           tooltipBox = select_default2(tooltipBox).node();
65650         }
65651         if (tooltipBox && tooltipBox.getBoundingClientRect) {
65652           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
65653         }
65654       } else {
65655         tooltipBox = box;
65656       }
65657       if (tooltipBox && html2) {
65658         if (html2.indexOf("**") !== -1) {
65659           if (html2.indexOf("<span") === 0) {
65660             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
65661           } else {
65662             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
65663           }
65664           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
65665         }
65666         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
65667         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
65668         if (options.buttonText && options.buttonCallback) {
65669           html2 += '<div class="button-section"><button href="#" class="button action">' + options.buttonText + "</button></div>";
65670         }
65671         var classes = "curtain-tooltip popover tooltip arrowed in " + (options.tooltipClass || "");
65672         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
65673         if (options.buttonText && options.buttonCallback) {
65674           var button = tooltip.selectAll(".button-section .button.action");
65675           button.on("click", function(d3_event) {
65676             d3_event.preventDefault();
65677             options.buttonCallback();
65678           });
65679         }
65680         var tip = copyBox(tooltip.node().getBoundingClientRect()), w3 = containerNode.clientWidth, h3 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
65681         if (options.tooltipClass === "intro-mouse") {
65682           tip.height += 80;
65683         }
65684         if (tooltipBox.top + tooltipBox.height > h3) {
65685           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h3;
65686         }
65687         if (tooltipBox.left + tooltipBox.width > w3) {
65688           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w3;
65689         }
65690         const onLeftOrRightEdge = tooltipBox.left + tooltipBox.width / 2 > w3 - 100 || tooltipBox.left + tooltipBox.width / 2 < 100;
65691         if (tooltipBox.top + tooltipBox.height < 100 && !onLeftOrRightEdge) {
65692           side = "bottom";
65693           pos = [
65694             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
65695             tooltipBox.top + tooltipBox.height
65696           ];
65697         } else if (tooltipBox.top > h3 - 140 && !onLeftOrRightEdge) {
65698           side = "top";
65699           pos = [
65700             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
65701             tooltipBox.top - tip.height
65702           ];
65703         } else {
65704           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
65705           if (_mainLocalizer.textDirection() === "rtl") {
65706             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
65707               side = "right";
65708               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
65709             } else {
65710               side = "left";
65711               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
65712             }
65713           } else {
65714             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w3 - 70) {
65715               side = "left";
65716               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
65717             } else {
65718               side = "right";
65719               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
65720             }
65721           }
65722         }
65723         if (options.duration !== 0 || !tooltip.classed(side)) {
65724           tooltip.call(uiToggle(true));
65725         }
65726         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
65727         var shiftY = 0;
65728         if (side === "left" || side === "right") {
65729           if (pos[1] < 60) {
65730             shiftY = 60 - pos[1];
65731           } else if (pos[1] + tip.height > h3 - 100) {
65732             shiftY = h3 - pos[1] - tip.height - 100;
65733           }
65734         }
65735         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
65736       } else {
65737         tooltip.classed("in", false).call(uiToggle(false));
65738       }
65739       curtain.cut(box, options.duration);
65740       return tooltip;
65741     };
65742     curtain.cut = function(datum2, duration) {
65743       darkness.datum(datum2).interrupt();
65744       var selection2;
65745       if (duration === 0) {
65746         selection2 = darkness;
65747       } else {
65748         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
65749       }
65750       selection2.attr("d", function(d2) {
65751         var containerWidth = containerNode.clientWidth;
65752         var containerHeight = containerNode.clientHeight;
65753         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
65754         if (!d2) return string;
65755         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";
65756       });
65757     };
65758     curtain.remove = function() {
65759       surface.remove();
65760       tooltip.remove();
65761       select_default2(window).on("resize.curtain", null);
65762     };
65763     function copyBox(src) {
65764       return {
65765         top: src.top,
65766         right: src.right,
65767         bottom: src.bottom,
65768         left: src.left,
65769         width: src.width,
65770         height: src.height
65771       };
65772     }
65773     return curtain;
65774   }
65775   var init_curtain = __esm({
65776     "modules/ui/curtain.js"() {
65777       "use strict";
65778       init_src10();
65779       init_src5();
65780       init_localizer();
65781       init_toggle();
65782     }
65783   });
65784
65785   // modules/ui/intro/welcome.js
65786   var welcome_exports = {};
65787   __export(welcome_exports, {
65788     uiIntroWelcome: () => uiIntroWelcome
65789   });
65790   function uiIntroWelcome(context, reveal) {
65791     var dispatch14 = dispatch_default("done");
65792     var chapter = {
65793       title: "intro.welcome.title"
65794     };
65795     function welcome() {
65796       context.map().centerZoom([-85.63591, 41.94285], 19);
65797       reveal(
65798         ".intro-nav-wrap .chapter-welcome",
65799         helpHtml("intro.welcome.welcome"),
65800         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
65801       );
65802     }
65803     function practice() {
65804       reveal(
65805         ".intro-nav-wrap .chapter-welcome",
65806         helpHtml("intro.welcome.practice"),
65807         { buttonText: _t.html("intro.ok"), buttonCallback: words }
65808       );
65809     }
65810     function words() {
65811       reveal(
65812         ".intro-nav-wrap .chapter-welcome",
65813         helpHtml("intro.welcome.words"),
65814         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
65815       );
65816     }
65817     function chapters() {
65818       dispatch14.call("done");
65819       reveal(
65820         ".intro-nav-wrap .chapter-navigation",
65821         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
65822       );
65823     }
65824     chapter.enter = function() {
65825       welcome();
65826     };
65827     chapter.exit = function() {
65828       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
65829     };
65830     chapter.restart = function() {
65831       chapter.exit();
65832       chapter.enter();
65833     };
65834     return utilRebind(chapter, dispatch14, "on");
65835   }
65836   var init_welcome = __esm({
65837     "modules/ui/intro/welcome.js"() {
65838       "use strict";
65839       init_src4();
65840       init_helper();
65841       init_localizer();
65842       init_rebind();
65843     }
65844   });
65845
65846   // modules/ui/intro/navigation.js
65847   var navigation_exports = {};
65848   __export(navigation_exports, {
65849     uiIntroNavigation: () => uiIntroNavigation
65850   });
65851   function uiIntroNavigation(context, reveal) {
65852     var dispatch14 = dispatch_default("done");
65853     var timeouts = [];
65854     var hallId = "n2061";
65855     var townHall = [-85.63591, 41.94285];
65856     var springStreetId = "w397";
65857     var springStreetEndId = "n1834";
65858     var springStreet = [-85.63582, 41.94255];
65859     var onewayField = _mainPresetIndex.field("oneway");
65860     var maxspeedField = _mainPresetIndex.field("maxspeed");
65861     var chapter = {
65862       title: "intro.navigation.title"
65863     };
65864     function timeout2(f2, t2) {
65865       timeouts.push(window.setTimeout(f2, t2));
65866     }
65867     function eventCancel(d3_event) {
65868       d3_event.stopPropagation();
65869       d3_event.preventDefault();
65870     }
65871     function isTownHallSelected() {
65872       var ids = context.selectedIDs();
65873       return ids.length === 1 && ids[0] === hallId;
65874     }
65875     function dragMap() {
65876       context.enter(modeBrowse(context));
65877       context.history().reset("initial");
65878       var msec = transitionTime(townHall, context.map().center());
65879       if (msec) {
65880         reveal(null, null, { duration: 0 });
65881       }
65882       context.map().centerZoomEase(townHall, 19, msec);
65883       timeout2(function() {
65884         var centerStart = context.map().center();
65885         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
65886         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
65887         reveal(".main-map .surface", dragString);
65888         context.map().on("drawn.intro", function() {
65889           reveal(".main-map .surface", dragString, { duration: 0 });
65890         });
65891         context.map().on("move.intro", function() {
65892           var centerNow = context.map().center();
65893           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
65894             context.map().on("move.intro", null);
65895             timeout2(function() {
65896               continueTo(zoomMap);
65897             }, 3e3);
65898           }
65899         });
65900       }, msec + 100);
65901       function continueTo(nextStep) {
65902         context.map().on("move.intro drawn.intro", null);
65903         nextStep();
65904       }
65905     }
65906     function zoomMap() {
65907       var zoomStart = context.map().zoom();
65908       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
65909       var zoomString = helpHtml("intro.navigation." + textId);
65910       reveal(".main-map .surface", zoomString);
65911       context.map().on("drawn.intro", function() {
65912         reveal(".main-map .surface", zoomString, { duration: 0 });
65913       });
65914       context.map().on("move.intro", function() {
65915         if (context.map().zoom() !== zoomStart) {
65916           context.map().on("move.intro", null);
65917           timeout2(function() {
65918             continueTo(features);
65919           }, 3e3);
65920         }
65921       });
65922       function continueTo(nextStep) {
65923         context.map().on("move.intro drawn.intro", null);
65924         nextStep();
65925       }
65926     }
65927     function features() {
65928       var onClick = function() {
65929         continueTo(pointsLinesAreas);
65930       };
65931       reveal(
65932         ".main-map .surface",
65933         helpHtml("intro.navigation.features"),
65934         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65935       );
65936       context.map().on("drawn.intro", function() {
65937         reveal(
65938           ".main-map .surface",
65939           helpHtml("intro.navigation.features"),
65940           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65941         );
65942       });
65943       function continueTo(nextStep) {
65944         context.map().on("drawn.intro", null);
65945         nextStep();
65946       }
65947     }
65948     function pointsLinesAreas() {
65949       var onClick = function() {
65950         continueTo(nodesWays);
65951       };
65952       reveal(
65953         ".main-map .surface",
65954         helpHtml("intro.navigation.points_lines_areas"),
65955         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65956       );
65957       context.map().on("drawn.intro", function() {
65958         reveal(
65959           ".main-map .surface",
65960           helpHtml("intro.navigation.points_lines_areas"),
65961           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65962         );
65963       });
65964       function continueTo(nextStep) {
65965         context.map().on("drawn.intro", null);
65966         nextStep();
65967       }
65968     }
65969     function nodesWays() {
65970       var onClick = function() {
65971         continueTo(clickTownHall);
65972       };
65973       reveal(
65974         ".main-map .surface",
65975         helpHtml("intro.navigation.nodes_ways"),
65976         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65977       );
65978       context.map().on("drawn.intro", function() {
65979         reveal(
65980           ".main-map .surface",
65981           helpHtml("intro.navigation.nodes_ways"),
65982           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65983         );
65984       });
65985       function continueTo(nextStep) {
65986         context.map().on("drawn.intro", null);
65987         nextStep();
65988       }
65989     }
65990     function clickTownHall() {
65991       context.enter(modeBrowse(context));
65992       context.history().reset("initial");
65993       var entity = context.hasEntity(hallId);
65994       if (!entity) return;
65995       reveal(null, null, { duration: 0 });
65996       context.map().centerZoomEase(entity.loc, 19, 500);
65997       timeout2(function() {
65998         var entity2 = context.hasEntity(hallId);
65999         if (!entity2) return;
66000         var box = pointBox(entity2.loc, context);
66001         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
66002         reveal(box, helpHtml("intro.navigation." + textId));
66003         context.map().on("move.intro drawn.intro", function() {
66004           var entity3 = context.hasEntity(hallId);
66005           if (!entity3) return;
66006           var box2 = pointBox(entity3.loc, context);
66007           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
66008         });
66009         context.on("enter.intro", function() {
66010           if (isTownHallSelected()) continueTo(selectedTownHall);
66011         });
66012       }, 550);
66013       context.history().on("change.intro", function() {
66014         if (!context.hasEntity(hallId)) {
66015           continueTo(clickTownHall);
66016         }
66017       });
66018       function continueTo(nextStep) {
66019         context.on("enter.intro", null);
66020         context.map().on("move.intro drawn.intro", null);
66021         context.history().on("change.intro", null);
66022         nextStep();
66023       }
66024     }
66025     function selectedTownHall() {
66026       if (!isTownHallSelected()) return clickTownHall();
66027       var entity = context.hasEntity(hallId);
66028       if (!entity) return clickTownHall();
66029       var box = pointBox(entity.loc, context);
66030       var onClick = function() {
66031         continueTo(editorTownHall);
66032       };
66033       reveal(
66034         box,
66035         helpHtml("intro.navigation.selected_townhall"),
66036         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66037       );
66038       context.map().on("move.intro drawn.intro", function() {
66039         var entity2 = context.hasEntity(hallId);
66040         if (!entity2) return;
66041         var box2 = pointBox(entity2.loc, context);
66042         reveal(
66043           box2,
66044           helpHtml("intro.navigation.selected_townhall"),
66045           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66046         );
66047       });
66048       context.history().on("change.intro", function() {
66049         if (!context.hasEntity(hallId)) {
66050           continueTo(clickTownHall);
66051         }
66052       });
66053       function continueTo(nextStep) {
66054         context.map().on("move.intro drawn.intro", null);
66055         context.history().on("change.intro", null);
66056         nextStep();
66057       }
66058     }
66059     function editorTownHall() {
66060       if (!isTownHallSelected()) return clickTownHall();
66061       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66062       var onClick = function() {
66063         continueTo(presetTownHall);
66064       };
66065       reveal(
66066         ".entity-editor-pane",
66067         helpHtml("intro.navigation.editor_townhall"),
66068         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66069       );
66070       context.on("exit.intro", function() {
66071         continueTo(clickTownHall);
66072       });
66073       context.history().on("change.intro", function() {
66074         if (!context.hasEntity(hallId)) {
66075           continueTo(clickTownHall);
66076         }
66077       });
66078       function continueTo(nextStep) {
66079         context.on("exit.intro", null);
66080         context.history().on("change.intro", null);
66081         context.container().select(".inspector-wrap").on("wheel.intro", null);
66082         nextStep();
66083       }
66084     }
66085     function presetTownHall() {
66086       if (!isTownHallSelected()) return clickTownHall();
66087       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66088       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66089       var entity = context.entity(context.selectedIDs()[0]);
66090       var preset = _mainPresetIndex.match(entity, context.graph());
66091       var onClick = function() {
66092         continueTo(fieldsTownHall);
66093       };
66094       reveal(
66095         ".entity-editor-pane .section-feature-type",
66096         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
66097         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66098       );
66099       context.on("exit.intro", function() {
66100         continueTo(clickTownHall);
66101       });
66102       context.history().on("change.intro", function() {
66103         if (!context.hasEntity(hallId)) {
66104           continueTo(clickTownHall);
66105         }
66106       });
66107       function continueTo(nextStep) {
66108         context.on("exit.intro", null);
66109         context.history().on("change.intro", null);
66110         context.container().select(".inspector-wrap").on("wheel.intro", null);
66111         nextStep();
66112       }
66113     }
66114     function fieldsTownHall() {
66115       if (!isTownHallSelected()) return clickTownHall();
66116       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66117       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66118       var onClick = function() {
66119         continueTo(closeTownHall);
66120       };
66121       reveal(
66122         ".entity-editor-pane .section-preset-fields",
66123         helpHtml("intro.navigation.fields_townhall"),
66124         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66125       );
66126       context.on("exit.intro", function() {
66127         continueTo(clickTownHall);
66128       });
66129       context.history().on("change.intro", function() {
66130         if (!context.hasEntity(hallId)) {
66131           continueTo(clickTownHall);
66132         }
66133       });
66134       function continueTo(nextStep) {
66135         context.on("exit.intro", null);
66136         context.history().on("change.intro", null);
66137         context.container().select(".inspector-wrap").on("wheel.intro", null);
66138         nextStep();
66139       }
66140     }
66141     function closeTownHall() {
66142       if (!isTownHallSelected()) return clickTownHall();
66143       var selector = ".entity-editor-pane button.close svg use";
66144       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66145       reveal(
66146         ".entity-editor-pane",
66147         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
66148       );
66149       context.on("exit.intro", function() {
66150         continueTo(searchStreet);
66151       });
66152       context.history().on("change.intro", function() {
66153         var selector2 = ".entity-editor-pane button.close svg use";
66154         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
66155         reveal(
66156           ".entity-editor-pane",
66157           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
66158           { duration: 0 }
66159         );
66160       });
66161       function continueTo(nextStep) {
66162         context.on("exit.intro", null);
66163         context.history().on("change.intro", null);
66164         nextStep();
66165       }
66166     }
66167     function searchStreet() {
66168       context.enter(modeBrowse(context));
66169       context.history().reset("initial");
66170       var msec = transitionTime(springStreet, context.map().center());
66171       if (msec) {
66172         reveal(null, null, { duration: 0 });
66173       }
66174       context.map().centerZoomEase(springStreet, 19, msec);
66175       timeout2(function() {
66176         reveal(
66177           ".search-header input",
66178           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
66179         );
66180         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
66181       }, msec + 100);
66182     }
66183     function checkSearchResult() {
66184       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
66185       var firstName = first.select(".entity-name");
66186       var name = _t("intro.graph.name.spring-street");
66187       if (!firstName.empty() && firstName.html() === name) {
66188         reveal(
66189           first.node(),
66190           helpHtml("intro.navigation.choose_street", { name }),
66191           { duration: 300 }
66192         );
66193         context.on("exit.intro", function() {
66194           continueTo(selectedStreet);
66195         });
66196         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66197       }
66198       function continueTo(nextStep) {
66199         context.on("exit.intro", null);
66200         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
66201         nextStep();
66202       }
66203     }
66204     function selectedStreet() {
66205       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
66206         return searchStreet();
66207       }
66208       var onClick = function() {
66209         continueTo(editorStreet);
66210       };
66211       var entity = context.entity(springStreetEndId);
66212       var box = pointBox(entity.loc, context);
66213       box.height = 500;
66214       reveal(
66215         box,
66216         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
66217         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66218       );
66219       timeout2(function() {
66220         context.map().on("move.intro drawn.intro", function() {
66221           var entity2 = context.hasEntity(springStreetEndId);
66222           if (!entity2) return;
66223           var box2 = pointBox(entity2.loc, context);
66224           box2.height = 500;
66225           reveal(
66226             box2,
66227             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
66228             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66229           );
66230         });
66231       }, 600);
66232       context.on("enter.intro", function(mode) {
66233         if (!context.hasEntity(springStreetId)) {
66234           return continueTo(searchStreet);
66235         }
66236         var ids = context.selectedIDs();
66237         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
66238           context.enter(modeSelect(context, [springStreetId]));
66239         }
66240       });
66241       context.history().on("change.intro", function() {
66242         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
66243           timeout2(function() {
66244             continueTo(searchStreet);
66245           }, 300);
66246         }
66247       });
66248       function continueTo(nextStep) {
66249         context.map().on("move.intro drawn.intro", null);
66250         context.on("enter.intro", null);
66251         context.history().on("change.intro", null);
66252         nextStep();
66253       }
66254     }
66255     function editorStreet() {
66256       var selector = ".entity-editor-pane button.close svg use";
66257       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66258       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
66259         button: { html: icon(href, "inline") },
66260         field1: onewayField.title(),
66261         field2: maxspeedField.title()
66262       }));
66263       context.on("exit.intro", function() {
66264         continueTo(play);
66265       });
66266       context.history().on("change.intro", function() {
66267         var selector2 = ".entity-editor-pane button.close svg use";
66268         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
66269         reveal(
66270           ".entity-editor-pane",
66271           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
66272             button: { html: icon(href2, "inline") },
66273             field1: onewayField.title(),
66274             field2: maxspeedField.title()
66275           }),
66276           { duration: 0 }
66277         );
66278       });
66279       function continueTo(nextStep) {
66280         context.on("exit.intro", null);
66281         context.history().on("change.intro", null);
66282         nextStep();
66283       }
66284     }
66285     function play() {
66286       dispatch14.call("done");
66287       reveal(
66288         ".ideditor",
66289         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
66290         {
66291           tooltipBox: ".intro-nav-wrap .chapter-point",
66292           buttonText: _t.html("intro.ok"),
66293           buttonCallback: function() {
66294             reveal(".ideditor");
66295           }
66296         }
66297       );
66298     }
66299     chapter.enter = function() {
66300       dragMap();
66301     };
66302     chapter.exit = function() {
66303       timeouts.forEach(window.clearTimeout);
66304       context.on("enter.intro exit.intro", null);
66305       context.map().on("move.intro drawn.intro", null);
66306       context.history().on("change.intro", null);
66307       context.container().select(".inspector-wrap").on("wheel.intro", null);
66308       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
66309     };
66310     chapter.restart = function() {
66311       chapter.exit();
66312       chapter.enter();
66313     };
66314     return utilRebind(chapter, dispatch14, "on");
66315   }
66316   var init_navigation = __esm({
66317     "modules/ui/intro/navigation.js"() {
66318       "use strict";
66319       init_src4();
66320       init_src5();
66321       init_presets();
66322       init_localizer();
66323       init_browse();
66324       init_select5();
66325       init_rebind();
66326       init_helper();
66327     }
66328   });
66329
66330   // modules/ui/intro/point.js
66331   var point_exports = {};
66332   __export(point_exports, {
66333     uiIntroPoint: () => uiIntroPoint
66334   });
66335   function uiIntroPoint(context, reveal) {
66336     var dispatch14 = dispatch_default("done");
66337     var timeouts = [];
66338     var intersection2 = [-85.63279, 41.94394];
66339     var building = [-85.632422, 41.944045];
66340     var cafePreset = _mainPresetIndex.item("amenity/cafe");
66341     var _pointID = null;
66342     var chapter = {
66343       title: "intro.points.title"
66344     };
66345     function timeout2(f2, t2) {
66346       timeouts.push(window.setTimeout(f2, t2));
66347     }
66348     function eventCancel(d3_event) {
66349       d3_event.stopPropagation();
66350       d3_event.preventDefault();
66351     }
66352     function addPoint() {
66353       context.enter(modeBrowse(context));
66354       context.history().reset("initial");
66355       var msec = transitionTime(intersection2, context.map().center());
66356       if (msec) {
66357         reveal(null, null, { duration: 0 });
66358       }
66359       context.map().centerZoomEase(intersection2, 19, msec);
66360       timeout2(function() {
66361         var tooltip = reveal(
66362           "button.add-point",
66363           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
66364         );
66365         _pointID = null;
66366         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
66367         context.on("enter.intro", function(mode) {
66368           if (mode.id !== "add-point") return;
66369           continueTo(placePoint);
66370         });
66371       }, msec + 100);
66372       function continueTo(nextStep) {
66373         context.on("enter.intro", null);
66374         nextStep();
66375       }
66376     }
66377     function placePoint() {
66378       if (context.mode().id !== "add-point") {
66379         return chapter.restart();
66380       }
66381       var pointBox2 = pad2(building, 150, context);
66382       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
66383       reveal(pointBox2, helpHtml("intro.points." + textId));
66384       context.map().on("move.intro drawn.intro", function() {
66385         pointBox2 = pad2(building, 150, context);
66386         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
66387       });
66388       context.on("enter.intro", function(mode) {
66389         if (mode.id !== "select") return chapter.restart();
66390         _pointID = context.mode().selectedIDs()[0];
66391         if (context.graph().geometry(_pointID) === "vertex") {
66392           context.map().on("move.intro drawn.intro", null);
66393           context.on("enter.intro", null);
66394           reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
66395             buttonText: _t.html("intro.ok"),
66396             buttonCallback: function() {
66397               return chapter.restart();
66398             }
66399           });
66400         } else {
66401           continueTo(searchPreset);
66402         }
66403       });
66404       function continueTo(nextStep) {
66405         context.map().on("move.intro drawn.intro", null);
66406         context.on("enter.intro", null);
66407         nextStep();
66408       }
66409     }
66410     function searchPreset() {
66411       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66412         return addPoint();
66413       }
66414       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66415       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66416       reveal(
66417         ".preset-search-input",
66418         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
66419       );
66420       context.on("enter.intro", function(mode) {
66421         if (!_pointID || !context.hasEntity(_pointID)) {
66422           return continueTo(addPoint);
66423         }
66424         var ids = context.selectedIDs();
66425         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
66426           context.enter(modeSelect(context, [_pointID]));
66427           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66428           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66429           reveal(
66430             ".preset-search-input",
66431             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
66432           );
66433           context.history().on("change.intro", null);
66434         }
66435       });
66436       function checkPresetSearch() {
66437         var first = context.container().select(".preset-list-item:first-child");
66438         if (first.classed("preset-amenity-cafe")) {
66439           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66440           reveal(
66441             first.select(".preset-list-button").node(),
66442             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
66443             { duration: 300 }
66444           );
66445           context.history().on("change.intro", function() {
66446             continueTo(aboutFeatureEditor);
66447           });
66448         }
66449       }
66450       function continueTo(nextStep) {
66451         context.on("enter.intro", null);
66452         context.history().on("change.intro", null);
66453         context.container().select(".inspector-wrap").on("wheel.intro", null);
66454         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66455         nextStep();
66456       }
66457     }
66458     function aboutFeatureEditor() {
66459       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66460         return addPoint();
66461       }
66462       timeout2(function() {
66463         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
66464           tooltipClass: "intro-points-describe",
66465           buttonText: _t.html("intro.ok"),
66466           buttonCallback: function() {
66467             continueTo(addName);
66468           }
66469         });
66470       }, 400);
66471       context.on("exit.intro", function() {
66472         continueTo(reselectPoint);
66473       });
66474       function continueTo(nextStep) {
66475         context.on("exit.intro", null);
66476         nextStep();
66477       }
66478     }
66479     function addName() {
66480       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66481         return addPoint();
66482       }
66483       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66484       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name") + "{br}" + helpHtml("intro.points.add_reminder");
66485       timeout2(function() {
66486         var entity = context.entity(_pointID);
66487         if (entity.tags.name) {
66488           var tooltip = reveal(".entity-editor-pane", addNameString, {
66489             tooltipClass: "intro-points-describe",
66490             buttonText: _t.html("intro.ok"),
66491             buttonCallback: function() {
66492               continueTo(addCloseEditor);
66493             }
66494           });
66495           tooltip.select(".instruction").style("display", "none");
66496         } else {
66497           reveal(
66498             ".entity-editor-pane",
66499             addNameString,
66500             { tooltipClass: "intro-points-describe" }
66501           );
66502         }
66503       }, 400);
66504       context.history().on("change.intro", function() {
66505         continueTo(addCloseEditor);
66506       });
66507       context.on("exit.intro", function() {
66508         continueTo(reselectPoint);
66509       });
66510       function continueTo(nextStep) {
66511         context.on("exit.intro", null);
66512         context.history().on("change.intro", null);
66513         nextStep();
66514       }
66515     }
66516     function addCloseEditor() {
66517       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66518       var selector = ".entity-editor-pane button.close svg use";
66519       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66520       context.on("exit.intro", function() {
66521         continueTo(reselectPoint);
66522       });
66523       reveal(
66524         ".entity-editor-pane",
66525         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
66526       );
66527       function continueTo(nextStep) {
66528         context.on("exit.intro", null);
66529         nextStep();
66530       }
66531     }
66532     function reselectPoint() {
66533       if (!_pointID) return chapter.restart();
66534       var entity = context.hasEntity(_pointID);
66535       if (!entity) return chapter.restart();
66536       var oldPreset = _mainPresetIndex.match(entity, context.graph());
66537       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
66538       context.enter(modeBrowse(context));
66539       var msec = transitionTime(entity.loc, context.map().center());
66540       if (msec) {
66541         reveal(null, null, { duration: 0 });
66542       }
66543       context.map().centerEase(entity.loc, msec);
66544       timeout2(function() {
66545         var box = pointBox(entity.loc, context);
66546         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
66547         timeout2(function() {
66548           context.map().on("move.intro drawn.intro", function() {
66549             var entity2 = context.hasEntity(_pointID);
66550             if (!entity2) return chapter.restart();
66551             var box2 = pointBox(entity2.loc, context);
66552             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
66553           });
66554         }, 600);
66555         context.on("enter.intro", function(mode) {
66556           if (mode.id !== "select") return;
66557           continueTo(updatePoint);
66558         });
66559       }, msec + 100);
66560       function continueTo(nextStep) {
66561         context.map().on("move.intro drawn.intro", null);
66562         context.on("enter.intro", null);
66563         nextStep();
66564       }
66565     }
66566     function updatePoint() {
66567       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66568         return continueTo(reselectPoint);
66569       }
66570       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66571       context.on("exit.intro", function() {
66572         continueTo(reselectPoint);
66573       });
66574       context.history().on("change.intro", function() {
66575         continueTo(updateCloseEditor);
66576       });
66577       timeout2(function() {
66578         reveal(
66579           ".entity-editor-pane",
66580           helpHtml("intro.points.update"),
66581           { tooltipClass: "intro-points-describe" }
66582         );
66583       }, 400);
66584       function continueTo(nextStep) {
66585         context.on("exit.intro", null);
66586         context.history().on("change.intro", null);
66587         nextStep();
66588       }
66589     }
66590     function updateCloseEditor() {
66591       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66592         return continueTo(reselectPoint);
66593       }
66594       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66595       context.on("exit.intro", function() {
66596         continueTo(rightClickPoint);
66597       });
66598       timeout2(function() {
66599         reveal(
66600           ".entity-editor-pane",
66601           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
66602         );
66603       }, 500);
66604       function continueTo(nextStep) {
66605         context.on("exit.intro", null);
66606         nextStep();
66607       }
66608     }
66609     function rightClickPoint() {
66610       if (!_pointID) return chapter.restart();
66611       var entity = context.hasEntity(_pointID);
66612       if (!entity) return chapter.restart();
66613       context.enter(modeBrowse(context));
66614       var box = pointBox(entity.loc, context);
66615       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
66616       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
66617       timeout2(function() {
66618         context.map().on("move.intro", function() {
66619           var entity2 = context.hasEntity(_pointID);
66620           if (!entity2) return chapter.restart();
66621           var box2 = pointBox(entity2.loc, context);
66622           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
66623         });
66624       }, 600);
66625       context.on("enter.intro", function(mode) {
66626         if (mode.id !== "select") return;
66627         var ids = context.selectedIDs();
66628         if (ids.length !== 1 || ids[0] !== _pointID) return;
66629         timeout2(function() {
66630           var node = selectMenuItem(context, "delete").node();
66631           if (!node) return;
66632           continueTo(enterDelete);
66633         }, 50);
66634       });
66635       function continueTo(nextStep) {
66636         context.on("enter.intro", null);
66637         context.map().on("move.intro", null);
66638         nextStep();
66639       }
66640     }
66641     function enterDelete() {
66642       if (!_pointID) return chapter.restart();
66643       var entity = context.hasEntity(_pointID);
66644       if (!entity) return chapter.restart();
66645       var node = selectMenuItem(context, "delete").node();
66646       if (!node) {
66647         return continueTo(rightClickPoint);
66648       }
66649       reveal(
66650         ".edit-menu",
66651         helpHtml("intro.points.delete"),
66652         { padding: 50 }
66653       );
66654       timeout2(function() {
66655         context.map().on("move.intro", function() {
66656           if (selectMenuItem(context, "delete").empty()) {
66657             return continueTo(rightClickPoint);
66658           }
66659           reveal(
66660             ".edit-menu",
66661             helpHtml("intro.points.delete"),
66662             { duration: 0, padding: 50 }
66663           );
66664         });
66665       }, 300);
66666       context.on("exit.intro", function() {
66667         if (!_pointID) return chapter.restart();
66668         var entity2 = context.hasEntity(_pointID);
66669         if (entity2) return continueTo(rightClickPoint);
66670       });
66671       context.history().on("change.intro", function(changed) {
66672         if (changed.deleted().length) {
66673           continueTo(undo);
66674         }
66675       });
66676       function continueTo(nextStep) {
66677         context.map().on("move.intro", null);
66678         context.history().on("change.intro", null);
66679         context.on("exit.intro", null);
66680         nextStep();
66681       }
66682     }
66683     function undo() {
66684       context.history().on("change.intro", function() {
66685         continueTo(play);
66686       });
66687       reveal(
66688         ".top-toolbar button.undo-button",
66689         helpHtml("intro.points.undo")
66690       );
66691       function continueTo(nextStep) {
66692         context.history().on("change.intro", null);
66693         nextStep();
66694       }
66695     }
66696     function play() {
66697       dispatch14.call("done");
66698       reveal(
66699         ".ideditor",
66700         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
66701         {
66702           tooltipBox: ".intro-nav-wrap .chapter-area",
66703           buttonText: _t.html("intro.ok"),
66704           buttonCallback: function() {
66705             reveal(".ideditor");
66706           }
66707         }
66708       );
66709     }
66710     chapter.enter = function() {
66711       addPoint();
66712     };
66713     chapter.exit = function() {
66714       timeouts.forEach(window.clearTimeout);
66715       context.on("enter.intro exit.intro", null);
66716       context.map().on("move.intro drawn.intro", null);
66717       context.history().on("change.intro", null);
66718       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66719       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66720     };
66721     chapter.restart = function() {
66722       chapter.exit();
66723       chapter.enter();
66724     };
66725     return utilRebind(chapter, dispatch14, "on");
66726   }
66727   var init_point = __esm({
66728     "modules/ui/intro/point.js"() {
66729       "use strict";
66730       init_src4();
66731       init_src5();
66732       init_presets();
66733       init_localizer();
66734       init_change_preset();
66735       init_browse();
66736       init_select5();
66737       init_rebind();
66738       init_helper();
66739     }
66740   });
66741
66742   // modules/ui/intro/area.js
66743   var area_exports = {};
66744   __export(area_exports, {
66745     uiIntroArea: () => uiIntroArea
66746   });
66747   function uiIntroArea(context, reveal) {
66748     var dispatch14 = dispatch_default("done");
66749     var playground = [-85.63552, 41.94159];
66750     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
66751     var nameField = _mainPresetIndex.field("name");
66752     var descriptionField = _mainPresetIndex.field("description");
66753     var timeouts = [];
66754     var _areaID;
66755     var chapter = {
66756       title: "intro.areas.title"
66757     };
66758     function timeout2(f2, t2) {
66759       timeouts.push(window.setTimeout(f2, t2));
66760     }
66761     function eventCancel(d3_event) {
66762       d3_event.stopPropagation();
66763       d3_event.preventDefault();
66764     }
66765     function revealPlayground(center, text, options) {
66766       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
66767       var box = pad2(center, padding, context);
66768       reveal(box, text, options);
66769     }
66770     function addArea() {
66771       context.enter(modeBrowse(context));
66772       context.history().reset("initial");
66773       _areaID = null;
66774       var msec = transitionTime(playground, context.map().center());
66775       if (msec) {
66776         reveal(null, null, { duration: 0 });
66777       }
66778       context.map().centerZoomEase(playground, 19, msec);
66779       timeout2(function() {
66780         var tooltip = reveal(
66781           "button.add-area",
66782           helpHtml("intro.areas.add_playground")
66783         );
66784         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
66785         context.on("enter.intro", function(mode) {
66786           if (mode.id !== "add-area") return;
66787           continueTo(startPlayground);
66788         });
66789       }, msec + 100);
66790       function continueTo(nextStep) {
66791         context.on("enter.intro", null);
66792         nextStep();
66793       }
66794     }
66795     function startPlayground() {
66796       if (context.mode().id !== "add-area") {
66797         return chapter.restart();
66798       }
66799       _areaID = null;
66800       context.map().zoomEase(19.5, 500);
66801       timeout2(function() {
66802         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
66803         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
66804         revealPlayground(
66805           playground,
66806           startDrawString,
66807           { duration: 250 }
66808         );
66809         timeout2(function() {
66810           context.map().on("move.intro drawn.intro", function() {
66811             revealPlayground(
66812               playground,
66813               startDrawString,
66814               { duration: 0 }
66815             );
66816           });
66817           context.on("enter.intro", function(mode) {
66818             if (mode.id !== "draw-area") return chapter.restart();
66819             continueTo(continuePlayground);
66820           });
66821         }, 250);
66822       }, 550);
66823       function continueTo(nextStep) {
66824         context.map().on("move.intro drawn.intro", null);
66825         context.on("enter.intro", null);
66826         nextStep();
66827       }
66828     }
66829     function continuePlayground() {
66830       if (context.mode().id !== "draw-area") {
66831         return chapter.restart();
66832       }
66833       _areaID = null;
66834       revealPlayground(
66835         playground,
66836         helpHtml("intro.areas.continue_playground"),
66837         { duration: 250 }
66838       );
66839       timeout2(function() {
66840         context.map().on("move.intro drawn.intro", function() {
66841           revealPlayground(
66842             playground,
66843             helpHtml("intro.areas.continue_playground"),
66844             { duration: 0 }
66845           );
66846         });
66847       }, 250);
66848       context.on("enter.intro", function(mode) {
66849         if (mode.id === "draw-area") {
66850           var entity = context.hasEntity(context.selectedIDs()[0]);
66851           if (entity && entity.nodes.length >= 6) {
66852             return continueTo(finishPlayground);
66853           } else {
66854             return;
66855           }
66856         } else if (mode.id === "select") {
66857           _areaID = context.selectedIDs()[0];
66858           return continueTo(searchPresets);
66859         } else {
66860           return chapter.restart();
66861         }
66862       });
66863       function continueTo(nextStep) {
66864         context.map().on("move.intro drawn.intro", null);
66865         context.on("enter.intro", null);
66866         nextStep();
66867       }
66868     }
66869     function finishPlayground() {
66870       if (context.mode().id !== "draw-area") {
66871         return chapter.restart();
66872       }
66873       _areaID = null;
66874       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
66875       revealPlayground(
66876         playground,
66877         finishString,
66878         { duration: 250 }
66879       );
66880       timeout2(function() {
66881         context.map().on("move.intro drawn.intro", function() {
66882           revealPlayground(
66883             playground,
66884             finishString,
66885             { duration: 0 }
66886           );
66887         });
66888       }, 250);
66889       context.on("enter.intro", function(mode) {
66890         if (mode.id === "draw-area") {
66891           return;
66892         } else if (mode.id === "select") {
66893           _areaID = context.selectedIDs()[0];
66894           return continueTo(searchPresets);
66895         } else {
66896           return chapter.restart();
66897         }
66898       });
66899       function continueTo(nextStep) {
66900         context.map().on("move.intro drawn.intro", null);
66901         context.on("enter.intro", null);
66902         nextStep();
66903       }
66904     }
66905     function searchPresets() {
66906       if (!_areaID || !context.hasEntity(_areaID)) {
66907         return addArea();
66908       }
66909       var ids = context.selectedIDs();
66910       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
66911         context.enter(modeSelect(context, [_areaID]));
66912       }
66913       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66914       timeout2(function() {
66915         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
66916         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66917         reveal(
66918           ".preset-search-input",
66919           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
66920         );
66921       }, 400);
66922       context.on("enter.intro", function(mode) {
66923         if (!_areaID || !context.hasEntity(_areaID)) {
66924           return continueTo(addArea);
66925         }
66926         var ids2 = context.selectedIDs();
66927         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
66928           context.enter(modeSelect(context, [_areaID]));
66929           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
66930           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66931           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66932           reveal(
66933             ".preset-search-input",
66934             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
66935           );
66936           context.history().on("change.intro", null);
66937         }
66938       });
66939       function checkPresetSearch() {
66940         var first = context.container().select(".preset-list-item:first-child");
66941         if (first.classed("preset-leisure-playground")) {
66942           reveal(
66943             first.select(".preset-list-button").node(),
66944             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
66945             { duration: 300 }
66946           );
66947           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66948           context.history().on("change.intro", function() {
66949             continueTo(clickAddField);
66950           });
66951         }
66952       }
66953       function continueTo(nextStep) {
66954         context.container().select(".inspector-wrap").on("wheel.intro", null);
66955         context.on("enter.intro", null);
66956         context.history().on("change.intro", null);
66957         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66958         nextStep();
66959       }
66960     }
66961     function clickAddField() {
66962       if (!_areaID || !context.hasEntity(_areaID)) {
66963         return addArea();
66964       }
66965       var ids = context.selectedIDs();
66966       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
66967         return searchPresets();
66968       }
66969       if (!context.container().select(".form-field-description").empty()) {
66970         return continueTo(describePlayground);
66971       }
66972       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66973       timeout2(function() {
66974         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66975         var entity = context.entity(_areaID);
66976         if (entity.tags.description) {
66977           return continueTo(play);
66978         }
66979         var box = context.container().select(".more-fields").node().getBoundingClientRect();
66980         if (box.top > 300) {
66981           var pane = context.container().select(".entity-editor-pane .inspector-body");
66982           var start2 = pane.node().scrollTop;
66983           var end = start2 + (box.top - 300);
66984           pane.transition().duration(250).tween("scroll.inspector", function() {
66985             var node = this;
66986             var i3 = number_default(start2, end);
66987             return function(t2) {
66988               node.scrollTop = i3(t2);
66989             };
66990           });
66991         }
66992         timeout2(function() {
66993           reveal(
66994             ".more-fields .combobox-input",
66995             helpHtml("intro.areas.add_field", {
66996               name: nameField.title(),
66997               description: descriptionField.title()
66998             }),
66999             { duration: 300 }
67000           );
67001           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
67002             var watcher;
67003             watcher = window.setInterval(function() {
67004               if (!context.container().select("div.combobox").empty()) {
67005                 window.clearInterval(watcher);
67006                 continueTo(chooseDescriptionField);
67007               }
67008             }, 300);
67009           });
67010         }, 300);
67011       }, 400);
67012       context.on("exit.intro", function() {
67013         return continueTo(searchPresets);
67014       });
67015       function continueTo(nextStep) {
67016         context.container().select(".inspector-wrap").on("wheel.intro", null);
67017         context.container().select(".more-fields .combobox-input").on("click.intro", null);
67018         context.on("exit.intro", null);
67019         nextStep();
67020       }
67021     }
67022     function chooseDescriptionField() {
67023       if (!_areaID || !context.hasEntity(_areaID)) {
67024         return addArea();
67025       }
67026       var ids = context.selectedIDs();
67027       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67028         return searchPresets();
67029       }
67030       if (!context.container().select(".form-field-description").empty()) {
67031         return continueTo(describePlayground);
67032       }
67033       if (context.container().select("div.combobox").empty()) {
67034         return continueTo(clickAddField);
67035       }
67036       var watcher;
67037       watcher = window.setInterval(function() {
67038         if (context.container().select("div.combobox").empty()) {
67039           window.clearInterval(watcher);
67040           timeout2(function() {
67041             if (context.container().select(".form-field-description").empty()) {
67042               continueTo(retryChooseDescription);
67043             } else {
67044               continueTo(describePlayground);
67045             }
67046           }, 300);
67047         }
67048       }, 300);
67049       reveal(
67050         "div.combobox",
67051         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
67052         { duration: 300 }
67053       );
67054       context.on("exit.intro", function() {
67055         return continueTo(searchPresets);
67056       });
67057       function continueTo(nextStep) {
67058         if (watcher) window.clearInterval(watcher);
67059         context.on("exit.intro", null);
67060         nextStep();
67061       }
67062     }
67063     function describePlayground() {
67064       if (!_areaID || !context.hasEntity(_areaID)) {
67065         return addArea();
67066       }
67067       var ids = context.selectedIDs();
67068       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67069         return searchPresets();
67070       }
67071       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
67072       if (context.container().select(".form-field-description").empty()) {
67073         return continueTo(retryChooseDescription);
67074       }
67075       context.on("exit.intro", function() {
67076         continueTo(play);
67077       });
67078       reveal(
67079         ".entity-editor-pane",
67080         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
67081         { duration: 300 }
67082       );
67083       function continueTo(nextStep) {
67084         context.on("exit.intro", null);
67085         nextStep();
67086       }
67087     }
67088     function retryChooseDescription() {
67089       if (!_areaID || !context.hasEntity(_areaID)) {
67090         return addArea();
67091       }
67092       var ids = context.selectedIDs();
67093       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67094         return searchPresets();
67095       }
67096       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
67097       reveal(
67098         ".entity-editor-pane",
67099         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
67100         {
67101           buttonText: _t.html("intro.ok"),
67102           buttonCallback: function() {
67103             continueTo(clickAddField);
67104           }
67105         }
67106       );
67107       context.on("exit.intro", function() {
67108         return continueTo(searchPresets);
67109       });
67110       function continueTo(nextStep) {
67111         context.on("exit.intro", null);
67112         nextStep();
67113       }
67114     }
67115     function play() {
67116       dispatch14.call("done");
67117       reveal(
67118         ".ideditor",
67119         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
67120         {
67121           tooltipBox: ".intro-nav-wrap .chapter-line",
67122           buttonText: _t.html("intro.ok"),
67123           buttonCallback: function() {
67124             reveal(".ideditor");
67125           }
67126         }
67127       );
67128     }
67129     chapter.enter = function() {
67130       addArea();
67131     };
67132     chapter.exit = function() {
67133       timeouts.forEach(window.clearTimeout);
67134       context.on("enter.intro exit.intro", null);
67135       context.map().on("move.intro drawn.intro", null);
67136       context.history().on("change.intro", null);
67137       context.container().select(".inspector-wrap").on("wheel.intro", null);
67138       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
67139       context.container().select(".more-fields .combobox-input").on("click.intro", null);
67140     };
67141     chapter.restart = function() {
67142       chapter.exit();
67143       chapter.enter();
67144     };
67145     return utilRebind(chapter, dispatch14, "on");
67146   }
67147   var init_area4 = __esm({
67148     "modules/ui/intro/area.js"() {
67149       "use strict";
67150       init_src4();
67151       init_src8();
67152       init_presets();
67153       init_localizer();
67154       init_browse();
67155       init_select5();
67156       init_rebind();
67157       init_helper();
67158     }
67159   });
67160
67161   // modules/ui/intro/line.js
67162   var line_exports = {};
67163   __export(line_exports, {
67164     uiIntroLine: () => uiIntroLine
67165   });
67166   function uiIntroLine(context, reveal) {
67167     var dispatch14 = dispatch_default("done");
67168     var timeouts = [];
67169     var _tulipRoadID = null;
67170     var flowerRoadID = "w646";
67171     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
67172     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
67173     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
67174     var roadCategory = _mainPresetIndex.item("category-road_minor");
67175     var residentialPreset = _mainPresetIndex.item("highway/residential");
67176     var woodRoadID = "w525";
67177     var woodRoadEndID = "n2862";
67178     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
67179     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
67180     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
67181     var washingtonStreetID = "w522";
67182     var twelfthAvenueID = "w1";
67183     var eleventhAvenueEndID = "n3550";
67184     var twelfthAvenueEndID = "n5";
67185     var _washingtonSegmentID = null;
67186     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
67187     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
67188     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
67189     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
67190     var chapter = {
67191       title: "intro.lines.title"
67192     };
67193     function timeout2(f2, t2) {
67194       timeouts.push(window.setTimeout(f2, t2));
67195     }
67196     function eventCancel(d3_event) {
67197       d3_event.stopPropagation();
67198       d3_event.preventDefault();
67199     }
67200     function addLine() {
67201       context.enter(modeBrowse(context));
67202       context.history().reset("initial");
67203       var msec = transitionTime(tulipRoadStart, context.map().center());
67204       if (msec) {
67205         reveal(null, null, { duration: 0 });
67206       }
67207       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
67208       timeout2(function() {
67209         var tooltip = reveal(
67210           "button.add-line",
67211           helpHtml("intro.lines.add_line")
67212         );
67213         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
67214         context.on("enter.intro", function(mode) {
67215           if (mode.id !== "add-line") return;
67216           continueTo(startLine);
67217         });
67218       }, msec + 100);
67219       function continueTo(nextStep) {
67220         context.on("enter.intro", null);
67221         nextStep();
67222       }
67223     }
67224     function startLine() {
67225       if (context.mode().id !== "add-line") return chapter.restart();
67226       _tulipRoadID = null;
67227       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
67228       var box = pad2(tulipRoadStart, padding, context);
67229       box.height = box.height + 100;
67230       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
67231       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
67232       reveal(box, startLineString);
67233       context.map().on("move.intro drawn.intro", function() {
67234         padding = 70 * Math.pow(2, context.map().zoom() - 18);
67235         box = pad2(tulipRoadStart, padding, context);
67236         box.height = box.height + 100;
67237         reveal(box, startLineString, { duration: 0 });
67238       });
67239       context.on("enter.intro", function(mode) {
67240         if (mode.id !== "draw-line") return chapter.restart();
67241         continueTo(drawLine);
67242       });
67243       function continueTo(nextStep) {
67244         context.map().on("move.intro drawn.intro", null);
67245         context.on("enter.intro", null);
67246         nextStep();
67247       }
67248     }
67249     function drawLine() {
67250       if (context.mode().id !== "draw-line") return chapter.restart();
67251       _tulipRoadID = context.mode().selectedIDs()[0];
67252       context.map().centerEase(tulipRoadMidpoint, 500);
67253       timeout2(function() {
67254         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
67255         var box = pad2(tulipRoadMidpoint, padding, context);
67256         box.height = box.height * 2;
67257         reveal(
67258           box,
67259           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
67260         );
67261         context.map().on("move.intro drawn.intro", function() {
67262           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
67263           box = pad2(tulipRoadMidpoint, padding, context);
67264           box.height = box.height * 2;
67265           reveal(
67266             box,
67267             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
67268             { duration: 0 }
67269           );
67270         });
67271       }, 550);
67272       context.history().on("change.intro", function() {
67273         if (isLineConnected()) {
67274           continueTo(continueLine);
67275         }
67276       });
67277       context.on("enter.intro", function(mode) {
67278         if (mode.id === "draw-line") {
67279           return;
67280         } else if (mode.id === "select") {
67281           continueTo(retryIntersect);
67282           return;
67283         } else {
67284           return chapter.restart();
67285         }
67286       });
67287       function continueTo(nextStep) {
67288         context.map().on("move.intro drawn.intro", null);
67289         context.history().on("change.intro", null);
67290         context.on("enter.intro", null);
67291         nextStep();
67292       }
67293     }
67294     function isLineConnected() {
67295       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
67296       if (!entity) return false;
67297       var drawNodes = context.graph().childNodes(entity);
67298       return drawNodes.some(function(node) {
67299         return context.graph().parentWays(node).some(function(parent2) {
67300           return parent2.id === flowerRoadID;
67301         });
67302       });
67303     }
67304     function retryIntersect() {
67305       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
67306       var box = pad2(tulipRoadIntersection, 80, context);
67307       reveal(
67308         box,
67309         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
67310       );
67311       timeout2(chapter.restart, 3e3);
67312     }
67313     function continueLine() {
67314       if (context.mode().id !== "draw-line") return chapter.restart();
67315       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
67316       if (!entity) return chapter.restart();
67317       context.map().centerEase(tulipRoadIntersection, 500);
67318       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
67319       reveal(".main-map .surface", continueLineText);
67320       context.on("enter.intro", function(mode) {
67321         if (mode.id === "draw-line") {
67322           return;
67323         } else if (mode.id === "select") {
67324           return continueTo(chooseCategoryRoad);
67325         } else {
67326           return chapter.restart();
67327         }
67328       });
67329       function continueTo(nextStep) {
67330         context.on("enter.intro", null);
67331         nextStep();
67332       }
67333     }
67334     function chooseCategoryRoad() {
67335       if (context.mode().id !== "select") return chapter.restart();
67336       context.on("exit.intro", function() {
67337         return chapter.restart();
67338       });
67339       var button = context.container().select(".preset-category-road_minor .preset-list-button");
67340       if (button.empty()) return chapter.restart();
67341       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
67342       timeout2(function() {
67343         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
67344         reveal(
67345           button.node(),
67346           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
67347         );
67348         button.on("click.intro", function() {
67349           continueTo(choosePresetResidential);
67350         });
67351       }, 400);
67352       function continueTo(nextStep) {
67353         context.container().select(".inspector-wrap").on("wheel.intro", null);
67354         context.container().select(".preset-list-button").on("click.intro", null);
67355         context.on("exit.intro", null);
67356         nextStep();
67357       }
67358     }
67359     function choosePresetResidential() {
67360       if (context.mode().id !== "select") return chapter.restart();
67361       context.on("exit.intro", function() {
67362         return chapter.restart();
67363       });
67364       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
67365       if (subgrid.empty()) return chapter.restart();
67366       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
67367         continueTo(retryPresetResidential);
67368       });
67369       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
67370         continueTo(nameRoad);
67371       });
67372       timeout2(function() {
67373         reveal(
67374           subgrid.node(),
67375           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
67376           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
67377         );
67378       }, 300);
67379       function continueTo(nextStep) {
67380         context.container().select(".preset-list-button").on("click.intro", null);
67381         context.on("exit.intro", null);
67382         nextStep();
67383       }
67384     }
67385     function retryPresetResidential() {
67386       if (context.mode().id !== "select") return chapter.restart();
67387       context.on("exit.intro", function() {
67388         return chapter.restart();
67389       });
67390       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
67391       timeout2(function() {
67392         var button = context.container().select(".entity-editor-pane .preset-list-button");
67393         reveal(
67394           button.node(),
67395           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
67396         );
67397         button.on("click.intro", function() {
67398           continueTo(chooseCategoryRoad);
67399         });
67400       }, 500);
67401       function continueTo(nextStep) {
67402         context.container().select(".inspector-wrap").on("wheel.intro", null);
67403         context.container().select(".preset-list-button").on("click.intro", null);
67404         context.on("exit.intro", null);
67405         nextStep();
67406       }
67407     }
67408     function nameRoad() {
67409       context.on("exit.intro", function() {
67410         continueTo(didNameRoad);
67411       });
67412       timeout2(function() {
67413         reveal(
67414           ".entity-editor-pane",
67415           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
67416           { tooltipClass: "intro-lines-name_road" }
67417         );
67418       }, 500);
67419       function continueTo(nextStep) {
67420         context.on("exit.intro", null);
67421         nextStep();
67422       }
67423     }
67424     function didNameRoad() {
67425       context.history().checkpoint("doneAddLine");
67426       timeout2(function() {
67427         reveal(".main-map .surface", helpHtml("intro.lines.did_name_road"), {
67428           buttonText: _t.html("intro.ok"),
67429           buttonCallback: function() {
67430             continueTo(updateLine);
67431           }
67432         });
67433       }, 500);
67434       function continueTo(nextStep) {
67435         nextStep();
67436       }
67437     }
67438     function updateLine() {
67439       context.history().reset("doneAddLine");
67440       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67441         return chapter.restart();
67442       }
67443       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
67444       if (msec) {
67445         reveal(null, null, { duration: 0 });
67446       }
67447       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
67448       timeout2(function() {
67449         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
67450         var box = pad2(woodRoadDragMidpoint, padding, context);
67451         var advance = function() {
67452           continueTo(addNode);
67453         };
67454         reveal(
67455           box,
67456           helpHtml("intro.lines.update_line"),
67457           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67458         );
67459         context.map().on("move.intro drawn.intro", function() {
67460           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
67461           var box2 = pad2(woodRoadDragMidpoint, padding2, context);
67462           reveal(
67463             box2,
67464             helpHtml("intro.lines.update_line"),
67465             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67466           );
67467         });
67468       }, msec + 100);
67469       function continueTo(nextStep) {
67470         context.map().on("move.intro drawn.intro", null);
67471         nextStep();
67472       }
67473     }
67474     function addNode() {
67475       context.history().reset("doneAddLine");
67476       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67477         return chapter.restart();
67478       }
67479       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
67480       var box = pad2(woodRoadAddNode, padding, context);
67481       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
67482       reveal(box, addNodeString);
67483       context.map().on("move.intro drawn.intro", function() {
67484         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
67485         var box2 = pad2(woodRoadAddNode, padding2, context);
67486         reveal(box2, addNodeString, { duration: 0 });
67487       });
67488       context.history().on("change.intro", function(changed) {
67489         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67490           return continueTo(updateLine);
67491         }
67492         if (changed.created().length === 1) {
67493           timeout2(function() {
67494             continueTo(startDragEndpoint);
67495           }, 500);
67496         }
67497       });
67498       context.on("enter.intro", function(mode) {
67499         if (mode.id !== "select") {
67500           continueTo(updateLine);
67501         }
67502       });
67503       function continueTo(nextStep) {
67504         context.map().on("move.intro drawn.intro", null);
67505         context.history().on("change.intro", null);
67506         context.on("enter.intro", null);
67507         nextStep();
67508       }
67509     }
67510     function startDragEndpoint() {
67511       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67512         return continueTo(updateLine);
67513       }
67514       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67515       var box = pad2(woodRoadDragEndpoint, padding, context);
67516       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
67517       reveal(box, startDragString);
67518       context.map().on("move.intro drawn.intro", function() {
67519         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67520           return continueTo(updateLine);
67521         }
67522         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67523         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67524         reveal(box2, startDragString, { duration: 0 });
67525         var entity = context.entity(woodRoadEndID);
67526         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
67527           continueTo(finishDragEndpoint);
67528         }
67529       });
67530       function continueTo(nextStep) {
67531         context.map().on("move.intro drawn.intro", null);
67532         nextStep();
67533       }
67534     }
67535     function finishDragEndpoint() {
67536       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67537         return continueTo(updateLine);
67538       }
67539       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67540       var box = pad2(woodRoadDragEndpoint, padding, context);
67541       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
67542       reveal(box, finishDragString);
67543       context.map().on("move.intro drawn.intro", function() {
67544         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67545           return continueTo(updateLine);
67546         }
67547         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67548         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67549         reveal(box2, finishDragString, { duration: 0 });
67550         var entity = context.entity(woodRoadEndID);
67551         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
67552           continueTo(startDragEndpoint);
67553         }
67554       });
67555       context.on("enter.intro", function() {
67556         continueTo(startDragMidpoint);
67557       });
67558       function continueTo(nextStep) {
67559         context.map().on("move.intro drawn.intro", null);
67560         context.on("enter.intro", null);
67561         nextStep();
67562       }
67563     }
67564     function startDragMidpoint() {
67565       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67566         return continueTo(updateLine);
67567       }
67568       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
67569         context.enter(modeSelect(context, [woodRoadID]));
67570       }
67571       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
67572       var box = pad2(woodRoadDragMidpoint, padding, context);
67573       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
67574       context.map().on("move.intro drawn.intro", function() {
67575         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67576           return continueTo(updateLine);
67577         }
67578         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
67579         var box2 = pad2(woodRoadDragMidpoint, padding2, context);
67580         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
67581       });
67582       context.history().on("change.intro", function(changed) {
67583         if (changed.created().length === 1) {
67584           continueTo(continueDragMidpoint);
67585         }
67586       });
67587       context.on("enter.intro", function(mode) {
67588         if (mode.id !== "select") {
67589           context.enter(modeSelect(context, [woodRoadID]));
67590         }
67591       });
67592       function continueTo(nextStep) {
67593         context.map().on("move.intro drawn.intro", null);
67594         context.history().on("change.intro", null);
67595         context.on("enter.intro", null);
67596         nextStep();
67597       }
67598     }
67599     function continueDragMidpoint() {
67600       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67601         return continueTo(updateLine);
67602       }
67603       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67604       var box = pad2(woodRoadDragEndpoint, padding, context);
67605       box.height += 400;
67606       var advance = function() {
67607         context.history().checkpoint("doneUpdateLine");
67608         continueTo(deleteLines);
67609       };
67610       reveal(
67611         box,
67612         helpHtml("intro.lines.continue_drag_midpoint"),
67613         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67614       );
67615       context.map().on("move.intro drawn.intro", function() {
67616         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67617           return continueTo(updateLine);
67618         }
67619         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67620         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67621         box2.height += 400;
67622         reveal(
67623           box2,
67624           helpHtml("intro.lines.continue_drag_midpoint"),
67625           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67626         );
67627       });
67628       function continueTo(nextStep) {
67629         context.map().on("move.intro drawn.intro", null);
67630         nextStep();
67631       }
67632     }
67633     function deleteLines() {
67634       context.history().reset("doneUpdateLine");
67635       context.enter(modeBrowse(context));
67636       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67637         return chapter.restart();
67638       }
67639       var msec = transitionTime(deleteLinesLoc, context.map().center());
67640       if (msec) {
67641         reveal(null, null, { duration: 0 });
67642       }
67643       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
67644       timeout2(function() {
67645         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67646         var box = pad2(deleteLinesLoc, padding, context);
67647         box.top -= 200;
67648         box.height += 400;
67649         var advance = function() {
67650           continueTo(rightClickIntersection);
67651         };
67652         reveal(
67653           box,
67654           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
67655           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67656         );
67657         context.map().on("move.intro drawn.intro", function() {
67658           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67659           var box2 = pad2(deleteLinesLoc, padding2, context);
67660           box2.top -= 200;
67661           box2.height += 400;
67662           reveal(
67663             box2,
67664             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
67665             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67666           );
67667         });
67668         context.history().on("change.intro", function() {
67669           timeout2(function() {
67670             continueTo(deleteLines);
67671           }, 500);
67672         });
67673       }, msec + 100);
67674       function continueTo(nextStep) {
67675         context.map().on("move.intro drawn.intro", null);
67676         context.history().on("change.intro", null);
67677         nextStep();
67678       }
67679     }
67680     function rightClickIntersection() {
67681       context.history().reset("doneUpdateLine");
67682       context.enter(modeBrowse(context));
67683       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
67684       var rightClickString = helpHtml("intro.lines.split_street", {
67685         street1: _t("intro.graph.name.11th-avenue"),
67686         street2: _t("intro.graph.name.washington-street")
67687       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
67688       timeout2(function() {
67689         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
67690         var box = pad2(eleventhAvenueEnd, padding, context);
67691         reveal(box, rightClickString);
67692         context.map().on("move.intro drawn.intro", function() {
67693           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
67694           var box2 = pad2(eleventhAvenueEnd, padding2, context);
67695           reveal(
67696             box2,
67697             rightClickString,
67698             { duration: 0 }
67699           );
67700         });
67701         context.on("enter.intro", function(mode) {
67702           if (mode.id !== "select") return;
67703           var ids = context.selectedIDs();
67704           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return;
67705           timeout2(function() {
67706             var node = selectMenuItem(context, "split").node();
67707             if (!node) return;
67708             continueTo(splitIntersection);
67709           }, 50);
67710         });
67711         context.history().on("change.intro", function() {
67712           timeout2(function() {
67713             continueTo(deleteLines);
67714           }, 300);
67715         });
67716       }, 600);
67717       function continueTo(nextStep) {
67718         context.map().on("move.intro drawn.intro", null);
67719         context.on("enter.intro", null);
67720         context.history().on("change.intro", null);
67721         nextStep();
67722       }
67723     }
67724     function splitIntersection() {
67725       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67726         return continueTo(deleteLines);
67727       }
67728       var node = selectMenuItem(context, "split").node();
67729       if (!node) {
67730         return continueTo(rightClickIntersection);
67731       }
67732       var wasChanged = false;
67733       _washingtonSegmentID = null;
67734       reveal(
67735         ".edit-menu",
67736         helpHtml(
67737           "intro.lines.split_intersection",
67738           { street: _t("intro.graph.name.washington-street") }
67739         ),
67740         { padding: 50 }
67741       );
67742       context.map().on("move.intro drawn.intro", function() {
67743         var node2 = selectMenuItem(context, "split").node();
67744         if (!wasChanged && !node2) {
67745           return continueTo(rightClickIntersection);
67746         }
67747         reveal(
67748           ".edit-menu",
67749           helpHtml(
67750             "intro.lines.split_intersection",
67751             { street: _t("intro.graph.name.washington-street") }
67752           ),
67753           { duration: 0, padding: 50 }
67754         );
67755       });
67756       context.history().on("change.intro", function(changed) {
67757         wasChanged = true;
67758         timeout2(function() {
67759           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
67760             _washingtonSegmentID = changed.created()[0].id;
67761             continueTo(didSplit);
67762           } else {
67763             _washingtonSegmentID = null;
67764             continueTo(retrySplit);
67765           }
67766         }, 300);
67767       });
67768       function continueTo(nextStep) {
67769         context.map().on("move.intro drawn.intro", null);
67770         context.history().on("change.intro", null);
67771         nextStep();
67772       }
67773     }
67774     function retrySplit() {
67775       context.enter(modeBrowse(context));
67776       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
67777       var advance = function() {
67778         continueTo(rightClickIntersection);
67779       };
67780       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
67781       var box = pad2(eleventhAvenueEnd, padding, context);
67782       reveal(
67783         box,
67784         helpHtml("intro.lines.retry_split"),
67785         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67786       );
67787       context.map().on("move.intro drawn.intro", function() {
67788         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
67789         var box2 = pad2(eleventhAvenueEnd, padding2, context);
67790         reveal(
67791           box2,
67792           helpHtml("intro.lines.retry_split"),
67793           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67794         );
67795       });
67796       function continueTo(nextStep) {
67797         context.map().on("move.intro drawn.intro", null);
67798         nextStep();
67799       }
67800     }
67801     function didSplit() {
67802       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67803         return continueTo(rightClickIntersection);
67804       }
67805       var ids = context.selectedIDs();
67806       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
67807       var street = _t("intro.graph.name.washington-street");
67808       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67809       var box = pad2(twelfthAvenue, padding, context);
67810       box.width = box.width / 2;
67811       reveal(
67812         box,
67813         helpHtml(string, { street1: street, street2: street }),
67814         { duration: 500 }
67815       );
67816       timeout2(function() {
67817         context.map().centerZoomEase(twelfthAvenue, 18, 500);
67818         context.map().on("move.intro drawn.intro", function() {
67819           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67820           var box2 = pad2(twelfthAvenue, padding2, context);
67821           box2.width = box2.width / 2;
67822           reveal(
67823             box2,
67824             helpHtml(string, { street1: street, street2: street }),
67825             { duration: 0 }
67826           );
67827         });
67828       }, 600);
67829       context.on("enter.intro", function() {
67830         var ids2 = context.selectedIDs();
67831         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
67832           continueTo(multiSelect2);
67833         }
67834       });
67835       context.history().on("change.intro", function() {
67836         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67837           return continueTo(rightClickIntersection);
67838         }
67839       });
67840       function continueTo(nextStep) {
67841         context.map().on("move.intro drawn.intro", null);
67842         context.on("enter.intro", null);
67843         context.history().on("change.intro", null);
67844         nextStep();
67845       }
67846     }
67847     function multiSelect2() {
67848       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67849         return continueTo(rightClickIntersection);
67850       }
67851       var ids = context.selectedIDs();
67852       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
67853       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
67854       if (hasWashington && hasTwelfth) {
67855         return continueTo(multiRightClick);
67856       } else if (!hasWashington && !hasTwelfth) {
67857         return continueTo(didSplit);
67858       }
67859       context.map().centerZoomEase(twelfthAvenue, 18, 500);
67860       timeout2(function() {
67861         var selected, other, padding, box;
67862         if (hasWashington) {
67863           selected = _t("intro.graph.name.washington-street");
67864           other = _t("intro.graph.name.12th-avenue");
67865           padding = 60 * Math.pow(2, context.map().zoom() - 18);
67866           box = pad2(twelfthAvenueEnd, padding, context);
67867           box.width *= 3;
67868         } else {
67869           selected = _t("intro.graph.name.12th-avenue");
67870           other = _t("intro.graph.name.washington-street");
67871           padding = 200 * Math.pow(2, context.map().zoom() - 18);
67872           box = pad2(twelfthAvenue, padding, context);
67873           box.width /= 2;
67874         }
67875         reveal(
67876           box,
67877           helpHtml(
67878             "intro.lines.multi_select",
67879             { selected, other1: other }
67880           ) + " " + helpHtml(
67881             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
67882             { selected, other2: other }
67883           )
67884         );
67885         context.map().on("move.intro drawn.intro", function() {
67886           if (hasWashington) {
67887             selected = _t("intro.graph.name.washington-street");
67888             other = _t("intro.graph.name.12th-avenue");
67889             padding = 60 * Math.pow(2, context.map().zoom() - 18);
67890             box = pad2(twelfthAvenueEnd, padding, context);
67891             box.width *= 3;
67892           } else {
67893             selected = _t("intro.graph.name.12th-avenue");
67894             other = _t("intro.graph.name.washington-street");
67895             padding = 200 * Math.pow(2, context.map().zoom() - 18);
67896             box = pad2(twelfthAvenue, padding, context);
67897             box.width /= 2;
67898           }
67899           reveal(
67900             box,
67901             helpHtml(
67902               "intro.lines.multi_select",
67903               { selected, other1: other }
67904             ) + " " + helpHtml(
67905               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
67906               { selected, other2: other }
67907             ),
67908             { duration: 0 }
67909           );
67910         });
67911         context.on("enter.intro", function() {
67912           continueTo(multiSelect2);
67913         });
67914         context.history().on("change.intro", function() {
67915           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67916             return continueTo(rightClickIntersection);
67917           }
67918         });
67919       }, 600);
67920       function continueTo(nextStep) {
67921         context.map().on("move.intro drawn.intro", null);
67922         context.on("enter.intro", null);
67923         context.history().on("change.intro", null);
67924         nextStep();
67925       }
67926     }
67927     function multiRightClick() {
67928       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67929         return continueTo(rightClickIntersection);
67930       }
67931       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67932       var box = pad2(twelfthAvenue, padding, context);
67933       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
67934       reveal(box, rightClickString);
67935       context.map().on("move.intro drawn.intro", function() {
67936         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67937         var box2 = pad2(twelfthAvenue, padding2, context);
67938         reveal(box2, rightClickString, { duration: 0 });
67939       });
67940       context.ui().editMenu().on("toggled.intro", function(open) {
67941         if (!open) return;
67942         timeout2(function() {
67943           var ids = context.selectedIDs();
67944           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
67945             var node = selectMenuItem(context, "delete").node();
67946             if (!node) return;
67947             continueTo(multiDelete);
67948           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
67949             return continueTo(multiSelect2);
67950           } else {
67951             return continueTo(didSplit);
67952           }
67953         }, 300);
67954       });
67955       context.history().on("change.intro", function() {
67956         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67957           return continueTo(rightClickIntersection);
67958         }
67959       });
67960       function continueTo(nextStep) {
67961         context.map().on("move.intro drawn.intro", null);
67962         context.ui().editMenu().on("toggled.intro", null);
67963         context.history().on("change.intro", null);
67964         nextStep();
67965       }
67966     }
67967     function multiDelete() {
67968       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67969         return continueTo(rightClickIntersection);
67970       }
67971       var node = selectMenuItem(context, "delete").node();
67972       if (!node) return continueTo(multiRightClick);
67973       reveal(
67974         ".edit-menu",
67975         helpHtml("intro.lines.multi_delete"),
67976         { padding: 50 }
67977       );
67978       context.map().on("move.intro drawn.intro", function() {
67979         reveal(
67980           ".edit-menu",
67981           helpHtml("intro.lines.multi_delete"),
67982           { duration: 0, padding: 50 }
67983         );
67984       });
67985       context.on("exit.intro", function() {
67986         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
67987           return continueTo(multiSelect2);
67988         }
67989       });
67990       context.history().on("change.intro", function() {
67991         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
67992           continueTo(retryDelete);
67993         } else {
67994           continueTo(play);
67995         }
67996       });
67997       function continueTo(nextStep) {
67998         context.map().on("move.intro drawn.intro", null);
67999         context.on("exit.intro", null);
68000         context.history().on("change.intro", null);
68001         nextStep();
68002       }
68003     }
68004     function retryDelete() {
68005       context.enter(modeBrowse(context));
68006       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
68007       var box = pad2(twelfthAvenue, padding, context);
68008       reveal(box, helpHtml("intro.lines.retry_delete"), {
68009         buttonText: _t.html("intro.ok"),
68010         buttonCallback: function() {
68011           continueTo(multiSelect2);
68012         }
68013       });
68014       function continueTo(nextStep) {
68015         nextStep();
68016       }
68017     }
68018     function play() {
68019       dispatch14.call("done");
68020       reveal(
68021         ".ideditor",
68022         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
68023         {
68024           tooltipBox: ".intro-nav-wrap .chapter-building",
68025           buttonText: _t.html("intro.ok"),
68026           buttonCallback: function() {
68027             reveal(".ideditor");
68028           }
68029         }
68030       );
68031     }
68032     chapter.enter = function() {
68033       addLine();
68034     };
68035     chapter.exit = function() {
68036       timeouts.forEach(window.clearTimeout);
68037       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
68038       context.on("enter.intro exit.intro", null);
68039       context.map().on("move.intro drawn.intro", null);
68040       context.history().on("change.intro", null);
68041       context.container().select(".inspector-wrap").on("wheel.intro", null);
68042       context.container().select(".preset-list-button").on("click.intro", null);
68043     };
68044     chapter.restart = function() {
68045       chapter.exit();
68046       chapter.enter();
68047     };
68048     return utilRebind(chapter, dispatch14, "on");
68049   }
68050   var init_line2 = __esm({
68051     "modules/ui/intro/line.js"() {
68052       "use strict";
68053       init_src4();
68054       init_src5();
68055       init_presets();
68056       init_localizer();
68057       init_geo2();
68058       init_browse();
68059       init_select5();
68060       init_rebind();
68061       init_helper();
68062     }
68063   });
68064
68065   // modules/ui/intro/building.js
68066   var building_exports = {};
68067   __export(building_exports, {
68068     uiIntroBuilding: () => uiIntroBuilding
68069   });
68070   function uiIntroBuilding(context, reveal) {
68071     var dispatch14 = dispatch_default("done");
68072     var house = [-85.62815, 41.95638];
68073     var tank = [-85.62732, 41.95347];
68074     var buildingCatetory = _mainPresetIndex.item("category-building");
68075     var housePreset = _mainPresetIndex.item("building/house");
68076     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
68077     var timeouts = [];
68078     var _houseID = null;
68079     var _tankID = null;
68080     var chapter = {
68081       title: "intro.buildings.title"
68082     };
68083     function timeout2(f2, t2) {
68084       timeouts.push(window.setTimeout(f2, t2));
68085     }
68086     function eventCancel(d3_event) {
68087       d3_event.stopPropagation();
68088       d3_event.preventDefault();
68089     }
68090     function revealHouse(center, text, options) {
68091       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
68092       var box = pad2(center, padding, context);
68093       reveal(box, text, options);
68094     }
68095     function revealTank(center, text, options) {
68096       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
68097       var box = pad2(center, padding, context);
68098       reveal(box, text, options);
68099     }
68100     function addHouse() {
68101       context.enter(modeBrowse(context));
68102       context.history().reset("initial");
68103       _houseID = null;
68104       var msec = transitionTime(house, context.map().center());
68105       if (msec) {
68106         reveal(null, null, { duration: 0 });
68107       }
68108       context.map().centerZoomEase(house, 19, msec);
68109       timeout2(function() {
68110         var tooltip = reveal(
68111           "button.add-area",
68112           helpHtml("intro.buildings.add_building")
68113         );
68114         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
68115         context.on("enter.intro", function(mode) {
68116           if (mode.id !== "add-area") return;
68117           continueTo(startHouse);
68118         });
68119       }, msec + 100);
68120       function continueTo(nextStep) {
68121         context.on("enter.intro", null);
68122         nextStep();
68123       }
68124     }
68125     function startHouse() {
68126       if (context.mode().id !== "add-area") {
68127         return continueTo(addHouse);
68128       }
68129       _houseID = null;
68130       context.map().zoomEase(20, 500);
68131       timeout2(function() {
68132         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
68133         revealHouse(house, startString);
68134         context.map().on("move.intro drawn.intro", function() {
68135           revealHouse(house, startString, { duration: 0 });
68136         });
68137         context.on("enter.intro", function(mode) {
68138           if (mode.id !== "draw-area") return chapter.restart();
68139           continueTo(continueHouse);
68140         });
68141       }, 550);
68142       function continueTo(nextStep) {
68143         context.map().on("move.intro drawn.intro", null);
68144         context.on("enter.intro", null);
68145         nextStep();
68146       }
68147     }
68148     function continueHouse() {
68149       if (context.mode().id !== "draw-area") {
68150         return continueTo(addHouse);
68151       }
68152       _houseID = null;
68153       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
68154       revealHouse(house, continueString);
68155       context.map().on("move.intro drawn.intro", function() {
68156         revealHouse(house, continueString, { duration: 0 });
68157       });
68158       context.on("enter.intro", function(mode) {
68159         if (mode.id === "draw-area") {
68160           return;
68161         } else if (mode.id === "select") {
68162           var graph = context.graph();
68163           var way = context.entity(context.selectedIDs()[0]);
68164           var nodes = graph.childNodes(way);
68165           var points = utilArrayUniq(nodes).map(function(n3) {
68166             return context.projection(n3.loc);
68167           });
68168           if (isMostlySquare(points)) {
68169             _houseID = way.id;
68170             return continueTo(chooseCategoryBuilding);
68171           } else {
68172             return continueTo(retryHouse);
68173           }
68174         } else {
68175           return chapter.restart();
68176         }
68177       });
68178       function continueTo(nextStep) {
68179         context.map().on("move.intro drawn.intro", null);
68180         context.on("enter.intro", null);
68181         nextStep();
68182       }
68183     }
68184     function retryHouse() {
68185       var onClick = function() {
68186         continueTo(addHouse);
68187       };
68188       revealHouse(
68189         house,
68190         helpHtml("intro.buildings.retry_building"),
68191         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
68192       );
68193       context.map().on("move.intro drawn.intro", function() {
68194         revealHouse(
68195           house,
68196           helpHtml("intro.buildings.retry_building"),
68197           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
68198         );
68199       });
68200       function continueTo(nextStep) {
68201         context.map().on("move.intro drawn.intro", null);
68202         nextStep();
68203       }
68204     }
68205     function chooseCategoryBuilding() {
68206       if (!_houseID || !context.hasEntity(_houseID)) {
68207         return addHouse();
68208       }
68209       var ids = context.selectedIDs();
68210       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68211         context.enter(modeSelect(context, [_houseID]));
68212       }
68213       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68214       timeout2(function() {
68215         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68216         var button = context.container().select(".preset-category-building .preset-list-button");
68217         reveal(
68218           button.node(),
68219           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
68220         );
68221         button.on("click.intro", function() {
68222           button.on("click.intro", null);
68223           continueTo(choosePresetHouse);
68224         });
68225       }, 400);
68226       context.on("enter.intro", function(mode) {
68227         if (!_houseID || !context.hasEntity(_houseID)) {
68228           return continueTo(addHouse);
68229         }
68230         var ids2 = context.selectedIDs();
68231         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
68232           return continueTo(chooseCategoryBuilding);
68233         }
68234       });
68235       function continueTo(nextStep) {
68236         context.container().select(".inspector-wrap").on("wheel.intro", null);
68237         context.container().select(".preset-list-button").on("click.intro", null);
68238         context.on("enter.intro", null);
68239         nextStep();
68240       }
68241     }
68242     function choosePresetHouse() {
68243       if (!_houseID || !context.hasEntity(_houseID)) {
68244         return addHouse();
68245       }
68246       var ids = context.selectedIDs();
68247       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68248         context.enter(modeSelect(context, [_houseID]));
68249       }
68250       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68251       timeout2(function() {
68252         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68253         var button = context.container().select(".preset-building-house .preset-list-button");
68254         reveal(
68255           button.node(),
68256           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
68257           { duration: 300 }
68258         );
68259         button.on("click.intro", function() {
68260           button.on("click.intro", null);
68261           continueTo(closeEditorHouse);
68262         });
68263       }, 400);
68264       context.on("enter.intro", function(mode) {
68265         if (!_houseID || !context.hasEntity(_houseID)) {
68266           return continueTo(addHouse);
68267         }
68268         var ids2 = context.selectedIDs();
68269         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
68270           return continueTo(chooseCategoryBuilding);
68271         }
68272       });
68273       function continueTo(nextStep) {
68274         context.container().select(".inspector-wrap").on("wheel.intro", null);
68275         context.container().select(".preset-list-button").on("click.intro", null);
68276         context.on("enter.intro", null);
68277         nextStep();
68278       }
68279     }
68280     function closeEditorHouse() {
68281       if (!_houseID || !context.hasEntity(_houseID)) {
68282         return addHouse();
68283       }
68284       var ids = context.selectedIDs();
68285       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68286         context.enter(modeSelect(context, [_houseID]));
68287       }
68288       context.history().checkpoint("hasHouse");
68289       context.on("exit.intro", function() {
68290         continueTo(rightClickHouse);
68291       });
68292       timeout2(function() {
68293         reveal(
68294           ".entity-editor-pane",
68295           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
68296         );
68297       }, 500);
68298       function continueTo(nextStep) {
68299         context.on("exit.intro", null);
68300         nextStep();
68301       }
68302     }
68303     function rightClickHouse() {
68304       if (!_houseID) return chapter.restart();
68305       context.enter(modeBrowse(context));
68306       context.history().reset("hasHouse");
68307       var zoom = context.map().zoom();
68308       if (zoom < 20) {
68309         zoom = 20;
68310       }
68311       context.map().centerZoomEase(house, zoom, 500);
68312       context.on("enter.intro", function(mode) {
68313         if (mode.id !== "select") return;
68314         var ids = context.selectedIDs();
68315         if (ids.length !== 1 || ids[0] !== _houseID) return;
68316         timeout2(function() {
68317           var node = selectMenuItem(context, "orthogonalize").node();
68318           if (!node) return;
68319           continueTo(clickSquare);
68320         }, 50);
68321       });
68322       context.map().on("move.intro drawn.intro", function() {
68323         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
68324         revealHouse(house, rightclickString, { duration: 0 });
68325       });
68326       context.history().on("change.intro", function() {
68327         continueTo(rightClickHouse);
68328       });
68329       function continueTo(nextStep) {
68330         context.on("enter.intro", null);
68331         context.map().on("move.intro drawn.intro", null);
68332         context.history().on("change.intro", null);
68333         nextStep();
68334       }
68335     }
68336     function clickSquare() {
68337       if (!_houseID) return chapter.restart();
68338       var entity = context.hasEntity(_houseID);
68339       if (!entity) return continueTo(rightClickHouse);
68340       var node = selectMenuItem(context, "orthogonalize").node();
68341       if (!node) {
68342         return continueTo(rightClickHouse);
68343       }
68344       var wasChanged = false;
68345       reveal(
68346         ".edit-menu",
68347         helpHtml("intro.buildings.square_building"),
68348         { padding: 50 }
68349       );
68350       context.on("enter.intro", function(mode) {
68351         if (mode.id === "browse") {
68352           continueTo(rightClickHouse);
68353         } else if (mode.id === "move" || mode.id === "rotate") {
68354           continueTo(retryClickSquare);
68355         }
68356       });
68357       context.map().on("move.intro", function() {
68358         var node2 = selectMenuItem(context, "orthogonalize").node();
68359         if (!wasChanged && !node2) {
68360           return continueTo(rightClickHouse);
68361         }
68362         reveal(
68363           ".edit-menu",
68364           helpHtml("intro.buildings.square_building"),
68365           { duration: 0, padding: 50 }
68366         );
68367       });
68368       context.history().on("change.intro", function() {
68369         wasChanged = true;
68370         context.history().on("change.intro", null);
68371         timeout2(function() {
68372           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
68373             continueTo(doneSquare);
68374           } else {
68375             continueTo(retryClickSquare);
68376           }
68377         }, 500);
68378       });
68379       function continueTo(nextStep) {
68380         context.on("enter.intro", null);
68381         context.map().on("move.intro", null);
68382         context.history().on("change.intro", null);
68383         nextStep();
68384       }
68385     }
68386     function retryClickSquare() {
68387       context.enter(modeBrowse(context));
68388       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
68389         buttonText: _t.html("intro.ok"),
68390         buttonCallback: function() {
68391           continueTo(rightClickHouse);
68392         }
68393       });
68394       function continueTo(nextStep) {
68395         nextStep();
68396       }
68397     }
68398     function doneSquare() {
68399       context.history().checkpoint("doneSquare");
68400       revealHouse(house, helpHtml("intro.buildings.done_square"), {
68401         buttonText: _t.html("intro.ok"),
68402         buttonCallback: function() {
68403           continueTo(addTank);
68404         }
68405       });
68406       function continueTo(nextStep) {
68407         nextStep();
68408       }
68409     }
68410     function addTank() {
68411       context.enter(modeBrowse(context));
68412       context.history().reset("doneSquare");
68413       _tankID = null;
68414       var msec = transitionTime(tank, context.map().center());
68415       if (msec) {
68416         reveal(null, null, { duration: 0 });
68417       }
68418       context.map().centerZoomEase(tank, 19.5, msec);
68419       timeout2(function() {
68420         reveal(
68421           "button.add-area",
68422           helpHtml("intro.buildings.add_tank")
68423         );
68424         context.on("enter.intro", function(mode) {
68425           if (mode.id !== "add-area") return;
68426           continueTo(startTank);
68427         });
68428       }, msec + 100);
68429       function continueTo(nextStep) {
68430         context.on("enter.intro", null);
68431         nextStep();
68432       }
68433     }
68434     function startTank() {
68435       if (context.mode().id !== "add-area") {
68436         return continueTo(addTank);
68437       }
68438       _tankID = null;
68439       timeout2(function() {
68440         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
68441         revealTank(tank, startString);
68442         context.map().on("move.intro drawn.intro", function() {
68443           revealTank(tank, startString, { duration: 0 });
68444         });
68445         context.on("enter.intro", function(mode) {
68446           if (mode.id !== "draw-area") return chapter.restart();
68447           continueTo(continueTank);
68448         });
68449       }, 550);
68450       function continueTo(nextStep) {
68451         context.map().on("move.intro drawn.intro", null);
68452         context.on("enter.intro", null);
68453         nextStep();
68454       }
68455     }
68456     function continueTank() {
68457       if (context.mode().id !== "draw-area") {
68458         return continueTo(addTank);
68459       }
68460       _tankID = null;
68461       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
68462       revealTank(tank, continueString);
68463       context.map().on("move.intro drawn.intro", function() {
68464         revealTank(tank, continueString, { duration: 0 });
68465       });
68466       context.on("enter.intro", function(mode) {
68467         if (mode.id === "draw-area") {
68468           return;
68469         } else if (mode.id === "select") {
68470           _tankID = context.selectedIDs()[0];
68471           return continueTo(searchPresetTank);
68472         } else {
68473           return continueTo(addTank);
68474         }
68475       });
68476       function continueTo(nextStep) {
68477         context.map().on("move.intro drawn.intro", null);
68478         context.on("enter.intro", null);
68479         nextStep();
68480       }
68481     }
68482     function searchPresetTank() {
68483       if (!_tankID || !context.hasEntity(_tankID)) {
68484         return addTank();
68485       }
68486       var ids = context.selectedIDs();
68487       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
68488         context.enter(modeSelect(context, [_tankID]));
68489       }
68490       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68491       timeout2(function() {
68492         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68493         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
68494         reveal(
68495           ".preset-search-input",
68496           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
68497         );
68498       }, 400);
68499       context.on("enter.intro", function(mode) {
68500         if (!_tankID || !context.hasEntity(_tankID)) {
68501           return continueTo(addTank);
68502         }
68503         var ids2 = context.selectedIDs();
68504         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
68505           context.enter(modeSelect(context, [_tankID]));
68506           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68507           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68508           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
68509           reveal(
68510             ".preset-search-input",
68511             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
68512           );
68513           context.history().on("change.intro", null);
68514         }
68515       });
68516       function checkPresetSearch() {
68517         var first = context.container().select(".preset-list-item:first-child");
68518         if (first.classed("preset-man_made-storage_tank")) {
68519           reveal(
68520             first.select(".preset-list-button").node(),
68521             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
68522             { duration: 300 }
68523           );
68524           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
68525           context.history().on("change.intro", function() {
68526             continueTo(closeEditorTank);
68527           });
68528         }
68529       }
68530       function continueTo(nextStep) {
68531         context.container().select(".inspector-wrap").on("wheel.intro", null);
68532         context.on("enter.intro", null);
68533         context.history().on("change.intro", null);
68534         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
68535         nextStep();
68536       }
68537     }
68538     function closeEditorTank() {
68539       if (!_tankID || !context.hasEntity(_tankID)) {
68540         return addTank();
68541       }
68542       var ids = context.selectedIDs();
68543       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
68544         context.enter(modeSelect(context, [_tankID]));
68545       }
68546       context.history().checkpoint("hasTank");
68547       context.on("exit.intro", function() {
68548         continueTo(rightClickTank);
68549       });
68550       timeout2(function() {
68551         reveal(
68552           ".entity-editor-pane",
68553           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
68554         );
68555       }, 500);
68556       function continueTo(nextStep) {
68557         context.on("exit.intro", null);
68558         nextStep();
68559       }
68560     }
68561     function rightClickTank() {
68562       if (!_tankID) return continueTo(addTank);
68563       context.enter(modeBrowse(context));
68564       context.history().reset("hasTank");
68565       context.map().centerEase(tank, 500);
68566       timeout2(function() {
68567         context.on("enter.intro", function(mode) {
68568           if (mode.id !== "select") return;
68569           var ids = context.selectedIDs();
68570           if (ids.length !== 1 || ids[0] !== _tankID) return;
68571           timeout2(function() {
68572             var node = selectMenuItem(context, "circularize").node();
68573             if (!node) return;
68574             continueTo(clickCircle);
68575           }, 50);
68576         });
68577         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
68578         revealTank(tank, rightclickString);
68579         context.map().on("move.intro drawn.intro", function() {
68580           revealTank(tank, rightclickString, { duration: 0 });
68581         });
68582         context.history().on("change.intro", function() {
68583           continueTo(rightClickTank);
68584         });
68585       }, 600);
68586       function continueTo(nextStep) {
68587         context.on("enter.intro", null);
68588         context.map().on("move.intro drawn.intro", null);
68589         context.history().on("change.intro", null);
68590         nextStep();
68591       }
68592     }
68593     function clickCircle() {
68594       if (!_tankID) return chapter.restart();
68595       var entity = context.hasEntity(_tankID);
68596       if (!entity) return continueTo(rightClickTank);
68597       var node = selectMenuItem(context, "circularize").node();
68598       if (!node) {
68599         return continueTo(rightClickTank);
68600       }
68601       var wasChanged = false;
68602       reveal(
68603         ".edit-menu",
68604         helpHtml("intro.buildings.circle_tank"),
68605         { padding: 50 }
68606       );
68607       context.on("enter.intro", function(mode) {
68608         if (mode.id === "browse") {
68609           continueTo(rightClickTank);
68610         } else if (mode.id === "move" || mode.id === "rotate") {
68611           continueTo(retryClickCircle);
68612         }
68613       });
68614       context.map().on("move.intro", function() {
68615         var node2 = selectMenuItem(context, "circularize").node();
68616         if (!wasChanged && !node2) {
68617           return continueTo(rightClickTank);
68618         }
68619         reveal(
68620           ".edit-menu",
68621           helpHtml("intro.buildings.circle_tank"),
68622           { duration: 0, padding: 50 }
68623         );
68624       });
68625       context.history().on("change.intro", function() {
68626         wasChanged = true;
68627         context.history().on("change.intro", null);
68628         timeout2(function() {
68629           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
68630             continueTo(play);
68631           } else {
68632             continueTo(retryClickCircle);
68633           }
68634         }, 500);
68635       });
68636       function continueTo(nextStep) {
68637         context.on("enter.intro", null);
68638         context.map().on("move.intro", null);
68639         context.history().on("change.intro", null);
68640         nextStep();
68641       }
68642     }
68643     function retryClickCircle() {
68644       context.enter(modeBrowse(context));
68645       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
68646         buttonText: _t.html("intro.ok"),
68647         buttonCallback: function() {
68648           continueTo(rightClickTank);
68649         }
68650       });
68651       function continueTo(nextStep) {
68652         nextStep();
68653       }
68654     }
68655     function play() {
68656       dispatch14.call("done");
68657       reveal(
68658         ".ideditor",
68659         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
68660         {
68661           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
68662           buttonText: _t.html("intro.ok"),
68663           buttonCallback: function() {
68664             reveal(".ideditor");
68665           }
68666         }
68667       );
68668     }
68669     chapter.enter = function() {
68670       addHouse();
68671     };
68672     chapter.exit = function() {
68673       timeouts.forEach(window.clearTimeout);
68674       context.on("enter.intro exit.intro", null);
68675       context.map().on("move.intro drawn.intro", null);
68676       context.history().on("change.intro", null);
68677       context.container().select(".inspector-wrap").on("wheel.intro", null);
68678       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
68679       context.container().select(".more-fields .combobox-input").on("click.intro", null);
68680     };
68681     chapter.restart = function() {
68682       chapter.exit();
68683       chapter.enter();
68684     };
68685     return utilRebind(chapter, dispatch14, "on");
68686   }
68687   var init_building = __esm({
68688     "modules/ui/intro/building.js"() {
68689       "use strict";
68690       init_src4();
68691       init_presets();
68692       init_localizer();
68693       init_browse();
68694       init_select5();
68695       init_util();
68696       init_helper();
68697     }
68698   });
68699
68700   // modules/ui/intro/start_editing.js
68701   var start_editing_exports = {};
68702   __export(start_editing_exports, {
68703     uiIntroStartEditing: () => uiIntroStartEditing
68704   });
68705   function uiIntroStartEditing(context, reveal) {
68706     var dispatch14 = dispatch_default("done", "startEditing");
68707     var modalSelection = select_default2(null);
68708     var chapter = {
68709       title: "intro.startediting.title"
68710     };
68711     function showHelp() {
68712       reveal(
68713         ".map-control.help-control",
68714         helpHtml("intro.startediting.help"),
68715         {
68716           buttonText: _t.html("intro.ok"),
68717           buttonCallback: function() {
68718             shortcuts();
68719           }
68720         }
68721       );
68722     }
68723     function shortcuts() {
68724       reveal(
68725         ".map-control.help-control",
68726         helpHtml("intro.startediting.shortcuts"),
68727         {
68728           buttonText: _t.html("intro.ok"),
68729           buttonCallback: function() {
68730             showSave();
68731           }
68732         }
68733       );
68734     }
68735     function showSave() {
68736       context.container().selectAll(".shaded").remove();
68737       reveal(
68738         ".top-toolbar button.save",
68739         helpHtml("intro.startediting.save"),
68740         {
68741           buttonText: _t.html("intro.ok"),
68742           buttonCallback: function() {
68743             showStart();
68744           }
68745         }
68746       );
68747     }
68748     function showStart() {
68749       context.container().selectAll(".shaded").remove();
68750       modalSelection = uiModal(context.container());
68751       modalSelection.select(".modal").attr("class", "modal-splash modal");
68752       modalSelection.selectAll(".close").remove();
68753       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
68754         modalSelection.remove();
68755       });
68756       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68757       startbutton.append("h2").call(_t.append("intro.startediting.start"));
68758       dispatch14.call("startEditing");
68759     }
68760     chapter.enter = function() {
68761       showHelp();
68762     };
68763     chapter.exit = function() {
68764       modalSelection.remove();
68765       context.container().selectAll(".shaded").remove();
68766     };
68767     return utilRebind(chapter, dispatch14, "on");
68768   }
68769   var init_start_editing = __esm({
68770     "modules/ui/intro/start_editing.js"() {
68771       "use strict";
68772       init_src4();
68773       init_src5();
68774       init_localizer();
68775       init_helper();
68776       init_modal();
68777       init_rebind();
68778     }
68779   });
68780
68781   // modules/ui/intro/intro.js
68782   var intro_exports = {};
68783   __export(intro_exports, {
68784     uiIntro: () => uiIntro
68785   });
68786   function uiIntro(context) {
68787     const INTRO_IMAGERY = "Bing";
68788     let _introGraph = {};
68789     let _currChapter;
68790     function intro(selection2) {
68791       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
68792         for (let id2 in dataIntroGraph) {
68793           if (!_introGraph[id2]) {
68794             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
68795           }
68796         }
68797         selection2.call(startIntro);
68798       }).catch(function() {
68799       });
68800     }
68801     function startIntro(selection2) {
68802       context.enter(modeBrowse(context));
68803       let osm = context.connection();
68804       let history = context.history().toJSON();
68805       let hash2 = window.location.hash;
68806       let center = context.map().center();
68807       let zoom = context.map().zoom();
68808       let background = context.background().baseLayerSource();
68809       let overlays = context.background().overlayLayerSources();
68810       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
68811       let caches = osm && osm.caches();
68812       let baseEntities = context.history().graph().base().entities;
68813       context.ui().sidebar.expand();
68814       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
68815       context.inIntro(true);
68816       if (osm) {
68817         osm.toggle(false).reset();
68818       }
68819       context.history().reset();
68820       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
68821       context.history().checkpoint("initial");
68822       let imagery = context.background().findSource(INTRO_IMAGERY);
68823       if (imagery) {
68824         context.background().baseLayerSource(imagery);
68825       } else {
68826         context.background().bing();
68827       }
68828       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
68829       let layers = context.layers();
68830       layers.all().forEach((item) => {
68831         if (typeof item.layer.enabled === "function") {
68832           item.layer.enabled(item.id === "osm");
68833         }
68834       });
68835       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
68836       let curtain = uiCurtain(context.container().node());
68837       selection2.call(curtain);
68838       corePreferences("walkthrough_started", "yes");
68839       let storedProgress = corePreferences("walkthrough_progress") || "";
68840       let progress = storedProgress.split(";").filter(Boolean);
68841       let chapters = chapterFlow.map((chapter, i3) => {
68842         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
68843           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
68844           if (i3 < chapterFlow.length - 1) {
68845             const next = chapterFlow[i3 + 1];
68846             context.container().select(`button.chapter-${next}`).classed("next", true);
68847           }
68848           progress.push(chapter);
68849           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
68850         });
68851         return s2;
68852       });
68853       chapters[chapters.length - 1].on("startEditing", () => {
68854         progress.push("startEditing");
68855         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
68856         let incomplete = utilArrayDifference(chapterFlow, progress);
68857         if (!incomplete.length) {
68858           corePreferences("walkthrough_completed", "yes");
68859         }
68860         curtain.remove();
68861         navwrap.remove();
68862         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
68863         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
68864         if (osm) {
68865           osm.toggle(true).reset().caches(caches);
68866         }
68867         context.history().reset().merge(Object.values(baseEntities));
68868         context.background().baseLayerSource(background);
68869         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
68870         if (history) {
68871           context.history().fromJSON(history, false);
68872         }
68873         context.map().centerZoom(center, zoom);
68874         window.history.replaceState(null, "", hash2);
68875         context.inIntro(false);
68876       });
68877       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
68878       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68879       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
68880       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => `chapter chapter-${chapterFlow[i3]}`).on("click", enterChapter);
68881       buttons.append("span").html((d2) => _t.html(d2.title));
68882       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
68883       enterChapter(null, chapters[0]);
68884       function enterChapter(d3_event, newChapter) {
68885         if (_currChapter) {
68886           _currChapter.exit();
68887         }
68888         context.enter(modeBrowse(context));
68889         _currChapter = newChapter;
68890         _currChapter.enter();
68891         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
68892       }
68893     }
68894     return intro;
68895   }
68896   var chapterUi, chapterFlow;
68897   var init_intro = __esm({
68898     "modules/ui/intro/intro.js"() {
68899       "use strict";
68900       init_localizer();
68901       init_helper();
68902       init_preferences();
68903       init_file_fetcher();
68904       init_graph();
68905       init_browse();
68906       init_entity();
68907       init_icon();
68908       init_curtain();
68909       init_util();
68910       init_welcome();
68911       init_navigation();
68912       init_point();
68913       init_area4();
68914       init_line2();
68915       init_building();
68916       init_start_editing();
68917       chapterUi = {
68918         welcome: uiIntroWelcome,
68919         navigation: uiIntroNavigation,
68920         point: uiIntroPoint,
68921         area: uiIntroArea,
68922         line: uiIntroLine,
68923         building: uiIntroBuilding,
68924         startEditing: uiIntroStartEditing
68925       };
68926       chapterFlow = [
68927         "welcome",
68928         "navigation",
68929         "point",
68930         "area",
68931         "line",
68932         "building",
68933         "startEditing"
68934       ];
68935     }
68936   });
68937
68938   // modules/ui/intro/index.js
68939   var intro_exports2 = {};
68940   __export(intro_exports2, {
68941     uiIntro: () => uiIntro
68942   });
68943   var init_intro2 = __esm({
68944     "modules/ui/intro/index.js"() {
68945       "use strict";
68946       init_intro();
68947     }
68948   });
68949
68950   // modules/ui/issues_info.js
68951   var issues_info_exports = {};
68952   __export(issues_info_exports, {
68953     uiIssuesInfo: () => uiIssuesInfo
68954   });
68955   function uiIssuesInfo(context) {
68956     var warningsItem = {
68957       id: "warnings",
68958       count: 0,
68959       iconID: "iD-icon-alert",
68960       descriptionID: "issues.warnings_and_errors"
68961     };
68962     var resolvedItem = {
68963       id: "resolved",
68964       count: 0,
68965       iconID: "iD-icon-apply",
68966       descriptionID: "issues.user_resolved_issues"
68967     };
68968     function update(selection2) {
68969       var shownItems = [];
68970       var liveIssues = context.validator().getIssues({
68971         what: corePreferences("validate-what") || "edited",
68972         where: corePreferences("validate-where") || "all"
68973       });
68974       if (liveIssues.length) {
68975         warningsItem.count = liveIssues.length;
68976         shownItems.push(warningsItem);
68977       }
68978       if (corePreferences("validate-what") === "all") {
68979         var resolvedIssues = context.validator().getResolvedIssues();
68980         if (resolvedIssues.length) {
68981           resolvedItem.count = resolvedIssues.length;
68982           shownItems.push(resolvedItem);
68983         }
68984       }
68985       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
68986         return d2.id;
68987       });
68988       chips.exit().remove();
68989       var enter = chips.enter().append("a").attr("class", function(d2) {
68990         return "chip " + d2.id + "-count";
68991       }).attr("href", "#").each(function(d2) {
68992         var chipSelection = select_default2(this);
68993         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
68994         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
68995           d3_event.preventDefault();
68996           tooltipBehavior.hide(select_default2(this));
68997           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
68998         });
68999         chipSelection.call(svgIcon("#" + d2.iconID));
69000       });
69001       enter.append("span").attr("class", "count");
69002       enter.merge(chips).selectAll("span.count").text(function(d2) {
69003         return d2.count.toString();
69004       });
69005     }
69006     return function(selection2) {
69007       update(selection2);
69008       context.validator().on("validated.infobox", function() {
69009         update(selection2);
69010       });
69011     };
69012   }
69013   var init_issues_info = __esm({
69014     "modules/ui/issues_info.js"() {
69015       "use strict";
69016       init_src5();
69017       init_preferences();
69018       init_icon();
69019       init_localizer();
69020       init_tooltip();
69021     }
69022   });
69023
69024   // modules/util/IntervalTasksQueue.js
69025   var IntervalTasksQueue_exports = {};
69026   __export(IntervalTasksQueue_exports, {
69027     IntervalTasksQueue: () => IntervalTasksQueue
69028   });
69029   var IntervalTasksQueue;
69030   var init_IntervalTasksQueue = __esm({
69031     "modules/util/IntervalTasksQueue.js"() {
69032       "use strict";
69033       IntervalTasksQueue = class {
69034         /**
69035          * Interval in milliseconds inside which only 1 task can execute.
69036          * e.g. if interval is 200ms, and 5 async tasks are unqueued,
69037          * they will complete in ~1s if not cleared
69038          * @param {number} intervalInMs
69039          */
69040         constructor(intervalInMs) {
69041           this.intervalInMs = intervalInMs;
69042           this.pendingHandles = [];
69043           this.time = 0;
69044         }
69045         enqueue(task) {
69046           let taskTimeout = this.time;
69047           this.time += this.intervalInMs;
69048           this.pendingHandles.push(setTimeout(() => {
69049             this.time -= this.intervalInMs;
69050             task();
69051           }, taskTimeout));
69052         }
69053         clear() {
69054           this.pendingHandles.forEach((timeoutHandle) => {
69055             clearTimeout(timeoutHandle);
69056           });
69057           this.pendingHandles = [];
69058           this.time = 0;
69059         }
69060       };
69061     }
69062   });
69063
69064   // modules/renderer/background_source.js
69065   var background_source_exports = {};
69066   __export(background_source_exports, {
69067     rendererBackgroundSource: () => rendererBackgroundSource
69068   });
69069   function localeDateString(s2) {
69070     if (!s2) return null;
69071     var options = { day: "numeric", month: "short", year: "numeric" };
69072     var d2 = new Date(s2);
69073     if (isNaN(d2.getTime())) return null;
69074     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options);
69075   }
69076   function vintageRange(vintage) {
69077     var s2;
69078     if (vintage.start || vintage.end) {
69079       s2 = vintage.start || "?";
69080       if (vintage.start !== vintage.end) {
69081         s2 += " - " + (vintage.end || "?");
69082       }
69083     }
69084     return s2;
69085   }
69086   function rendererBackgroundSource(data) {
69087     var source = Object.assign({}, data);
69088     var _offset = [0, 0];
69089     var _name = source.name;
69090     var _description = source.description;
69091     var _best = !!source.best;
69092     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
69093     source.tileSize = data.tileSize || 256;
69094     source.zoomExtent = data.zoomExtent || [0, 22];
69095     source.overzoom = data.overzoom !== false;
69096     source.offset = function(val) {
69097       if (!arguments.length) return _offset;
69098       _offset = val;
69099       return source;
69100     };
69101     source.nudge = function(val, zoomlevel) {
69102       _offset[0] += val[0] / Math.pow(2, zoomlevel);
69103       _offset[1] += val[1] / Math.pow(2, zoomlevel);
69104       return source;
69105     };
69106     source.name = function() {
69107       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69108       return _t("imagery." + id_safe + ".name", { default: escape_default(_name) });
69109     };
69110     source.label = function() {
69111       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69112       return _t.append("imagery." + id_safe + ".name", { default: escape_default(_name) });
69113     };
69114     source.hasDescription = function() {
69115       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69116       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: escape_default(_description) }).text;
69117       return descriptionText !== "";
69118     };
69119     source.description = function() {
69120       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69121       return _t.append("imagery." + id_safe + ".description", { default: escape_default(_description) });
69122     };
69123     source.best = function() {
69124       return _best;
69125     };
69126     source.area = function() {
69127       if (!data.polygon) return Number.MAX_VALUE;
69128       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
69129       return isNaN(area) ? 0 : area;
69130     };
69131     source.imageryUsed = function() {
69132       return _name || source.id;
69133     };
69134     source.template = function(val) {
69135       if (!arguments.length) return _template;
69136       if (source.id === "custom" || source.id === "Bing") {
69137         _template = val;
69138       }
69139       return source;
69140     };
69141     source.url = function(coord2) {
69142       var result = _template.replace(/#[\s\S]*/u, "");
69143       if (result === "") return result;
69144       if (!source.type || source.id === "custom") {
69145         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
69146           source.type = "wms";
69147           source.projection = "EPSG:3857";
69148         } else if (/\{(x|y)\}/.test(result)) {
69149           source.type = "tms";
69150         } else if (/\{u\}/.test(result)) {
69151           source.type = "bing";
69152         }
69153       }
69154       if (source.type === "wms") {
69155         var tileToProjectedCoords = function(x2, y2, z3) {
69156           var zoomSize = Math.pow(2, z3);
69157           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
69158           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
69159           switch (source.projection) {
69160             case "EPSG:4326":
69161               return {
69162                 x: lon * 180 / Math.PI,
69163                 y: lat * 180 / Math.PI
69164               };
69165             default:
69166               var mercCoords = mercatorRaw(lon, lat);
69167               return {
69168                 x: 2003750834e-2 / Math.PI * mercCoords[0],
69169                 y: 2003750834e-2 / Math.PI * mercCoords[1]
69170               };
69171           }
69172         };
69173         var tileSize = source.tileSize;
69174         var projection2 = source.projection;
69175         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
69176         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
69177         result = result.replace(/\{(\w+)\}/g, function(token, key) {
69178           switch (key) {
69179             case "width":
69180             case "height":
69181               return tileSize;
69182             case "proj":
69183               return projection2;
69184             case "wkid":
69185               return projection2.replace(/^EPSG:/, "");
69186             case "bbox":
69187               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
69188               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
69189                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
69190               } else {
69191                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
69192               }
69193             case "w":
69194               return minXmaxY.x;
69195             case "s":
69196               return maxXminY.y;
69197             case "n":
69198               return maxXminY.x;
69199             case "e":
69200               return minXmaxY.y;
69201             default:
69202               return token;
69203           }
69204         });
69205       } else if (source.type === "tms") {
69206         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" : "");
69207       } else if (source.type === "bing") {
69208         result = result.replace("{u}", function() {
69209           var u2 = "";
69210           for (var zoom = coord2[2]; zoom > 0; zoom--) {
69211             var b3 = 0;
69212             var mask = 1 << zoom - 1;
69213             if ((coord2[0] & mask) !== 0) b3++;
69214             if ((coord2[1] & mask) !== 0) b3 += 2;
69215             u2 += b3.toString();
69216           }
69217           return u2;
69218         });
69219       }
69220       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
69221         var subdomains = r2.split(",");
69222         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
69223       });
69224       return result;
69225     };
69226     source.validZoom = function(z3, underzoom) {
69227       if (underzoom === void 0) underzoom = 0;
69228       return source.zoomExtent[0] - underzoom <= z3 && (source.overzoom || source.zoomExtent[1] > z3);
69229     };
69230     source.isLocatorOverlay = function() {
69231       return source.id === "mapbox_locator_overlay";
69232     };
69233     source.isHidden = function() {
69234       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
69235     };
69236     source.copyrightNotices = function() {
69237     };
69238     source.getMetadata = function(center, tileCoord, callback) {
69239       var vintage = {
69240         start: localeDateString(source.startDate),
69241         end: localeDateString(source.endDate)
69242       };
69243       vintage.range = vintageRange(vintage);
69244       var metadata = { vintage };
69245       callback(null, metadata);
69246     };
69247     return source;
69248   }
69249   var isRetina, _a3;
69250   var init_background_source = __esm({
69251     "modules/renderer/background_source.js"() {
69252       "use strict";
69253       init_src2();
69254       init_src18();
69255       init_lodash();
69256       init_localizer();
69257       init_geo2();
69258       init_util();
69259       init_aes();
69260       init_IntervalTasksQueue();
69261       isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
69262       (_a3 = window.matchMedia) == null ? void 0 : _a3.call(window, `
69263         (-webkit-min-device-pixel-ratio: 2), /* Safari */
69264         (min-resolution: 2dppx),             /* standard */
69265         (min-resolution: 192dpi)             /* fallback */
69266     `).addListener(function() {
69267         isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
69268       });
69269       rendererBackgroundSource.Bing = function(data, dispatch14) {
69270         data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
69271         var bing = rendererBackgroundSource(data);
69272         var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
69273         const strictParam = "n";
69274         var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
69275         var cache = {};
69276         var inflight = {};
69277         var providers = [];
69278         var taskQueue = new IntervalTasksQueue(250);
69279         var metadataLastZoom = -1;
69280         json_default(url).then(function(json) {
69281           let imageryResource = json.resourceSets[0].resources[0];
69282           let template = imageryResource.imageUrl;
69283           let subDomains = imageryResource.imageUrlSubdomains;
69284           let subDomainNumbers = subDomains.map((subDomain) => {
69285             return subDomain.substring(1);
69286           }).join(",");
69287           template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
69288           if (!new URLSearchParams(template).has(strictParam)) {
69289             template += `&${strictParam}=z`;
69290           }
69291           bing.template(template);
69292           providers = imageryResource.imageryProviders.map(function(provider) {
69293             return {
69294               attribution: provider.attribution,
69295               areas: provider.coverageAreas.map(function(area) {
69296                 return {
69297                   zoom: [area.zoomMin, area.zoomMax],
69298                   extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
69299                 };
69300               })
69301             };
69302           });
69303           dispatch14.call("change");
69304         }).catch(function() {
69305         });
69306         bing.copyrightNotices = function(zoom, extent) {
69307           zoom = Math.min(zoom, 21);
69308           return providers.filter(function(provider) {
69309             return provider.areas.some(function(area) {
69310               return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
69311             });
69312           }).map(function(provider) {
69313             return provider.attribution;
69314           }).join(", ");
69315         };
69316         bing.getMetadata = function(center, tileCoord, callback) {
69317           var tileID = tileCoord.slice(0, 3).join("/");
69318           var zoom = Math.min(tileCoord[2], 21);
69319           var centerPoint = center[1] + "," + center[0];
69320           var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
69321           if (inflight[tileID]) return;
69322           if (!cache[tileID]) {
69323             cache[tileID] = {};
69324           }
69325           if (cache[tileID] && cache[tileID].metadata) {
69326             return callback(null, cache[tileID].metadata);
69327           }
69328           inflight[tileID] = true;
69329           if (metadataLastZoom !== tileCoord[2]) {
69330             metadataLastZoom = tileCoord[2];
69331             taskQueue.clear();
69332           }
69333           taskQueue.enqueue(() => {
69334             json_default(url2).then(function(result) {
69335               delete inflight[tileID];
69336               if (!result) {
69337                 throw new Error("Unknown Error");
69338               }
69339               var vintage = {
69340                 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
69341                 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
69342               };
69343               vintage.range = vintageRange(vintage);
69344               var metadata = { vintage };
69345               cache[tileID].metadata = metadata;
69346               if (callback) callback(null, metadata);
69347             }).catch(function(err) {
69348               delete inflight[tileID];
69349               if (callback) callback(err.message);
69350             });
69351           });
69352         };
69353         bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
69354         return bing;
69355       };
69356       rendererBackgroundSource.Esri = function(data) {
69357         if (data.template.match(/blankTile/) === null) {
69358           data.template = data.template + "?blankTile=false";
69359         }
69360         var esri = rendererBackgroundSource(data);
69361         var cache = {};
69362         var inflight = {};
69363         var _prevCenter;
69364         esri.fetchTilemap = function(center) {
69365           if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3) return;
69366           _prevCenter = center;
69367           var z3 = 20;
69368           var dummyUrl = esri.url([1, 2, 3]);
69369           var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z3));
69370           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, z3));
69371           var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z3 + "/" + y2 + "/" + x2 + "/8/8";
69372           json_default(tilemapUrl).then(function(tilemap) {
69373             if (!tilemap) {
69374               throw new Error("Unknown Error");
69375             }
69376             var hasTiles = true;
69377             for (var i3 = 0; i3 < tilemap.data.length; i3++) {
69378               if (!tilemap.data[i3]) {
69379                 hasTiles = false;
69380                 break;
69381               }
69382             }
69383             esri.zoomExtent[1] = hasTiles ? 22 : 19;
69384           }).catch(function() {
69385           });
69386         };
69387         esri.getMetadata = function(center, tileCoord, callback) {
69388           if (esri.id !== "EsriWorldImagery") {
69389             return callback(null, {});
69390           }
69391           var tileID = tileCoord.slice(0, 3).join("/");
69392           var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
69393           var centerPoint = center[0] + "," + center[1];
69394           var unknown = _t("info_panels.background.unknown");
69395           var vintage = {};
69396           var metadata = {};
69397           if (inflight[tileID]) return;
69398           var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
69399           url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
69400           if (!cache[tileID]) {
69401             cache[tileID] = {};
69402           }
69403           if (cache[tileID] && cache[tileID].metadata) {
69404             return callback(null, cache[tileID].metadata);
69405           }
69406           inflight[tileID] = true;
69407           json_default(url).then(function(result) {
69408             delete inflight[tileID];
69409             result = result.features.map((f2) => f2.attributes).filter((a4) => a4.MinMapLevel <= zoom && a4.MaxMapLevel >= zoom)[0];
69410             if (!result) {
69411               throw new Error("Unknown Error");
69412             } else if (result.features && result.features.length < 1) {
69413               throw new Error("No Results");
69414             } else if (result.error && result.error.message) {
69415               throw new Error(result.error.message);
69416             }
69417             var captureDate = localeDateString(result.SRC_DATE2);
69418             vintage = {
69419               start: captureDate,
69420               end: captureDate,
69421               range: captureDate
69422             };
69423             metadata = {
69424               vintage,
69425               source: clean2(result.NICE_NAME),
69426               description: clean2(result.NICE_DESC),
69427               resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
69428               accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
69429             };
69430             if (isFinite(metadata.resolution)) {
69431               metadata.resolution += " m";
69432             }
69433             if (isFinite(metadata.accuracy)) {
69434               metadata.accuracy += " m";
69435             }
69436             cache[tileID].metadata = metadata;
69437             if (callback) callback(null, metadata);
69438           }).catch(function(err) {
69439             delete inflight[tileID];
69440             if (callback) callback(err.message);
69441           });
69442           function clean2(val) {
69443             return String(val).trim() || unknown;
69444           }
69445         };
69446         return esri;
69447       };
69448       rendererBackgroundSource.None = function() {
69449         var source = rendererBackgroundSource({ id: "none", template: "" });
69450         source.name = function() {
69451           return _t("background.none");
69452         };
69453         source.label = function() {
69454           return _t.append("background.none");
69455         };
69456         source.imageryUsed = function() {
69457           return null;
69458         };
69459         source.area = function() {
69460           return -1;
69461         };
69462         return source;
69463       };
69464       rendererBackgroundSource.Custom = function(template) {
69465         var source = rendererBackgroundSource({ id: "custom", template });
69466         source.name = function() {
69467           return _t("background.custom");
69468         };
69469         source.label = function() {
69470           return _t.append("background.custom");
69471         };
69472         source.imageryUsed = function() {
69473           var cleaned = source.template();
69474           if (cleaned.indexOf("?") !== -1) {
69475             var parts = cleaned.split("?", 2);
69476             var qs = utilStringQs(parts[1]);
69477             ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
69478               if (qs[param]) {
69479                 qs[param] = "{apikey}";
69480               }
69481             });
69482             cleaned = parts[0] + "?" + utilQsString(qs, true);
69483           }
69484           cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
69485           return "Custom (" + cleaned + " )";
69486         };
69487         source.area = function() {
69488           return -2;
69489         };
69490         return source;
69491       };
69492     }
69493   });
69494
69495   // node_modules/@turf/meta/dist/esm/index.js
69496   function coordEach(geojson, callback, excludeWrapCoord) {
69497     if (geojson === null) return;
69498     var j3, k3, 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;
69499     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
69500       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
69501       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
69502       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
69503       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
69504         var multiFeatureIndex = 0;
69505         var geometryIndex = 0;
69506         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
69507         if (geometry === null) continue;
69508         coords = geometry.coordinates;
69509         var geomType = geometry.type;
69510         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
69511         switch (geomType) {
69512           case null:
69513             break;
69514           case "Point":
69515             if (callback(
69516               coords,
69517               coordIndex,
69518               featureIndex,
69519               multiFeatureIndex,
69520               geometryIndex
69521             ) === false)
69522               return false;
69523             coordIndex++;
69524             multiFeatureIndex++;
69525             break;
69526           case "LineString":
69527           case "MultiPoint":
69528             for (j3 = 0; j3 < coords.length; j3++) {
69529               if (callback(
69530                 coords[j3],
69531                 coordIndex,
69532                 featureIndex,
69533                 multiFeatureIndex,
69534                 geometryIndex
69535               ) === false)
69536                 return false;
69537               coordIndex++;
69538               if (geomType === "MultiPoint") multiFeatureIndex++;
69539             }
69540             if (geomType === "LineString") multiFeatureIndex++;
69541             break;
69542           case "Polygon":
69543           case "MultiLineString":
69544             for (j3 = 0; j3 < coords.length; j3++) {
69545               for (k3 = 0; k3 < coords[j3].length - wrapShrink; k3++) {
69546                 if (callback(
69547                   coords[j3][k3],
69548                   coordIndex,
69549                   featureIndex,
69550                   multiFeatureIndex,
69551                   geometryIndex
69552                 ) === false)
69553                   return false;
69554                 coordIndex++;
69555               }
69556               if (geomType === "MultiLineString") multiFeatureIndex++;
69557               if (geomType === "Polygon") geometryIndex++;
69558             }
69559             if (geomType === "Polygon") multiFeatureIndex++;
69560             break;
69561           case "MultiPolygon":
69562             for (j3 = 0; j3 < coords.length; j3++) {
69563               geometryIndex = 0;
69564               for (k3 = 0; k3 < coords[j3].length; k3++) {
69565                 for (l2 = 0; l2 < coords[j3][k3].length - wrapShrink; l2++) {
69566                   if (callback(
69567                     coords[j3][k3][l2],
69568                     coordIndex,
69569                     featureIndex,
69570                     multiFeatureIndex,
69571                     geometryIndex
69572                   ) === false)
69573                     return false;
69574                   coordIndex++;
69575                 }
69576                 geometryIndex++;
69577               }
69578               multiFeatureIndex++;
69579             }
69580             break;
69581           case "GeometryCollection":
69582             for (j3 = 0; j3 < geometry.geometries.length; j3++)
69583               if (coordEach(geometry.geometries[j3], callback, excludeWrapCoord) === false)
69584                 return false;
69585             break;
69586           default:
69587             throw new Error("Unknown Geometry Type");
69588         }
69589       }
69590     }
69591   }
69592   var init_esm6 = __esm({
69593     "node_modules/@turf/meta/dist/esm/index.js"() {
69594     }
69595   });
69596
69597   // node_modules/@turf/bbox/dist/esm/index.js
69598   function bbox(geojson, options = {}) {
69599     if (geojson.bbox != null && true !== options.recompute) {
69600       return geojson.bbox;
69601     }
69602     const result = [Infinity, Infinity, -Infinity, -Infinity];
69603     coordEach(geojson, (coord2) => {
69604       if (result[0] > coord2[0]) {
69605         result[0] = coord2[0];
69606       }
69607       if (result[1] > coord2[1]) {
69608         result[1] = coord2[1];
69609       }
69610       if (result[2] < coord2[0]) {
69611         result[2] = coord2[0];
69612       }
69613       if (result[3] < coord2[1]) {
69614         result[3] = coord2[1];
69615       }
69616     });
69617     return result;
69618   }
69619   var turf_bbox_default;
69620   var init_esm7 = __esm({
69621     "node_modules/@turf/bbox/dist/esm/index.js"() {
69622       init_esm6();
69623       turf_bbox_default = bbox;
69624     }
69625   });
69626
69627   // modules/renderer/tile_layer.js
69628   var tile_layer_exports = {};
69629   __export(tile_layer_exports, {
69630     rendererTileLayer: () => rendererTileLayer
69631   });
69632   function rendererTileLayer(context) {
69633     var transformProp = utilPrefixCSSProperty("Transform");
69634     var tiler8 = utilTiler();
69635     var _tileSize = 256;
69636     var _projection;
69637     var _cache5 = {};
69638     var _tileOrigin;
69639     var _zoom;
69640     var _source;
69641     var _underzoom = 0;
69642     function tileSizeAtZoom(d2, z3) {
69643       return d2.tileSize * Math.pow(2, z3 - d2[2]) / d2.tileSize;
69644     }
69645     function atZoom(t2, distance) {
69646       var power = Math.pow(2, distance);
69647       return [
69648         Math.floor(t2[0] * power),
69649         Math.floor(t2[1] * power),
69650         t2[2] + distance
69651       ];
69652     }
69653     function lookUp(d2) {
69654       for (var up = -1; up > -d2[2]; up--) {
69655         var tile = atZoom(d2, up);
69656         if (_cache5[_source.url(tile)] !== false) {
69657           return tile;
69658         }
69659       }
69660     }
69661     function uniqueBy(a4, n3) {
69662       var o2 = [];
69663       var seen = {};
69664       for (var i3 = 0; i3 < a4.length; i3++) {
69665         if (seen[a4[i3][n3]] === void 0) {
69666           o2.push(a4[i3]);
69667           seen[a4[i3][n3]] = true;
69668         }
69669       }
69670       return o2;
69671     }
69672     function addSource(d2) {
69673       d2.url = _source.url(d2);
69674       d2.tileSize = _tileSize;
69675       d2.source = _source;
69676       return d2;
69677     }
69678     function background(selection2) {
69679       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
69680       var pixelOffset;
69681       if (_source) {
69682         pixelOffset = [
69683           _source.offset()[0] * Math.pow(2, _zoom),
69684           _source.offset()[1] * Math.pow(2, _zoom)
69685         ];
69686       } else {
69687         pixelOffset = [0, 0];
69688       }
69689       tiler8.scale(_projection.scale() * 2 * Math.PI).translate([
69690         _projection.translate()[0] + pixelOffset[0],
69691         _projection.translate()[1] + pixelOffset[1]
69692       ]);
69693       _tileOrigin = [
69694         _projection.scale() * Math.PI - _projection.translate()[0],
69695         _projection.scale() * Math.PI - _projection.translate()[1]
69696       ];
69697       render(selection2);
69698     }
69699     function render(selection2) {
69700       if (!_source) return;
69701       var requests = [];
69702       var showDebug = context.getDebug("tile") && !_source.overlay;
69703       if (_source.validZoom(_zoom, _underzoom)) {
69704         tiler8.skipNullIsland(!!_source.overlay);
69705         tiler8().forEach(function(d2) {
69706           addSource(d2);
69707           if (d2.url === "") return;
69708           if (typeof d2.url !== "string") return;
69709           requests.push(d2);
69710           if (_cache5[d2.url] === false && lookUp(d2)) {
69711             requests.push(addSource(lookUp(d2)));
69712           }
69713         });
69714         requests = uniqueBy(requests, "url").filter(function(r2) {
69715           return _cache5[r2.url] !== false;
69716         });
69717       }
69718       function load(d3_event, d2) {
69719         _cache5[d2.url] = true;
69720         select_default2(this).on("error", null).on("load", null);
69721         render(selection2);
69722       }
69723       function error(d3_event, d2) {
69724         _cache5[d2.url] = false;
69725         select_default2(this).on("error", null).on("load", null).remove();
69726         render(selection2);
69727       }
69728       function imageTransform(d2) {
69729         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
69730         var scale = tileSizeAtZoom(d2, _zoom);
69731         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 + ")";
69732       }
69733       function tileCenter(d2) {
69734         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
69735         return [
69736           d2[0] * ts - _tileOrigin[0] + ts / 2,
69737           d2[1] * ts - _tileOrigin[1] + ts / 2
69738         ];
69739       }
69740       function debugTransform(d2) {
69741         var coord2 = tileCenter(d2);
69742         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
69743       }
69744       var dims = tiler8.size();
69745       var mapCenter = [dims[0] / 2, dims[1] / 2];
69746       var minDist = Math.max(dims[0], dims[1]);
69747       var nearCenter;
69748       requests.forEach(function(d2) {
69749         var c2 = tileCenter(d2);
69750         var dist = geoVecLength(c2, mapCenter);
69751         if (dist < minDist) {
69752           minDist = dist;
69753           nearCenter = d2;
69754         }
69755       });
69756       var image = selection2.selectAll("img").data(requests, function(d2) {
69757         return d2.url;
69758       });
69759       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).on("transitionend", function() {
69760         const tile = select_default2(this);
69761         if (tile.classed("tile-removing")) {
69762           tile.remove();
69763         }
69764       });
69765       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
69766         return d2.url;
69767       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
69768         return d2 === nearCenter;
69769       }).sort((a4, b3) => a4[2] - b3[2]);
69770       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
69771         return d2.url;
69772       });
69773       debug2.exit().remove();
69774       if (showDebug) {
69775         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
69776         debugEnter.append("div").attr("class", "tile-label-debug-coord");
69777         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
69778         debug2 = debug2.merge(debugEnter);
69779         debug2.style(transformProp, debugTransform);
69780         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
69781           return d2[2] + " / " + d2[0] + " / " + d2[1];
69782         });
69783         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
69784           var span = select_default2(this);
69785           var center = context.projection.invert(tileCenter(d2));
69786           _source.getMetadata(center, d2, function(err, result) {
69787             if (result && result.vintage && result.vintage.range) {
69788               span.text(result.vintage.range);
69789             } else {
69790               span.text("");
69791               span.call(_t.append("info_panels.background.vintage"));
69792               span.append("span").text(": ");
69793               span.call(_t.append("info_panels.background.unknown"));
69794             }
69795           });
69796         });
69797       }
69798     }
69799     background.projection = function(val) {
69800       if (!arguments.length) return _projection;
69801       _projection = val;
69802       return background;
69803     };
69804     background.dimensions = function(val) {
69805       if (!arguments.length) return tiler8.size();
69806       tiler8.size(val);
69807       return background;
69808     };
69809     background.source = function(val) {
69810       if (!arguments.length) return _source;
69811       _source = val;
69812       _tileSize = _source.tileSize;
69813       _cache5 = {};
69814       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
69815       return background;
69816     };
69817     background.underzoom = function(amount) {
69818       if (!arguments.length) return _underzoom;
69819       _underzoom = amount;
69820       return background;
69821     };
69822     return background;
69823   }
69824   var init_tile_layer = __esm({
69825     "modules/renderer/tile_layer.js"() {
69826       "use strict";
69827       init_src5();
69828       init_localizer();
69829       init_geo2();
69830       init_util();
69831     }
69832   });
69833
69834   // modules/renderer/background.js
69835   var background_exports2 = {};
69836   __export(background_exports2, {
69837     rendererBackground: () => rendererBackground
69838   });
69839   function rendererBackground(context) {
69840     const dispatch14 = dispatch_default("change");
69841     const baseLayer = rendererTileLayer(context).projection(context.projection);
69842     let _checkedBlocklists = [];
69843     let _isValid = true;
69844     let _overlayLayers = [];
69845     let _brightness = 1;
69846     let _contrast = 1;
69847     let _saturation = 1;
69848     let _sharpness = 1;
69849     function ensureImageryIndex() {
69850       return _mainFileFetcher.get("imagery").then((sources) => {
69851         if (_imageryIndex) return _imageryIndex;
69852         _imageryIndex = {
69853           imagery: sources,
69854           features: {}
69855         };
69856         const features = sources.map((source) => {
69857           if (!source.polygon) return null;
69858           const rings = source.polygon.map((ring) => [ring]);
69859           const feature3 = {
69860             type: "Feature",
69861             properties: { id: source.id },
69862             geometry: { type: "MultiPolygon", coordinates: rings }
69863           };
69864           _imageryIndex.features[source.id] = feature3;
69865           return feature3;
69866         }).filter(Boolean);
69867         _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features });
69868         _imageryIndex.backgrounds = sources.map((source) => {
69869           if (source.type === "bing") {
69870             return rendererBackgroundSource.Bing(source, dispatch14);
69871           } else if (/^EsriWorldImagery/.test(source.id)) {
69872             return rendererBackgroundSource.Esri(source);
69873           } else {
69874             return rendererBackgroundSource(source);
69875           }
69876         });
69877         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
69878         let template = corePreferences("background-custom-template") || "";
69879         const custom = rendererBackgroundSource.Custom(template);
69880         _imageryIndex.backgrounds.unshift(custom);
69881         return _imageryIndex;
69882       });
69883     }
69884     function background(selection2) {
69885       const currSource = baseLayer.source();
69886       if (context.map().zoom() > 18) {
69887         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
69888           const center = context.map().center();
69889           currSource.fetchTilemap(center);
69890         }
69891       }
69892       const sources = background.sources(context.map().extent());
69893       const wasValid = _isValid;
69894       _isValid = !!sources.filter((d2) => d2 === currSource).length;
69895       if (wasValid !== _isValid) {
69896         background.updateImagery();
69897       }
69898       let baseFilter = "";
69899       if (_brightness !== 1) {
69900         baseFilter += ` brightness(${_brightness})`;
69901       }
69902       if (_contrast !== 1) {
69903         baseFilter += ` contrast(${_contrast})`;
69904       }
69905       if (_saturation !== 1) {
69906         baseFilter += ` saturate(${_saturation})`;
69907       }
69908       if (_sharpness < 1) {
69909         const blur = number_default(0.5, 5)(1 - _sharpness);
69910         baseFilter += ` blur(${blur}px)`;
69911       }
69912       let base = selection2.selectAll(".layer-background").data([0]);
69913       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
69914       base.style("filter", baseFilter || null);
69915       let imagery = base.selectAll(".layer-imagery").data([0]);
69916       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
69917       let maskFilter = "";
69918       let mixBlendMode = "";
69919       if (_sharpness > 1) {
69920         mixBlendMode = "overlay";
69921         maskFilter = "saturate(0) blur(3px) invert(1)";
69922         let contrast = _sharpness - 1;
69923         maskFilter += ` contrast(${contrast})`;
69924         let brightness = number_default(1, 0.85)(_sharpness - 1);
69925         maskFilter += ` brightness(${brightness})`;
69926       }
69927       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
69928       mask.exit().remove();
69929       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);
69930       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
69931       overlays.exit().remove();
69932       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
69933     }
69934     background.updateImagery = function() {
69935       let currSource = baseLayer.source();
69936       if (context.inIntro() || !currSource) return;
69937       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
69938       const meters = geoOffsetToMeters(currSource.offset());
69939       const EPSILON = 0.01;
69940       const x2 = +meters[0].toFixed(2);
69941       const y2 = +meters[1].toFixed(2);
69942       let hash2 = utilStringQs(window.location.hash);
69943       let id2 = currSource.id;
69944       if (id2 === "custom") {
69945         id2 = `custom:${currSource.template()}`;
69946       }
69947       if (id2) {
69948         hash2.background = id2;
69949       } else {
69950         delete hash2.background;
69951       }
69952       if (o2) {
69953         hash2.overlays = o2;
69954       } else {
69955         delete hash2.overlays;
69956       }
69957       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
69958         hash2.offset = `${x2},${y2}`;
69959       } else {
69960         delete hash2.offset;
69961       }
69962       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
69963       let imageryUsed = [];
69964       let photoOverlaysUsed = [];
69965       const currUsed = currSource.imageryUsed();
69966       if (currUsed && _isValid) {
69967         imageryUsed.push(currUsed);
69968       }
69969       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
69970       const dataLayer = context.layers().layer("data");
69971       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
69972         imageryUsed.push(dataLayer.getSrc());
69973       }
69974       const photoOverlayLayers = {
69975         streetside: "Bing Streetside",
69976         mapillary: "Mapillary Images",
69977         "mapillary-map-features": "Mapillary Map Features",
69978         "mapillary-signs": "Mapillary Signs",
69979         kartaview: "KartaView Images",
69980         vegbilder: "Norwegian Road Administration Images",
69981         mapilio: "Mapilio Images",
69982         panoramax: "Panoramax Images"
69983       };
69984       for (let layerID in photoOverlayLayers) {
69985         const layer = context.layers().layer(layerID);
69986         if (layer && layer.enabled()) {
69987           photoOverlaysUsed.push(layerID);
69988           imageryUsed.push(photoOverlayLayers[layerID]);
69989         }
69990       }
69991       context.history().imageryUsed(imageryUsed);
69992       context.history().photoOverlaysUsed(photoOverlaysUsed);
69993     };
69994     background.sources = (extent, zoom, includeCurrent) => {
69995       if (!_imageryIndex) return [];
69996       let visible = {};
69997       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
69998       const currSource = baseLayer.source();
69999       const osm = context.connection();
70000       const blocklists = osm && osm.imageryBlocklists() || [];
70001       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
70002       if (blocklistChanged) {
70003         _imageryIndex.backgrounds.forEach((source) => {
70004           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
70005         });
70006         _checkedBlocklists = blocklists.map((regex) => String(regex));
70007       }
70008       return _imageryIndex.backgrounds.filter((source) => {
70009         if (includeCurrent && currSource === source) return true;
70010         if (source.isBlocked) return false;
70011         if (!source.polygon) return true;
70012         if (zoom && zoom < 6) return false;
70013         return visible[source.id];
70014       });
70015     };
70016     background.dimensions = (val) => {
70017       if (!val) return;
70018       baseLayer.dimensions(val);
70019       _overlayLayers.forEach((layer) => layer.dimensions(val));
70020     };
70021     background.baseLayerSource = function(d2) {
70022       if (!arguments.length) return baseLayer.source();
70023       const osm = context.connection();
70024       if (!osm) return background;
70025       const blocklists = osm.imageryBlocklists();
70026       const template = d2.template();
70027       let fail = false;
70028       let tested = 0;
70029       let regex;
70030       for (let i3 = 0; i3 < blocklists.length; i3++) {
70031         regex = blocklists[i3];
70032         fail = regex.test(template);
70033         tested++;
70034         if (fail) break;
70035       }
70036       if (!tested) {
70037         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
70038         fail = regex.test(template);
70039       }
70040       baseLayer.source(!fail ? d2 : background.findSource("none"));
70041       dispatch14.call("change");
70042       background.updateImagery();
70043       return background;
70044     };
70045     background.findSource = (id2) => {
70046       if (!id2 || !_imageryIndex) return null;
70047       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
70048     };
70049     background.bing = () => {
70050       background.baseLayerSource(background.findSource("Bing"));
70051     };
70052     background.showsLayer = (d2) => {
70053       const currSource = baseLayer.source();
70054       if (!d2 || !currSource) return false;
70055       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
70056     };
70057     background.overlayLayerSources = () => {
70058       return _overlayLayers.map((layer) => layer.source());
70059     };
70060     background.toggleOverlayLayer = (d2) => {
70061       let layer;
70062       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
70063         layer = _overlayLayers[i3];
70064         if (layer.source() === d2) {
70065           _overlayLayers.splice(i3, 1);
70066           dispatch14.call("change");
70067           background.updateImagery();
70068           return;
70069         }
70070       }
70071       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
70072         baseLayer.dimensions()
70073       );
70074       _overlayLayers.push(layer);
70075       dispatch14.call("change");
70076       background.updateImagery();
70077     };
70078     background.nudge = (d2, zoom) => {
70079       const currSource = baseLayer.source();
70080       if (currSource) {
70081         currSource.nudge(d2, zoom);
70082         dispatch14.call("change");
70083         background.updateImagery();
70084       }
70085       return background;
70086     };
70087     background.offset = function(d2) {
70088       const currSource = baseLayer.source();
70089       if (!arguments.length) {
70090         return currSource && currSource.offset() || [0, 0];
70091       }
70092       if (currSource) {
70093         currSource.offset(d2);
70094         dispatch14.call("change");
70095         background.updateImagery();
70096       }
70097       return background;
70098     };
70099     background.brightness = function(d2) {
70100       if (!arguments.length) return _brightness;
70101       _brightness = d2;
70102       if (context.mode()) dispatch14.call("change");
70103       return background;
70104     };
70105     background.contrast = function(d2) {
70106       if (!arguments.length) return _contrast;
70107       _contrast = d2;
70108       if (context.mode()) dispatch14.call("change");
70109       return background;
70110     };
70111     background.saturation = function(d2) {
70112       if (!arguments.length) return _saturation;
70113       _saturation = d2;
70114       if (context.mode()) dispatch14.call("change");
70115       return background;
70116     };
70117     background.sharpness = function(d2) {
70118       if (!arguments.length) return _sharpness;
70119       _sharpness = d2;
70120       if (context.mode()) dispatch14.call("change");
70121       return background;
70122     };
70123     let _loadPromise;
70124     background.ensureLoaded = () => {
70125       if (_loadPromise) return _loadPromise;
70126       return _loadPromise = ensureImageryIndex();
70127     };
70128     background.init = () => {
70129       const loadPromise = background.ensureLoaded();
70130       const hash2 = utilStringQs(window.location.hash);
70131       const requestedBackground = hash2.background || hash2.layer;
70132       const lastUsedBackground = corePreferences("background-last-used");
70133       return loadPromise.then((imageryIndex) => {
70134         const extent = context.map().extent();
70135         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
70136         const first = validBackgrounds.length && validBackgrounds[0];
70137         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
70138         let best;
70139         if (!requestedBackground && extent) {
70140           const viewArea = extent.area();
70141           best = validBackgrounds.find((s2) => {
70142             if (!s2.best() || s2.overlay) return false;
70143             let bbox2 = turf_bbox_default(turf_bbox_clip_default(
70144               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
70145               extent.rectangle()
70146             ));
70147             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
70148             return area / viewArea > 0.5;
70149           });
70150         }
70151         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
70152           const template = requestedBackground.replace(/^custom:/, "");
70153           const custom = background.findSource("custom");
70154           background.baseLayerSource(custom.template(template));
70155           corePreferences("background-custom-template", template);
70156         } else {
70157           background.baseLayerSource(
70158             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
70159           );
70160         }
70161         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
70162         if (locator) {
70163           background.toggleOverlayLayer(locator);
70164         }
70165         const overlays = (hash2.overlays || "").split(",");
70166         overlays.forEach((overlay) => {
70167           overlay = background.findSource(overlay);
70168           if (overlay) {
70169             background.toggleOverlayLayer(overlay);
70170           }
70171         });
70172         if (hash2.gpx) {
70173           const gpx2 = context.layers().layer("data");
70174           if (gpx2) {
70175             gpx2.url(hash2.gpx, ".gpx");
70176           }
70177         }
70178         if (hash2.offset) {
70179           const offset = hash2.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
70180           if (offset.length === 2) {
70181             background.offset(geoMetersToOffset(offset));
70182           }
70183         }
70184       }).catch((err) => {
70185         console.error(err);
70186       });
70187     };
70188     return utilRebind(background, dispatch14, "on");
70189   }
70190   var import_which_polygon4, _imageryIndex;
70191   var init_background2 = __esm({
70192     "modules/renderer/background.js"() {
70193       "use strict";
70194       init_src4();
70195       init_src8();
70196       init_src5();
70197       init_esm5();
70198       init_esm7();
70199       import_which_polygon4 = __toESM(require_which_polygon());
70200       init_preferences();
70201       init_file_fetcher();
70202       init_geo2();
70203       init_background_source();
70204       init_tile_layer();
70205       init_util();
70206       init_rebind();
70207       _imageryIndex = null;
70208     }
70209   });
70210
70211   // modules/renderer/features.js
70212   var features_exports = {};
70213   __export(features_exports, {
70214     rendererFeatures: () => rendererFeatures
70215   });
70216   function rendererFeatures(context) {
70217     var dispatch14 = dispatch_default("change", "redraw");
70218     const features = {};
70219     var _deferred2 = /* @__PURE__ */ new Set();
70220     var traffic_roads = {
70221       "motorway": true,
70222       "motorway_link": true,
70223       "trunk": true,
70224       "trunk_link": true,
70225       "primary": true,
70226       "primary_link": true,
70227       "secondary": true,
70228       "secondary_link": true,
70229       "tertiary": true,
70230       "tertiary_link": true,
70231       "residential": true,
70232       "unclassified": true,
70233       "living_street": true,
70234       "busway": true
70235     };
70236     var service_roads = {
70237       "service": true,
70238       "road": true,
70239       "track": true
70240     };
70241     var paths = {
70242       "path": true,
70243       "footway": true,
70244       "cycleway": true,
70245       "bridleway": true,
70246       "steps": true,
70247       "ladder": true,
70248       "pedestrian": true
70249     };
70250     var _cullFactor = 1;
70251     var _cache5 = {};
70252     var _rules = {};
70253     var _stats = {};
70254     var _keys = [];
70255     var _hidden = [];
70256     var _forceVisible = {};
70257     function update() {
70258       const hash2 = utilStringQs(window.location.hash);
70259       const disabled = features.disabled();
70260       if (disabled.length) {
70261         hash2.disable_features = disabled.join(",");
70262       } else {
70263         delete hash2.disable_features;
70264       }
70265       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
70266       corePreferences("disabled-features", disabled.join(","));
70267       _hidden = features.hidden();
70268       dispatch14.call("change");
70269       dispatch14.call("redraw");
70270     }
70271     function defineRule(k3, filter2, max3) {
70272       var isEnabled = true;
70273       _keys.push(k3);
70274       _rules[k3] = {
70275         filter: filter2,
70276         enabled: isEnabled,
70277         // whether the user wants it enabled..
70278         count: 0,
70279         currentMax: max3 || Infinity,
70280         defaultMax: max3 || Infinity,
70281         enable: function() {
70282           this.enabled = true;
70283           this.currentMax = this.defaultMax;
70284         },
70285         disable: function() {
70286           this.enabled = false;
70287           this.currentMax = 0;
70288         },
70289         hidden: function() {
70290           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
70291         },
70292         autoHidden: function() {
70293           return this.hidden() && this.currentMax > 0;
70294         }
70295       };
70296     }
70297     function isAddressPoint2(tags, geometry) {
70298       const keys2 = Object.keys(tags);
70299       return geometry === "point" && keys2.length > 0 && keys2.every(
70300         (key) => key.startsWith("addr:") || !osmIsInterestingTag(key)
70301       );
70302     }
70303     defineRule("address_points", isAddressPoint2, 100);
70304     defineRule("points", function isPoint(tags, geometry) {
70305       return geometry === "point" && !isAddressPoint2(tags, geometry);
70306     }, 200);
70307     defineRule("traffic_roads", function isTrafficRoad(tags) {
70308       return traffic_roads[tags.highway];
70309     });
70310     defineRule("service_roads", function isServiceRoad(tags) {
70311       return service_roads[tags.highway];
70312     });
70313     defineRule("paths", function isPath(tags) {
70314       return paths[tags.highway];
70315     });
70316     defineRule("buildings", function isBuilding(tags) {
70317       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
70318     }, 250);
70319     defineRule("building_parts", function isBuildingPart(tags) {
70320       return !!tags["building:part"];
70321     });
70322     defineRule("indoor", function isIndoor(tags) {
70323       return !!tags.indoor && tags.indoor !== "no" || !!tags.indoormark && tags.indoormark !== "no";
70324     });
70325     defineRule("landuse", function isLanduse(tags, geometry) {
70326       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);
70327     });
70328     defineRule("boundaries", function isBoundary(tags, geometry) {
70329       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);
70330     });
70331     defineRule("water", function isWater(tags) {
70332       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";
70333     });
70334     defineRule("rail", function isRail(tags) {
70335       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
70336     });
70337     defineRule("pistes", function isPiste(tags) {
70338       return tags["piste:type"];
70339     });
70340     defineRule("aerialways", function isAerialways(tags) {
70341       return !!(tags == null ? void 0 : tags.aerialway) && tags.aerialway !== "yes" && tags.aerialway !== "station";
70342     });
70343     defineRule("power", function isPower(tags) {
70344       return !!tags.power;
70345     });
70346     defineRule("past_future", function isPastFuture(tags) {
70347       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
70348         return false;
70349       }
70350       const keys2 = Object.keys(tags);
70351       for (const key of keys2) {
70352         if (osmLifecyclePrefixes[tags[key]]) return true;
70353         const parts = key.split(":");
70354         if (parts.length === 1) continue;
70355         const prefix = parts[0];
70356         if (osmLifecyclePrefixes[prefix]) return true;
70357       }
70358       return false;
70359     });
70360     defineRule("others", function isOther(tags, geometry) {
70361       return geometry === "line" || geometry === "area";
70362     });
70363     features.features = function() {
70364       return _rules;
70365     };
70366     features.keys = function() {
70367       return _keys;
70368     };
70369     features.enabled = function(k3) {
70370       if (!arguments.length) {
70371         return _keys.filter(function(k4) {
70372           return _rules[k4].enabled;
70373         });
70374       }
70375       return _rules[k3] && _rules[k3].enabled;
70376     };
70377     features.disabled = function(k3) {
70378       if (!arguments.length) {
70379         return _keys.filter(function(k4) {
70380           return !_rules[k4].enabled;
70381         });
70382       }
70383       return _rules[k3] && !_rules[k3].enabled;
70384     };
70385     features.hidden = function(k3) {
70386       var _a4;
70387       if (!arguments.length) {
70388         return _keys.filter(function(k4) {
70389           return _rules[k4].hidden();
70390         });
70391       }
70392       return (_a4 = _rules[k3]) == null ? void 0 : _a4.hidden();
70393     };
70394     features.autoHidden = function(k3) {
70395       if (!arguments.length) {
70396         return _keys.filter(function(k4) {
70397           return _rules[k4].autoHidden();
70398         });
70399       }
70400       return _rules[k3] && _rules[k3].autoHidden();
70401     };
70402     features.enable = function(k3) {
70403       if (_rules[k3] && !_rules[k3].enabled) {
70404         _rules[k3].enable();
70405         update();
70406       }
70407     };
70408     features.enableAll = function() {
70409       var didEnable = false;
70410       for (var k3 in _rules) {
70411         if (!_rules[k3].enabled) {
70412           didEnable = true;
70413           _rules[k3].enable();
70414         }
70415       }
70416       if (didEnable) update();
70417     };
70418     features.disable = function(k3) {
70419       if (_rules[k3] && _rules[k3].enabled) {
70420         _rules[k3].disable();
70421         update();
70422       }
70423     };
70424     features.disableAll = function() {
70425       var didDisable = false;
70426       for (var k3 in _rules) {
70427         if (_rules[k3].enabled) {
70428           didDisable = true;
70429           _rules[k3].disable();
70430         }
70431       }
70432       if (didDisable) update();
70433     };
70434     features.toggle = function(k3) {
70435       if (_rules[k3]) {
70436         (function(f2) {
70437           return f2.enabled ? f2.disable() : f2.enable();
70438         })(_rules[k3]);
70439         update();
70440       }
70441     };
70442     features.resetStats = function() {
70443       for (var i3 = 0; i3 < _keys.length; i3++) {
70444         _rules[_keys[i3]].count = 0;
70445       }
70446       dispatch14.call("change");
70447     };
70448     features.gatherStats = function(d2, resolver, dimensions) {
70449       var needsRedraw = false;
70450       var types = utilArrayGroupBy(d2, "type");
70451       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
70452       var currHidden, geometry, matches, i3, j3;
70453       for (i3 = 0; i3 < _keys.length; i3++) {
70454         _rules[_keys[i3]].count = 0;
70455       }
70456       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
70457       for (i3 = 0; i3 < entities.length; i3++) {
70458         geometry = entities[i3].geometry(resolver);
70459         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
70460         for (j3 = 0; j3 < matches.length; j3++) {
70461           _rules[matches[j3]].count++;
70462         }
70463       }
70464       currHidden = features.hidden();
70465       if (currHidden !== _hidden) {
70466         _hidden = currHidden;
70467         needsRedraw = true;
70468         dispatch14.call("change");
70469       }
70470       return needsRedraw;
70471     };
70472     features.stats = function() {
70473       for (var i3 = 0; i3 < _keys.length; i3++) {
70474         _stats[_keys[i3]] = _rules[_keys[i3]].count;
70475       }
70476       return _stats;
70477     };
70478     features.clear = function(d2) {
70479       for (var i3 = 0; i3 < d2.length; i3++) {
70480         features.clearEntity(d2[i3]);
70481       }
70482     };
70483     features.clearEntity = function(entity) {
70484       delete _cache5[osmEntity.key(entity)];
70485     };
70486     features.reset = function() {
70487       Array.from(_deferred2).forEach(function(handle) {
70488         window.cancelIdleCallback(handle);
70489         _deferred2.delete(handle);
70490       });
70491       _cache5 = {};
70492     };
70493     function relationShouldBeChecked(relation) {
70494       return relation.tags.type === "boundary";
70495     }
70496     features.getMatches = function(entity, resolver, geometry) {
70497       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity)) return {};
70498       var ent = osmEntity.key(entity);
70499       if (!_cache5[ent]) {
70500         _cache5[ent] = {};
70501       }
70502       if (!_cache5[ent].matches) {
70503         var matches = {};
70504         var hasMatch = false;
70505         for (var i3 = 0; i3 < _keys.length; i3++) {
70506           if (_keys[i3] === "others") {
70507             if (hasMatch) continue;
70508             if (entity.type === "way") {
70509               var parents = features.getParents(entity, resolver, geometry);
70510               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
70511               parents.length > 0 && parents.every(function(parent2) {
70512                 return parent2.tags.type === "boundary";
70513               })) {
70514                 var pkey = osmEntity.key(parents[0]);
70515                 if (_cache5[pkey] && _cache5[pkey].matches) {
70516                   matches = Object.assign({}, _cache5[pkey].matches);
70517                   continue;
70518                 }
70519               }
70520             }
70521           }
70522           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
70523             matches[_keys[i3]] = hasMatch = true;
70524           }
70525         }
70526         _cache5[ent].matches = matches;
70527       }
70528       return _cache5[ent].matches;
70529     };
70530     features.getParents = function(entity, resolver, geometry) {
70531       if (geometry === "point") return [];
70532       var ent = osmEntity.key(entity);
70533       if (!_cache5[ent]) {
70534         _cache5[ent] = {};
70535       }
70536       if (!_cache5[ent].parents) {
70537         var parents = [];
70538         if (geometry === "vertex") {
70539           parents = resolver.parentWays(entity);
70540         } else {
70541           parents = resolver.parentRelations(entity);
70542         }
70543         _cache5[ent].parents = parents;
70544       }
70545       return _cache5[ent].parents;
70546     };
70547     features.isHiddenPreset = function(preset, geometry) {
70548       if (!_hidden.length) return false;
70549       if (!preset.tags) return false;
70550       var test = preset.setTags({}, geometry);
70551       for (var key in _rules) {
70552         if (_rules[key].filter(test, geometry)) {
70553           if (_hidden.indexOf(key) !== -1) {
70554             return key;
70555           }
70556           return false;
70557         }
70558       }
70559       return false;
70560     };
70561     features.isHiddenFeature = function(entity, resolver, geometry) {
70562       if (!_hidden.length) return false;
70563       if (!entity.version) return false;
70564       if (_forceVisible[entity.id]) return false;
70565       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
70566       return matches.length && matches.every(function(k3) {
70567         return features.hidden(k3);
70568       });
70569     };
70570     features.isHiddenChild = function(entity, resolver, geometry) {
70571       if (!_hidden.length) return false;
70572       if (!entity.version || geometry === "point") return false;
70573       if (_forceVisible[entity.id]) return false;
70574       var parents = features.getParents(entity, resolver, geometry);
70575       if (!parents.length) return false;
70576       for (var i3 = 0; i3 < parents.length; i3++) {
70577         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
70578           return false;
70579         }
70580       }
70581       return true;
70582     };
70583     features.hasHiddenConnections = function(entity, resolver) {
70584       if (!_hidden.length) return false;
70585       var childNodes, connections;
70586       if (entity.type === "midpoint") {
70587         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
70588         connections = [];
70589       } else {
70590         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
70591         connections = features.getParents(entity, resolver, entity.geometry(resolver));
70592       }
70593       connections = childNodes.reduce(function(result, e3) {
70594         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
70595       }, connections);
70596       return connections.some(function(e3) {
70597         return features.isHidden(e3, resolver, e3.geometry(resolver));
70598       });
70599     };
70600     features.isHidden = function(entity, resolver, geometry) {
70601       if (!_hidden.length) return false;
70602       if (!entity.version) return false;
70603       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
70604       return fn(entity, resolver, geometry);
70605     };
70606     features.filter = function(d2, resolver) {
70607       if (!_hidden.length) return d2;
70608       var result = [];
70609       for (var i3 = 0; i3 < d2.length; i3++) {
70610         var entity = d2[i3];
70611         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
70612           result.push(entity);
70613         }
70614       }
70615       return result;
70616     };
70617     features.forceVisible = function(entityIDs) {
70618       if (!arguments.length) return Object.keys(_forceVisible);
70619       _forceVisible = {};
70620       for (var i3 = 0; i3 < entityIDs.length; i3++) {
70621         _forceVisible[entityIDs[i3]] = true;
70622         var entity = context.hasEntity(entityIDs[i3]);
70623         if (entity && entity.type === "relation") {
70624           for (var j3 in entity.members) {
70625             _forceVisible[entity.members[j3].id] = true;
70626           }
70627         }
70628       }
70629       return features;
70630     };
70631     features.init = function() {
70632       var storage = corePreferences("disabled-features");
70633       if (storage) {
70634         var storageDisabled = storage.replace(/;/g, ",").split(",");
70635         storageDisabled.forEach(features.disable);
70636       }
70637       var hash2 = utilStringQs(window.location.hash);
70638       if (hash2.disable_features) {
70639         var hashDisabled = hash2.disable_features.replace(/;/g, ",").split(",");
70640         hashDisabled.forEach(features.disable);
70641       }
70642     };
70643     context.history().on("merge.features", function(newEntities) {
70644       if (!newEntities) return;
70645       var handle = window.requestIdleCallback(function() {
70646         var graph = context.graph();
70647         var types = utilArrayGroupBy(newEntities, "type");
70648         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
70649         for (var i3 = 0; i3 < entities.length; i3++) {
70650           var geometry = entities[i3].geometry(graph);
70651           features.getMatches(entities[i3], graph, geometry);
70652         }
70653       });
70654       _deferred2.add(handle);
70655     });
70656     return utilRebind(features, dispatch14, "on");
70657   }
70658   var init_features = __esm({
70659     "modules/renderer/features.js"() {
70660       "use strict";
70661       init_src4();
70662       init_preferences();
70663       init_osm();
70664       init_rebind();
70665       init_util();
70666     }
70667   });
70668
70669   // modules/util/bind_once.js
70670   var bind_once_exports = {};
70671   __export(bind_once_exports, {
70672     utilBindOnce: () => utilBindOnce
70673   });
70674   function utilBindOnce(target, type2, listener, capture) {
70675     var typeOnce = type2 + ".once";
70676     function one2() {
70677       target.on(typeOnce, null);
70678       listener.apply(this, arguments);
70679     }
70680     target.on(typeOnce, one2, capture);
70681     return this;
70682   }
70683   var init_bind_once = __esm({
70684     "modules/util/bind_once.js"() {
70685       "use strict";
70686     }
70687   });
70688
70689   // modules/util/zoom_pan.js
70690   var zoom_pan_exports = {};
70691   __export(zoom_pan_exports, {
70692     utilZoomPan: () => utilZoomPan
70693   });
70694   function defaultFilter3(d3_event) {
70695     return !d3_event.ctrlKey && !d3_event.button;
70696   }
70697   function defaultExtent2() {
70698     var e3 = this;
70699     if (e3 instanceof SVGElement) {
70700       e3 = e3.ownerSVGElement || e3;
70701       if (e3.hasAttribute("viewBox")) {
70702         e3 = e3.viewBox.baseVal;
70703         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
70704       }
70705       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
70706     }
70707     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
70708   }
70709   function defaultWheelDelta2(d3_event) {
70710     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
70711   }
70712   function defaultConstrain2(transform2, extent, translateExtent) {
70713     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];
70714     return transform2.translate(
70715       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
70716       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
70717     );
70718   }
70719   function utilZoomPan() {
70720     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;
70721     function zoom(selection2) {
70722       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
70723       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
70724     }
70725     zoom.transform = function(collection, transform2, point) {
70726       var selection2 = collection.selection ? collection.selection() : collection;
70727       if (collection !== selection2) {
70728         schedule(collection, transform2, point);
70729       } else {
70730         selection2.interrupt().each(function() {
70731           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
70732         });
70733       }
70734     };
70735     zoom.scaleBy = function(selection2, k3, p2) {
70736       zoom.scaleTo(selection2, function() {
70737         var k0 = _transform.k, k1 = typeof k3 === "function" ? k3.apply(this, arguments) : k3;
70738         return k0 * k1;
70739       }, p2);
70740     };
70741     zoom.scaleTo = function(selection2, k3, p2) {
70742       zoom.transform(selection2, function() {
70743         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 k3 === "function" ? k3.apply(this, arguments) : k3;
70744         return constrain(translate(scale(t02, k1), p02, p1), e3, translateExtent);
70745       }, p2);
70746     };
70747     zoom.translateBy = function(selection2, x2, y2) {
70748       zoom.transform(selection2, function() {
70749         return constrain(_transform.translate(
70750           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
70751           typeof y2 === "function" ? y2.apply(this, arguments) : y2
70752         ), extent.apply(this, arguments), translateExtent);
70753       });
70754     };
70755     zoom.translateTo = function(selection2, x2, y2, p2) {
70756       zoom.transform(selection2, function() {
70757         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
70758         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
70759           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
70760           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
70761         ), e3, translateExtent);
70762       }, p2);
70763     };
70764     function scale(transform2, k3) {
70765       k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k3));
70766       return k3 === transform2.k ? transform2 : new Transform(k3, transform2.x, transform2.y);
70767     }
70768     function translate(transform2, p02, p1) {
70769       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
70770       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
70771     }
70772     function centroid(extent2) {
70773       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
70774     }
70775     function schedule(transition2, transform2, point) {
70776       transition2.on("start.zoom", function() {
70777         gesture(this, arguments).start(null);
70778       }).on("interrupt.zoom end.zoom", function() {
70779         gesture(this, arguments).end(null);
70780       }).tween("zoom", function() {
70781         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, w3 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a4 = _transform, b3 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a4.invert(p2).concat(w3 / a4.k), b3.invert(p2).concat(w3 / b3.k));
70782         return function(t2) {
70783           if (t2 === 1) {
70784             t2 = b3;
70785           } else {
70786             var l2 = i3(t2);
70787             var k3 = w3 / l2[2];
70788             t2 = new Transform(k3, p2[0] - l2[0] * k3, p2[1] - l2[1] * k3);
70789           }
70790           g3.zoom(null, null, t2);
70791         };
70792       });
70793     }
70794     function gesture(that, args, clean2) {
70795       return !clean2 && _activeGesture || new Gesture(that, args);
70796     }
70797     function Gesture(that, args) {
70798       this.that = that;
70799       this.args = args;
70800       this.active = 0;
70801       this.extent = extent.apply(that, args);
70802     }
70803     Gesture.prototype = {
70804       start: function(d3_event) {
70805         if (++this.active === 1) {
70806           _activeGesture = this;
70807           dispatch14.call("start", this, d3_event);
70808         }
70809         return this;
70810       },
70811       zoom: function(d3_event, key, transform2) {
70812         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
70813         if (this.pointer0 && key !== "touch") this.pointer0[1] = transform2.invert(this.pointer0[0]);
70814         if (this.pointer1 && key !== "touch") this.pointer1[1] = transform2.invert(this.pointer1[0]);
70815         _transform = transform2;
70816         dispatch14.call("zoom", this, d3_event, key, transform2);
70817         return this;
70818       },
70819       end: function(d3_event) {
70820         if (--this.active === 0) {
70821           _activeGesture = null;
70822           dispatch14.call("end", this, d3_event);
70823         }
70824         return this;
70825       }
70826     };
70827     function wheeled(d3_event) {
70828       if (!filter2.apply(this, arguments)) return;
70829       var g3 = gesture(this, arguments), t2 = _transform, k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = utilFastMouse(this)(d3_event);
70830       if (g3.wheel) {
70831         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
70832           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
70833         }
70834         clearTimeout(g3.wheel);
70835       } else {
70836         g3.mouse = [p2, t2.invert(p2)];
70837         interrupt_default(this);
70838         g3.start(d3_event);
70839       }
70840       d3_event.preventDefault();
70841       d3_event.stopImmediatePropagation();
70842       g3.wheel = setTimeout(wheelidled, _wheelDelay);
70843       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k3), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
70844       function wheelidled() {
70845         g3.wheel = null;
70846         g3.end(d3_event);
70847       }
70848     }
70849     var _downPointerIDs = /* @__PURE__ */ new Set();
70850     var _pointerLocGetter;
70851     function pointerdown(d3_event) {
70852       _downPointerIDs.add(d3_event.pointerId);
70853       if (!filter2.apply(this, arguments)) return;
70854       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
70855       var started;
70856       d3_event.stopImmediatePropagation();
70857       _pointerLocGetter = utilFastMouse(this);
70858       var loc = _pointerLocGetter(d3_event);
70859       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
70860       if (!g3.pointer0) {
70861         g3.pointer0 = p2;
70862         started = true;
70863       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
70864         g3.pointer1 = p2;
70865       }
70866       if (started) {
70867         interrupt_default(this);
70868         g3.start(d3_event);
70869       }
70870     }
70871     function pointermove(d3_event) {
70872       if (!_downPointerIDs.has(d3_event.pointerId)) return;
70873       if (!_activeGesture || !_pointerLocGetter) return;
70874       var g3 = gesture(this, arguments);
70875       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
70876       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
70877       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
70878         if (g3.pointer0) _downPointerIDs.delete(g3.pointer0[2]);
70879         if (g3.pointer1) _downPointerIDs.delete(g3.pointer1[2]);
70880         g3.end(d3_event);
70881         return;
70882       }
70883       d3_event.preventDefault();
70884       d3_event.stopImmediatePropagation();
70885       var loc = _pointerLocGetter(d3_event);
70886       var t2, p2, l2;
70887       if (isPointer0) g3.pointer0[0] = loc;
70888       else if (isPointer1) g3.pointer1[0] = loc;
70889       t2 = _transform;
70890       if (g3.pointer1) {
70891         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;
70892         t2 = scale(t2, Math.sqrt(dp / dl));
70893         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
70894         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
70895       } else if (g3.pointer0) {
70896         p2 = g3.pointer0[0];
70897         l2 = g3.pointer0[1];
70898       } else {
70899         return;
70900       }
70901       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
70902     }
70903     function pointerup(d3_event) {
70904       if (!_downPointerIDs.has(d3_event.pointerId)) return;
70905       _downPointerIDs.delete(d3_event.pointerId);
70906       if (!_activeGesture) return;
70907       var g3 = gesture(this, arguments);
70908       d3_event.stopImmediatePropagation();
70909       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId) delete g3.pointer0;
70910       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId) delete g3.pointer1;
70911       if (g3.pointer1 && !g3.pointer0) {
70912         g3.pointer0 = g3.pointer1;
70913         delete g3.pointer1;
70914       }
70915       if (g3.pointer0) {
70916         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
70917       } else {
70918         g3.end(d3_event);
70919       }
70920     }
70921     zoom.wheelDelta = function(_3) {
70922       return arguments.length ? (wheelDelta = utilFunctor(+_3), zoom) : wheelDelta;
70923     };
70924     zoom.filter = function(_3) {
70925       return arguments.length ? (filter2 = utilFunctor(!!_3), zoom) : filter2;
70926     };
70927     zoom.extent = function(_3) {
70928       return arguments.length ? (extent = utilFunctor([[+_3[0][0], +_3[0][1]], [+_3[1][0], +_3[1][1]]]), zoom) : extent;
70929     };
70930     zoom.scaleExtent = function(_3) {
70931       return arguments.length ? (scaleExtent[0] = +_3[0], scaleExtent[1] = +_3[1], zoom) : [scaleExtent[0], scaleExtent[1]];
70932     };
70933     zoom.translateExtent = function(_3) {
70934       return arguments.length ? (translateExtent[0][0] = +_3[0][0], translateExtent[1][0] = +_3[1][0], translateExtent[0][1] = +_3[0][1], translateExtent[1][1] = +_3[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
70935     };
70936     zoom.constrain = function(_3) {
70937       return arguments.length ? (constrain = _3, zoom) : constrain;
70938     };
70939     zoom.interpolate = function(_3) {
70940       return arguments.length ? (interpolate = _3, zoom) : interpolate;
70941     };
70942     zoom._transform = function(_3) {
70943       return arguments.length ? (_transform = _3, zoom) : _transform;
70944     };
70945     return utilRebind(zoom, dispatch14, "on");
70946   }
70947   var init_zoom_pan = __esm({
70948     "modules/util/zoom_pan.js"() {
70949       "use strict";
70950       init_src4();
70951       init_src8();
70952       init_src5();
70953       init_src11();
70954       init_src12();
70955       init_transform3();
70956       init_util2();
70957       init_rebind();
70958     }
70959   });
70960
70961   // modules/util/double_up.js
70962   var double_up_exports = {};
70963   __export(double_up_exports, {
70964     utilDoubleUp: () => utilDoubleUp
70965   });
70966   function utilDoubleUp() {
70967     var dispatch14 = dispatch_default("doubleUp");
70968     var _maxTimespan = 500;
70969     var _maxDistance = 20;
70970     var _pointer;
70971     function pointerIsValidFor(loc) {
70972       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
70973       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
70974     }
70975     function pointerdown(d3_event) {
70976       if (d3_event.ctrlKey || d3_event.button === 2) return;
70977       var loc = [d3_event.clientX, d3_event.clientY];
70978       if (_pointer && !pointerIsValidFor(loc)) {
70979         _pointer = void 0;
70980       }
70981       if (!_pointer) {
70982         _pointer = {
70983           startLoc: loc,
70984           startTime: (/* @__PURE__ */ new Date()).getTime(),
70985           upCount: 0,
70986           pointerId: d3_event.pointerId
70987         };
70988       } else {
70989         _pointer.pointerId = d3_event.pointerId;
70990       }
70991     }
70992     function pointerup(d3_event) {
70993       if (d3_event.ctrlKey || d3_event.button === 2) return;
70994       if (!_pointer || _pointer.pointerId !== d3_event.pointerId) return;
70995       _pointer.upCount += 1;
70996       if (_pointer.upCount === 2) {
70997         var loc = [d3_event.clientX, d3_event.clientY];
70998         if (pointerIsValidFor(loc)) {
70999           var locInThis = utilFastMouse(this)(d3_event);
71000           dispatch14.call("doubleUp", this, d3_event, locInThis);
71001         }
71002         _pointer = void 0;
71003       }
71004     }
71005     function doubleUp(selection2) {
71006       if ("PointerEvent" in window) {
71007         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
71008       } else {
71009         selection2.on("dblclick.doubleUp", function(d3_event) {
71010           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
71011         });
71012       }
71013     }
71014     doubleUp.off = function(selection2) {
71015       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
71016     };
71017     return utilRebind(doubleUp, dispatch14, "on");
71018   }
71019   var init_double_up = __esm({
71020     "modules/util/double_up.js"() {
71021       "use strict";
71022       init_src4();
71023       init_util2();
71024       init_rebind();
71025       init_vector();
71026     }
71027   });
71028
71029   // modules/renderer/map.js
71030   var map_exports = {};
71031   __export(map_exports, {
71032     rendererMap: () => rendererMap
71033   });
71034   function rendererMap(context) {
71035     var dispatch14 = dispatch_default(
71036       "move",
71037       "drawn",
71038       "crossEditableZoom",
71039       "hitMinZoom",
71040       "changeHighlighting",
71041       "changeAreaFill"
71042     );
71043     var projection2 = context.projection;
71044     var curtainProjection = context.curtainProjection;
71045     var drawLayers;
71046     var drawPoints;
71047     var drawVertices;
71048     var drawLines;
71049     var drawAreas;
71050     var drawMidpoints;
71051     var drawLabels;
71052     var _selection = select_default2(null);
71053     var supersurface = select_default2(null);
71054     var wrapper = select_default2(null);
71055     var surface = select_default2(null);
71056     var _dimensions = [1, 1];
71057     var _dblClickZoomEnabled = true;
71058     var _redrawEnabled = true;
71059     var _gestureTransformStart;
71060     var _transformStart = projection2.transform();
71061     var _transformLast;
71062     var _isTransformed = false;
71063     var _minzoom = 0;
71064     var _getMouseCoords;
71065     var _lastPointerEvent;
71066     var _lastWithinEditableZoom;
71067     var _pointerDown = false;
71068     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
71069     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
71070     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
71071       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
71072     }).on("end.map", function() {
71073       _pointerDown = false;
71074     });
71075     var _doubleUpHandler = utilDoubleUp();
71076     var scheduleRedraw = throttle_default(redraw, 750);
71077     function cancelPendingRedraw() {
71078       scheduleRedraw.cancel();
71079     }
71080     function map2(selection2) {
71081       _selection = selection2;
71082       context.on("change.map", immediateRedraw);
71083       var osm = context.connection();
71084       if (osm) {
71085         osm.on("change.map", immediateRedraw);
71086       }
71087       function didUndoOrRedo(targetTransform) {
71088         var mode = context.mode().id;
71089         if (mode !== "browse" && mode !== "select") return;
71090         if (targetTransform) {
71091           map2.transformEase(targetTransform);
71092         }
71093       }
71094       context.history().on("merge.map", function() {
71095         scheduleRedraw();
71096       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
71097         didUndoOrRedo(fromStack.transform);
71098       }).on("redone.map", function(stack) {
71099         didUndoOrRedo(stack.transform);
71100       });
71101       context.background().on("change.map", immediateRedraw);
71102       context.features().on("redraw.map", immediateRedraw);
71103       drawLayers.on("change.map", function() {
71104         context.background().updateImagery();
71105         immediateRedraw();
71106       });
71107       selection2.on("wheel.map mousewheel.map", function(d3_event) {
71108         d3_event.preventDefault();
71109       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
71110       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
71111       wrapper = supersurface.append("div").attr("class", "layer layer-data");
71112       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
71113       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
71114         _lastPointerEvent = d3_event;
71115         if (d3_event.button === 2) {
71116           d3_event.stopPropagation();
71117         }
71118       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
71119         _lastPointerEvent = d3_event;
71120         if (resetTransform()) {
71121           immediateRedraw();
71122         }
71123       }).on(_pointerPrefix + "move.map", function(d3_event) {
71124         _lastPointerEvent = d3_event;
71125       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
71126         if (map2.editableDataEnabled() && !_isTransformed) {
71127           var hover = d3_event.target.__data__;
71128           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
71129           dispatch14.call("drawn", this, { full: false });
71130         }
71131       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
71132         if (map2.editableDataEnabled() && !_isTransformed) {
71133           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
71134           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
71135           dispatch14.call("drawn", this, { full: false });
71136         }
71137       });
71138       var detected = utilDetect();
71139       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
71140       // but we only need to do this on desktop Safari anyway. – #7694
71141       !detected.isMobileWebKit) {
71142         surface.on("gesturestart.surface", function(d3_event) {
71143           d3_event.preventDefault();
71144           _gestureTransformStart = projection2.transform();
71145         }).on("gesturechange.surface", gestureChange);
71146       }
71147       updateAreaFill();
71148       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
71149         if (!_dblClickZoomEnabled) return;
71150         if (typeof d3_event.target.__data__ === "object" && // or area fills
71151         !select_default2(d3_event.target).classed("fill")) return;
71152         var zoomOut2 = d3_event.shiftKey;
71153         var t2 = projection2.transform();
71154         var p1 = t2.invert(p02);
71155         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
71156         t2.x = p02[0] - p1[0] * t2.k;
71157         t2.y = p02[1] - p1[1] * t2.k;
71158         map2.transformEase(t2);
71159       });
71160       context.on("enter.map", function() {
71161         if (!map2.editableDataEnabled(
71162           true
71163           /* skip zoom check */
71164         )) return;
71165         if (_isTransformed) return;
71166         var graph = context.graph();
71167         var selectedAndParents = {};
71168         context.selectedIDs().forEach(function(id2) {
71169           var entity = graph.hasEntity(id2);
71170           if (entity) {
71171             selectedAndParents[entity.id] = entity;
71172             if (entity.type === "node") {
71173               graph.parentWays(entity).forEach(function(parent2) {
71174                 selectedAndParents[parent2.id] = parent2;
71175               });
71176             }
71177           }
71178         });
71179         var data = Object.values(selectedAndParents);
71180         var filter2 = function(d2) {
71181           return d2.id in selectedAndParents;
71182         };
71183         data = context.features().filter(data, graph);
71184         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
71185         dispatch14.call("drawn", this, { full: false });
71186         scheduleRedraw();
71187       });
71188       map2.dimensions(utilGetDimensions(selection2));
71189     }
71190     function zoomEventFilter(d3_event) {
71191       if (d3_event.type === "mousedown") {
71192         var hasOrphan = false;
71193         var listeners = window.__on;
71194         for (var i3 = 0; i3 < listeners.length; i3++) {
71195           var listener = listeners[i3];
71196           if (listener.name === "zoom" && listener.type === "mouseup") {
71197             hasOrphan = true;
71198             break;
71199           }
71200         }
71201         if (hasOrphan) {
71202           var event = window.CustomEvent;
71203           if (event) {
71204             event = new event("mouseup");
71205           } else {
71206             event = window.document.createEvent("Event");
71207             event.initEvent("mouseup", false, false);
71208           }
71209           event.view = window;
71210           window.dispatchEvent(event);
71211         }
71212       }
71213       return d3_event.button !== 2;
71214     }
71215     function pxCenter() {
71216       return [_dimensions[0] / 2, _dimensions[1] / 2];
71217     }
71218     function drawEditable(difference2, extent) {
71219       var mode = context.mode();
71220       var graph = context.graph();
71221       var features = context.features();
71222       var all = context.history().intersects(map2.extent());
71223       var fullRedraw = false;
71224       var data;
71225       var set4;
71226       var filter2;
71227       var applyFeatureLayerFilters = true;
71228       if (map2.isInWideSelection()) {
71229         data = [];
71230         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
71231           var entity = context.hasEntity(id2);
71232           if (entity) data.push(entity);
71233         });
71234         fullRedraw = true;
71235         filter2 = utilFunctor(true);
71236         applyFeatureLayerFilters = false;
71237       } else if (difference2) {
71238         var complete = difference2.complete(map2.extent());
71239         data = Object.values(complete).filter(Boolean);
71240         set4 = new Set(Object.keys(complete));
71241         filter2 = function(d2) {
71242           return set4.has(d2.id);
71243         };
71244         features.clear(data);
71245       } else {
71246         if (features.gatherStats(all, graph, _dimensions)) {
71247           extent = void 0;
71248         }
71249         if (extent) {
71250           data = context.history().intersects(map2.extent().intersection(extent));
71251           set4 = new Set(data.map(function(entity) {
71252             return entity.id;
71253           }));
71254           filter2 = function(d2) {
71255             return set4.has(d2.id);
71256           };
71257         } else {
71258           data = all;
71259           fullRedraw = true;
71260           filter2 = utilFunctor(true);
71261         }
71262       }
71263       if (applyFeatureLayerFilters) {
71264         data = features.filter(data, graph);
71265       } else {
71266         context.features().resetStats();
71267       }
71268       if (mode && mode.id === "select") {
71269         surface.call(drawVertices.drawSelected, graph, map2.extent());
71270       }
71271       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(drawPoints, graph, data, filter2).call(drawLabels, graph, data, filter2, _dimensions, fullRedraw);
71272       dispatch14.call("drawn", this, { full: true });
71273     }
71274     map2.init = function() {
71275       drawLayers = svgLayers(projection2, context);
71276       drawPoints = svgPoints(projection2, context);
71277       drawVertices = svgVertices(projection2, context);
71278       drawLines = svgLines(projection2, context);
71279       drawAreas = svgAreas(projection2, context);
71280       drawMidpoints = svgMidpoints(projection2, context);
71281       drawLabels = svgLabels(projection2, context);
71282     };
71283     function editOff() {
71284       context.features().resetStats();
71285       surface.selectAll(".layer-osm *").remove();
71286       surface.selectAll(".layer-touch:not(.markers) *").remove();
71287       var allowed = {
71288         "browse": true,
71289         "save": true,
71290         "select-note": true,
71291         "select-data": true,
71292         "select-error": true
71293       };
71294       var mode = context.mode();
71295       if (mode && !allowed[mode.id]) {
71296         context.enter(modeBrowse(context));
71297       }
71298       dispatch14.call("drawn", this, { full: true });
71299     }
71300     function gestureChange(d3_event) {
71301       var e3 = d3_event;
71302       e3.preventDefault();
71303       var props = {
71304         deltaMode: 0,
71305         // dummy values to ignore in zoomPan
71306         deltaY: 1,
71307         // dummy values to ignore in zoomPan
71308         clientX: e3.clientX,
71309         clientY: e3.clientY,
71310         screenX: e3.screenX,
71311         screenY: e3.screenY,
71312         x: e3.x,
71313         y: e3.y
71314       };
71315       var e22 = new WheelEvent("wheel", props);
71316       e22._scale = e3.scale;
71317       e22._rotation = e3.rotation;
71318       _selection.node().dispatchEvent(e22);
71319     }
71320     function zoomPan2(event, key, transform2) {
71321       var source = event && event.sourceEvent || event;
71322       var eventTransform = transform2 || event && event.transform;
71323       var x2 = eventTransform.x;
71324       var y2 = eventTransform.y;
71325       var k3 = eventTransform.k;
71326       if (source && source.type === "wheel") {
71327         if (_pointerDown) return;
71328         var detected = utilDetect();
71329         var dX = source.deltaX;
71330         var dY = source.deltaY;
71331         var x22 = x2;
71332         var y22 = y2;
71333         var k22 = k3;
71334         var t02, p02, p1;
71335         if (source.deltaMode === 1) {
71336           var lines = Math.abs(source.deltaY);
71337           var sign2 = source.deltaY > 0 ? 1 : -1;
71338           dY = sign2 * clamp_default(
71339             lines * 18.001,
71340             4.000244140625,
71341             // min
71342             350.000244140625
71343             // max
71344           );
71345           t02 = _isTransformed ? _transformLast : _transformStart;
71346           p02 = _getMouseCoords(source);
71347           p1 = t02.invert(p02);
71348           k22 = t02.k * Math.pow(2, -dY / 500);
71349           k22 = clamp_default(k22, kMin, kMax);
71350           x22 = p02[0] - p1[0] * k22;
71351           y22 = p02[1] - p1[1] * k22;
71352         } else if (source._scale) {
71353           t02 = _gestureTransformStart;
71354           p02 = _getMouseCoords(source);
71355           p1 = t02.invert(p02);
71356           k22 = t02.k * source._scale;
71357           k22 = clamp_default(k22, kMin, kMax);
71358           x22 = p02[0] - p1[0] * k22;
71359           y22 = p02[1] - p1[1] * k22;
71360         } else if (source.ctrlKey && !isInteger(dY)) {
71361           dY *= 6;
71362           t02 = _isTransformed ? _transformLast : _transformStart;
71363           p02 = _getMouseCoords(source);
71364           p1 = t02.invert(p02);
71365           k22 = t02.k * Math.pow(2, -dY / 500);
71366           k22 = clamp_default(k22, kMin, kMax);
71367           x22 = p02[0] - p1[0] * k22;
71368           y22 = p02[1] - p1[1] * k22;
71369         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
71370           t02 = _isTransformed ? _transformLast : _transformStart;
71371           p02 = _getMouseCoords(source);
71372           p1 = t02.invert(p02);
71373           k22 = t02.k * Math.pow(2, -dY / 500);
71374           k22 = clamp_default(k22, kMin, kMax);
71375           x22 = p02[0] - p1[0] * k22;
71376           y22 = p02[1] - p1[1] * k22;
71377         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
71378           p1 = projection2.translate();
71379           x22 = p1[0] - dX;
71380           y22 = p1[1] - dY;
71381           k22 = projection2.scale();
71382           k22 = clamp_default(k22, kMin, kMax);
71383         }
71384         if (x22 !== x2 || y22 !== y2 || k22 !== k3) {
71385           x2 = x22;
71386           y2 = y22;
71387           k3 = k22;
71388           eventTransform = identity2.translate(x22, y22).scale(k22);
71389           if (_zoomerPanner._transform) {
71390             _zoomerPanner._transform(eventTransform);
71391           } else {
71392             _selection.node().__zoom = eventTransform;
71393           }
71394         }
71395       }
71396       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k3) {
71397         return;
71398       }
71399       if (geoScaleToZoom(k3, TILESIZE) < _minzoom) {
71400         surface.interrupt();
71401         dispatch14.call("hitMinZoom", this, map2);
71402         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
71403         scheduleRedraw();
71404         dispatch14.call("move", this, map2);
71405         return;
71406       }
71407       projection2.transform(eventTransform);
71408       var withinEditableZoom = map2.withinEditableZoom();
71409       if (_lastWithinEditableZoom !== withinEditableZoom) {
71410         if (_lastWithinEditableZoom !== void 0) {
71411           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
71412         }
71413         _lastWithinEditableZoom = withinEditableZoom;
71414       }
71415       var scale = k3 / _transformStart.k;
71416       var tX = (x2 / scale - _transformStart.x) * scale;
71417       var tY = (y2 / scale - _transformStart.y) * scale;
71418       if (context.inIntro()) {
71419         curtainProjection.transform({
71420           x: x2 - tX,
71421           y: y2 - tY,
71422           k: k3
71423         });
71424       }
71425       if (source) {
71426         _lastPointerEvent = event;
71427       }
71428       _isTransformed = true;
71429       _transformLast = eventTransform;
71430       utilSetTransform(supersurface, tX, tY, scale);
71431       scheduleRedraw();
71432       dispatch14.call("move", this, map2);
71433       function isInteger(val) {
71434         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
71435       }
71436     }
71437     function resetTransform() {
71438       if (!_isTransformed) return false;
71439       utilSetTransform(supersurface, 0, 0);
71440       _isTransformed = false;
71441       if (context.inIntro()) {
71442         curtainProjection.transform(projection2.transform());
71443       }
71444       return true;
71445     }
71446     function redraw(difference2, extent) {
71447       if (typeof window === "undefined") return;
71448       if (surface.empty() || !_redrawEnabled) return;
71449       if (resetTransform()) {
71450         difference2 = extent = void 0;
71451       }
71452       var zoom = map2.zoom();
71453       var z3 = String(~~zoom);
71454       if (surface.attr("data-zoom") !== z3) {
71455         surface.attr("data-zoom", z3);
71456       }
71457       var lat = map2.center()[1];
71458       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
71459       surface.classed("low-zoom", zoom <= lowzoom(lat));
71460       if (!difference2) {
71461         supersurface.call(context.background());
71462         wrapper.call(drawLayers);
71463       }
71464       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
71465         context.loadTiles(projection2);
71466         drawEditable(difference2, extent);
71467       } else {
71468         editOff();
71469       }
71470       _transformStart = projection2.transform();
71471       return map2;
71472     }
71473     var immediateRedraw = function(difference2, extent) {
71474       if (!difference2 && !extent) cancelPendingRedraw();
71475       redraw(difference2, extent);
71476     };
71477     map2.lastPointerEvent = function() {
71478       return _lastPointerEvent;
71479     };
71480     map2.mouse = function(d3_event) {
71481       var event = d3_event || _lastPointerEvent;
71482       if (event) {
71483         var s2;
71484         while (s2 = event.sourceEvent) {
71485           event = s2;
71486         }
71487         return _getMouseCoords(event);
71488       }
71489       return null;
71490     };
71491     map2.mouseCoordinates = function() {
71492       var coord2 = map2.mouse() || pxCenter();
71493       return projection2.invert(coord2);
71494     };
71495     map2.dblclickZoomEnable = function(val) {
71496       if (!arguments.length) return _dblClickZoomEnabled;
71497       _dblClickZoomEnabled = val;
71498       return map2;
71499     };
71500     map2.redrawEnable = function(val) {
71501       if (!arguments.length) return _redrawEnabled;
71502       _redrawEnabled = val;
71503       return map2;
71504     };
71505     map2.isTransformed = function() {
71506       return _isTransformed;
71507     };
71508     function setTransform(t2, duration, force) {
71509       var t3 = projection2.transform();
71510       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y) return false;
71511       if (duration) {
71512         _selection.transition().duration(duration).on("start", function() {
71513           map2.startEase();
71514         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
71515       } else {
71516         projection2.transform(t2);
71517         _transformStart = t2;
71518         _selection.call(_zoomerPanner.transform, _transformStart);
71519       }
71520       return true;
71521     }
71522     function setCenterZoom(loc2, z22, duration, force) {
71523       var c2 = map2.center();
71524       var z3 = map2.zoom();
71525       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z22 === z3 && !force) return false;
71526       var proj = geoRawMercator().transform(projection2.transform());
71527       var k22 = clamp_default(geoZoomToScale(z22, TILESIZE), kMin, kMax);
71528       proj.scale(k22);
71529       var t2 = proj.translate();
71530       var point = proj(loc2);
71531       var center = pxCenter();
71532       t2[0] += center[0] - point[0];
71533       t2[1] += center[1] - point[1];
71534       return setTransform(identity2.translate(t2[0], t2[1]).scale(k22), duration, force);
71535     }
71536     map2.pan = function(delta, duration) {
71537       var t2 = projection2.translate();
71538       var k3 = projection2.scale();
71539       t2[0] += delta[0];
71540       t2[1] += delta[1];
71541       if (duration) {
71542         _selection.transition().duration(duration).on("start", function() {
71543           map2.startEase();
71544         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k3));
71545       } else {
71546         projection2.translate(t2);
71547         _transformStart = projection2.transform();
71548         _selection.call(_zoomerPanner.transform, _transformStart);
71549         dispatch14.call("move", this, map2);
71550         immediateRedraw();
71551       }
71552       return map2;
71553     };
71554     map2.dimensions = function(val) {
71555       if (!arguments.length) return _dimensions;
71556       _dimensions = val;
71557       drawLayers.dimensions(_dimensions);
71558       context.background().dimensions(_dimensions);
71559       projection2.clipExtent([[0, 0], _dimensions]);
71560       _getMouseCoords = utilFastMouse(supersurface.node());
71561       scheduleRedraw();
71562       return map2;
71563     };
71564     function zoomIn(delta) {
71565       setCenterZoom(map2.center(), Math.trunc(map2.zoom() + 0.45) + delta, 150, true);
71566     }
71567     function zoomOut(delta) {
71568       setCenterZoom(map2.center(), Math.ceil(map2.zoom() - 0.45) - delta, 150, true);
71569     }
71570     map2.zoomIn = function() {
71571       zoomIn(1);
71572     };
71573     map2.zoomInFurther = function() {
71574       zoomIn(4);
71575     };
71576     map2.canZoomIn = function() {
71577       return map2.zoom() < maxZoom;
71578     };
71579     map2.zoomOut = function() {
71580       zoomOut(1);
71581     };
71582     map2.zoomOutFurther = function() {
71583       zoomOut(4);
71584     };
71585     map2.canZoomOut = function() {
71586       return map2.zoom() > minZoom4;
71587     };
71588     map2.center = function(loc2) {
71589       if (!arguments.length) {
71590         return projection2.invert(pxCenter());
71591       }
71592       if (setCenterZoom(loc2, map2.zoom())) {
71593         dispatch14.call("move", this, map2);
71594       }
71595       scheduleRedraw();
71596       return map2;
71597     };
71598     map2.unobscuredCenterZoomEase = function(loc, zoom) {
71599       var offset = map2.unobscuredOffsetPx();
71600       var proj = geoRawMercator().transform(projection2.transform());
71601       proj.scale(geoZoomToScale(zoom, TILESIZE));
71602       var locPx = proj(loc);
71603       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
71604       var offsetLoc = proj.invert(offsetLocPx);
71605       map2.centerZoomEase(offsetLoc, zoom);
71606     };
71607     map2.unobscuredOffsetPx = function() {
71608       var openPane = context.container().select(".map-panes .map-pane.shown");
71609       if (!openPane.empty()) {
71610         return [openPane.node().offsetWidth / 2, 0];
71611       }
71612       return [0, 0];
71613     };
71614     map2.zoom = function(z22) {
71615       if (!arguments.length) {
71616         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
71617       }
71618       if (z22 < _minzoom) {
71619         surface.interrupt();
71620         dispatch14.call("hitMinZoom", this, map2);
71621         z22 = context.minEditableZoom();
71622       }
71623       if (setCenterZoom(map2.center(), z22)) {
71624         dispatch14.call("move", this, map2);
71625       }
71626       scheduleRedraw();
71627       return map2;
71628     };
71629     map2.centerZoom = function(loc2, z22) {
71630       if (setCenterZoom(loc2, z22)) {
71631         dispatch14.call("move", this, map2);
71632       }
71633       scheduleRedraw();
71634       return map2;
71635     };
71636     map2.zoomTo = function(entities) {
71637       if (!isArray_default(entities)) {
71638         entities = [entities];
71639       }
71640       if (entities.length === 0) return map2;
71641       var extent = entities.map((entity) => entity.extent(context.graph())).reduce((a4, b3) => a4.extend(b3));
71642       if (!isFinite(extent.area())) return map2;
71643       var z22 = clamp_default(map2.trimmedExtentZoom(extent), 0, 20);
71644       return map2.centerZoom(extent.center(), z22);
71645     };
71646     map2.centerEase = function(loc2, duration) {
71647       duration = duration || 250;
71648       setCenterZoom(loc2, map2.zoom(), duration);
71649       return map2;
71650     };
71651     map2.zoomEase = function(z22, duration) {
71652       duration = duration || 250;
71653       setCenterZoom(map2.center(), z22, duration, false);
71654       return map2;
71655     };
71656     map2.centerZoomEase = function(loc2, z22, duration) {
71657       duration = duration || 250;
71658       setCenterZoom(loc2, z22, duration, false);
71659       return map2;
71660     };
71661     map2.transformEase = function(t2, duration) {
71662       duration = duration || 250;
71663       setTransform(
71664         t2,
71665         duration,
71666         false
71667         /* don't force */
71668       );
71669       return map2;
71670     };
71671     map2.zoomToEase = function(obj, duration) {
71672       var extent;
71673       if (Array.isArray(obj)) {
71674         obj.forEach(function(entity) {
71675           var entityExtent = entity.extent(context.graph());
71676           if (!extent) {
71677             extent = entityExtent;
71678           } else {
71679             extent = extent.extend(entityExtent);
71680           }
71681         });
71682       } else {
71683         extent = obj.extent(context.graph());
71684       }
71685       if (!isFinite(extent.area())) return map2;
71686       var z22 = clamp_default(map2.trimmedExtentZoom(extent), 0, 20);
71687       return map2.centerZoomEase(extent.center(), z22, duration);
71688     };
71689     map2.startEase = function() {
71690       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
71691         map2.cancelEase();
71692       });
71693       return map2;
71694     };
71695     map2.cancelEase = function() {
71696       _selection.interrupt();
71697       return map2;
71698     };
71699     map2.extent = function(val) {
71700       if (!arguments.length) {
71701         return new geoExtent(
71702           projection2.invert([0, _dimensions[1]]),
71703           projection2.invert([_dimensions[0], 0])
71704         );
71705       } else {
71706         var extent = geoExtent(val);
71707         map2.centerZoom(extent.center(), map2.extentZoom(extent));
71708       }
71709     };
71710     map2.trimmedExtent = function(val) {
71711       if (!arguments.length) {
71712         var headerY = 71;
71713         var footerY = 30;
71714         var pad3 = 10;
71715         return new geoExtent(
71716           projection2.invert([pad3, _dimensions[1] - footerY - pad3]),
71717           projection2.invert([_dimensions[0] - pad3, headerY + pad3])
71718         );
71719       } else {
71720         var extent = geoExtent(val);
71721         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
71722       }
71723     };
71724     function calcExtentZoom(extent, dim) {
71725       var tl = projection2([extent[0][0], extent[1][1]]);
71726       var br = projection2([extent[1][0], extent[0][1]]);
71727       var hFactor = (br[0] - tl[0]) / dim[0];
71728       var vFactor = (br[1] - tl[1]) / dim[1];
71729       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
71730       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
71731       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
71732       return newZoom;
71733     }
71734     map2.extentZoom = function(val) {
71735       return calcExtentZoom(geoExtent(val), _dimensions);
71736     };
71737     map2.trimmedExtentZoom = function(val) {
71738       var trimY = 120;
71739       var trimX = 40;
71740       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
71741       return calcExtentZoom(geoExtent(val), trimmed);
71742     };
71743     map2.withinEditableZoom = function() {
71744       return map2.zoom() >= context.minEditableZoom();
71745     };
71746     map2.isInWideSelection = function() {
71747       return !map2.withinEditableZoom() && context.selectedIDs().length;
71748     };
71749     map2.editableDataEnabled = function(skipZoomCheck) {
71750       var layer = context.layers().layer("osm");
71751       if (!layer || !layer.enabled()) return false;
71752       return skipZoomCheck || map2.withinEditableZoom();
71753     };
71754     map2.notesEditable = function() {
71755       var layer = context.layers().layer("notes");
71756       if (!layer || !layer.enabled()) return false;
71757       return map2.withinEditableZoom();
71758     };
71759     map2.minzoom = function(val) {
71760       if (!arguments.length) return _minzoom;
71761       _minzoom = val;
71762       return map2;
71763     };
71764     map2.toggleHighlightEdited = function() {
71765       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
71766       map2.pan([0, 0]);
71767       dispatch14.call("changeHighlighting", this);
71768     };
71769     map2.areaFillOptions = ["wireframe", "partial", "full"];
71770     map2.activeAreaFill = function(val) {
71771       if (!arguments.length) return corePreferences("area-fill") || "partial";
71772       corePreferences("area-fill", val);
71773       if (val !== "wireframe") {
71774         corePreferences("area-fill-toggle", val);
71775       }
71776       updateAreaFill();
71777       map2.pan([0, 0]);
71778       dispatch14.call("changeAreaFill", this);
71779       return map2;
71780     };
71781     map2.toggleWireframe = function() {
71782       var activeFill = map2.activeAreaFill();
71783       if (activeFill === "wireframe") {
71784         activeFill = corePreferences("area-fill-toggle") || "partial";
71785       } else {
71786         activeFill = "wireframe";
71787       }
71788       map2.activeAreaFill(activeFill);
71789     };
71790     function updateAreaFill() {
71791       var activeFill = map2.activeAreaFill();
71792       map2.areaFillOptions.forEach(function(opt) {
71793         surface.classed("fill-" + opt, Boolean(opt === activeFill));
71794       });
71795     }
71796     map2.layers = () => drawLayers;
71797     map2.doubleUpHandler = function() {
71798       return _doubleUpHandler;
71799     };
71800     return utilRebind(map2, dispatch14, "on");
71801   }
71802   var TILESIZE, minZoom4, maxZoom, kMin, kMax;
71803   var init_map = __esm({
71804     "modules/renderer/map.js"() {
71805       "use strict";
71806       init_throttle();
71807       init_src4();
71808       init_src8();
71809       init_src16();
71810       init_src5();
71811       init_src12();
71812       init_preferences();
71813       init_geo2();
71814       init_browse();
71815       init_svg();
71816       init_util2();
71817       init_bind_once();
71818       init_detect();
71819       init_dimensions();
71820       init_rebind();
71821       init_zoom_pan();
71822       init_double_up();
71823       init_lodash();
71824       TILESIZE = 256;
71825       minZoom4 = 2;
71826       maxZoom = 24;
71827       kMin = geoZoomToScale(minZoom4, TILESIZE);
71828       kMax = geoZoomToScale(maxZoom, TILESIZE);
71829     }
71830   });
71831
71832   // modules/renderer/photos.js
71833   var photos_exports = {};
71834   __export(photos_exports, {
71835     rendererPhotos: () => rendererPhotos
71836   });
71837   function rendererPhotos(context) {
71838     var dispatch14 = dispatch_default("change");
71839     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
71840     var _allPhotoTypes = ["flat", "panoramic"];
71841     var _shownPhotoTypes = _allPhotoTypes.slice();
71842     var _dateFilters = ["fromDate", "toDate"];
71843     var _fromDate;
71844     var _toDate;
71845     var _usernames;
71846     function photos() {
71847     }
71848     function updateStorage() {
71849       var hash2 = utilStringQs(window.location.hash);
71850       var enabled = context.layers().all().filter(function(d2) {
71851         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
71852       }).map(function(d2) {
71853         return d2.id;
71854       });
71855       if (enabled.length) {
71856         hash2.photo_overlay = enabled.join(",");
71857       } else {
71858         delete hash2.photo_overlay;
71859       }
71860       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
71861     }
71862     photos.overlayLayerIDs = function() {
71863       return _layerIDs;
71864     };
71865     photos.allPhotoTypes = function() {
71866       return _allPhotoTypes;
71867     };
71868     photos.dateFilters = function() {
71869       return _dateFilters;
71870     };
71871     photos.dateFilterValue = function(val) {
71872       return val === _dateFilters[0] ? _fromDate : _toDate;
71873     };
71874     photos.setDateFilter = function(type2, val, updateUrl) {
71875       var date = val && new Date(val);
71876       if (date && !isNaN(date)) {
71877         val = date.toISOString().slice(0, 10);
71878       } else {
71879         val = null;
71880       }
71881       if (type2 === _dateFilters[0]) {
71882         _fromDate = val;
71883         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
71884           _toDate = _fromDate;
71885         }
71886       }
71887       if (type2 === _dateFilters[1]) {
71888         _toDate = val;
71889         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
71890           _fromDate = _toDate;
71891         }
71892       }
71893       dispatch14.call("change", this);
71894       if (updateUrl) {
71895         var rangeString;
71896         if (_fromDate || _toDate) {
71897           rangeString = (_fromDate || "") + "_" + (_toDate || "");
71898         }
71899         setUrlFilterValue("photo_dates", rangeString);
71900       }
71901     };
71902     photos.setUsernameFilter = function(val, updateUrl) {
71903       if (val && typeof val === "string") val = val.replace(/;/g, ",").split(",");
71904       if (val) {
71905         val = val.map((d2) => d2.trim()).filter(Boolean);
71906         if (!val.length) {
71907           val = null;
71908         }
71909       }
71910       _usernames = val;
71911       dispatch14.call("change", this);
71912       if (updateUrl) {
71913         var hashString;
71914         if (_usernames) {
71915           hashString = _usernames.join(",");
71916         }
71917         setUrlFilterValue("photo_username", hashString);
71918       }
71919     };
71920     photos.togglePhotoType = function(val, updateUrl) {
71921       var index = _shownPhotoTypes.indexOf(val);
71922       if (index !== -1) {
71923         _shownPhotoTypes.splice(index, 1);
71924       } else {
71925         _shownPhotoTypes.push(val);
71926       }
71927       if (updateUrl) {
71928         var hashString;
71929         if (_shownPhotoTypes) {
71930           hashString = _shownPhotoTypes.join(",");
71931         }
71932         setUrlFilterValue("photo_type", hashString);
71933       }
71934       dispatch14.call("change", this);
71935       return photos;
71936     };
71937     function setUrlFilterValue(property, val) {
71938       const hash2 = utilStringQs(window.location.hash);
71939       if (val) {
71940         if (hash2[property] === val) return;
71941         hash2[property] = val;
71942       } else {
71943         if (!(property in hash2)) return;
71944         delete hash2[property];
71945       }
71946       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
71947     }
71948     function showsLayer(id2) {
71949       var layer = context.layers().layer(id2);
71950       return layer && layer.supported() && layer.enabled();
71951     }
71952     photos.shouldFilterDateBySlider = function() {
71953       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("mapilio") || showsLayer("streetside") || showsLayer("vegbilder") || showsLayer("panoramax");
71954     };
71955     photos.shouldFilterByPhotoType = function() {
71956       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder") || showsLayer("panoramax");
71957     };
71958     photos.shouldFilterByUsername = function() {
71959       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside") || showsLayer("panoramax");
71960     };
71961     photos.showsPhotoType = function(val) {
71962       if (!photos.shouldFilterByPhotoType()) return true;
71963       return _shownPhotoTypes.indexOf(val) !== -1;
71964     };
71965     photos.showsFlat = function() {
71966       return photos.showsPhotoType("flat");
71967     };
71968     photos.showsPanoramic = function() {
71969       return photos.showsPhotoType("panoramic");
71970     };
71971     photos.fromDate = function() {
71972       return _fromDate;
71973     };
71974     photos.toDate = function() {
71975       return _toDate;
71976     };
71977     photos.usernames = function() {
71978       return _usernames;
71979     };
71980     photos.init = function() {
71981       var hash2 = utilStringQs(window.location.hash);
71982       var parts;
71983       if (hash2.photo_dates) {
71984         parts = /^(.*)[–_](.*)$/g.exec(hash2.photo_dates.trim());
71985         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
71986         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
71987       }
71988       if (hash2.photo_username) {
71989         this.setUsernameFilter(hash2.photo_username, false);
71990       }
71991       if (hash2.photo_type) {
71992         parts = hash2.photo_type.replace(/;/g, ",").split(",");
71993         _allPhotoTypes.forEach((d2) => {
71994           if (!parts.includes(d2)) this.togglePhotoType(d2, false);
71995         });
71996       }
71997       if (hash2.photo_overlay) {
71998         var hashOverlayIDs = hash2.photo_overlay.replace(/;/g, ",").split(",");
71999         hashOverlayIDs.forEach(function(id2) {
72000           if (id2 === "openstreetcam") id2 = "kartaview";
72001           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
72002           if (layer2 && !layer2.enabled()) layer2.enabled(true);
72003         });
72004       }
72005       if (hash2.photo) {
72006         var photoIds = hash2.photo.replace(/;/g, ",").split(",");
72007         var photoId = photoIds.length && photoIds[0].trim();
72008         var results = /(.*)\/(.*)/g.exec(photoId);
72009         if (results && results.length >= 3) {
72010           var serviceId = results[1];
72011           if (serviceId === "openstreetcam") serviceId = "kartaview";
72012           var photoKey = results[2];
72013           var service = services[serviceId];
72014           if (service && service.ensureViewerLoaded) {
72015             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
72016             if (layer && !layer.enabled()) layer.enabled(true);
72017             var baselineTime = Date.now();
72018             service.on("loadedImages.rendererPhotos", function() {
72019               if (Date.now() - baselineTime > 45e3) {
72020                 service.on("loadedImages.rendererPhotos", null);
72021                 return;
72022               }
72023               if (!service.cachedImage(photoKey)) return;
72024               service.on("loadedImages.rendererPhotos", null);
72025               service.ensureViewerLoaded(context).then(function() {
72026                 service.selectImage(context, photoKey).showViewer(context);
72027               });
72028             });
72029           }
72030         }
72031       }
72032       context.layers().on("change.rendererPhotos", updateStorage);
72033     };
72034     return utilRebind(photos, dispatch14, "on");
72035   }
72036   var init_photos = __esm({
72037     "modules/renderer/photos.js"() {
72038       "use strict";
72039       init_src4();
72040       init_services();
72041       init_rebind();
72042       init_util();
72043     }
72044   });
72045
72046   // modules/renderer/index.js
72047   var renderer_exports = {};
72048   __export(renderer_exports, {
72049     rendererBackground: () => rendererBackground,
72050     rendererBackgroundSource: () => rendererBackgroundSource,
72051     rendererFeatures: () => rendererFeatures,
72052     rendererMap: () => rendererMap,
72053     rendererPhotos: () => rendererPhotos,
72054     rendererTileLayer: () => rendererTileLayer
72055   });
72056   var init_renderer = __esm({
72057     "modules/renderer/index.js"() {
72058       "use strict";
72059       init_background_source();
72060       init_background2();
72061       init_features();
72062       init_map();
72063       init_photos();
72064       init_tile_layer();
72065     }
72066   });
72067
72068   // modules/ui/map_in_map.js
72069   var map_in_map_exports = {};
72070   __export(map_in_map_exports, {
72071     uiMapInMap: () => uiMapInMap
72072   });
72073   function uiMapInMap(context) {
72074     function mapInMap(selection2) {
72075       var backgroundLayer = rendererTileLayer(context).underzoom(2);
72076       var overlayLayers = {};
72077       var projection2 = geoRawMercator();
72078       var dataLayer = svgData(projection2, context).showLabels(false);
72079       var debugLayer = svgDebug(projection2, context);
72080       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
72081       var wrap2 = select_default2(null);
72082       var tiles = select_default2(null);
72083       var viewport = select_default2(null);
72084       var _isTransformed = false;
72085       var _isHidden = true;
72086       var _skipEvents = false;
72087       var _gesture = null;
72088       var _zDiff = 6;
72089       var _dMini;
72090       var _cMini;
72091       var _tStart;
72092       var _tCurr;
72093       var _timeoutID;
72094       function zoomStarted() {
72095         if (_skipEvents) return;
72096         _tStart = _tCurr = projection2.transform();
72097         _gesture = null;
72098       }
72099       function zoomed(d3_event) {
72100         if (_skipEvents) return;
72101         var x2 = d3_event.transform.x;
72102         var y2 = d3_event.transform.y;
72103         var k3 = d3_event.transform.k;
72104         var isZooming = k3 !== _tStart.k;
72105         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
72106         if (!isZooming && !isPanning) {
72107           return;
72108         }
72109         if (!_gesture) {
72110           _gesture = isZooming ? "zoom" : "pan";
72111         }
72112         var tMini = projection2.transform();
72113         var tX, tY, scale;
72114         if (_gesture === "zoom") {
72115           scale = k3 / tMini.k;
72116           tX = (_cMini[0] / scale - _cMini[0]) * scale;
72117           tY = (_cMini[1] / scale - _cMini[1]) * scale;
72118         } else {
72119           k3 = tMini.k;
72120           scale = 1;
72121           tX = x2 - tMini.x;
72122           tY = y2 - tMini.y;
72123         }
72124         utilSetTransform(tiles, tX, tY, scale);
72125         utilSetTransform(viewport, 0, 0, scale);
72126         _isTransformed = true;
72127         _tCurr = identity2.translate(x2, y2).scale(k3);
72128         var zMain = geoScaleToZoom(context.projection.scale());
72129         var zMini = geoScaleToZoom(k3);
72130         _zDiff = zMain - zMini;
72131         queueRedraw();
72132       }
72133       function zoomEnded() {
72134         if (_skipEvents) return;
72135         if (_gesture !== "pan") return;
72136         updateProjection();
72137         _gesture = null;
72138         context.map().center(projection2.invert(_cMini));
72139       }
72140       function updateProjection() {
72141         var loc = context.map().center();
72142         var tMain = context.projection.transform();
72143         var zMain = geoScaleToZoom(tMain.k);
72144         var zMini = Math.max(zMain - _zDiff, 0.5);
72145         var kMini = geoZoomToScale(zMini);
72146         projection2.translate([tMain.x, tMain.y]).scale(kMini);
72147         var point = projection2(loc);
72148         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
72149         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
72150         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
72151         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
72152         _tCurr = projection2.transform();
72153         if (_isTransformed) {
72154           utilSetTransform(tiles, 0, 0);
72155           utilSetTransform(viewport, 0, 0);
72156           _isTransformed = false;
72157         }
72158         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
72159         _skipEvents = true;
72160         wrap2.call(zoom.transform, _tCurr);
72161         _skipEvents = false;
72162       }
72163       function redraw() {
72164         clearTimeout(_timeoutID);
72165         if (_isHidden) return;
72166         updateProjection();
72167         var zMini = geoScaleToZoom(projection2.scale());
72168         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
72169         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
72170         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
72171         var background = tiles.selectAll(".map-in-map-background").data([0]);
72172         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
72173         var overlaySources = context.background().overlayLayerSources();
72174         var activeOverlayLayers = [];
72175         for (var i3 = 0; i3 < overlaySources.length; i3++) {
72176           if (overlaySources[i3].validZoom(zMini)) {
72177             if (!overlayLayers[i3]) overlayLayers[i3] = rendererTileLayer(context);
72178             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
72179           }
72180         }
72181         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
72182         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
72183         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
72184           return d2.source().name();
72185         });
72186         overlays.exit().remove();
72187         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
72188           select_default2(this).call(layer);
72189         });
72190         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
72191         dataLayers.exit().remove();
72192         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
72193         if (_gesture !== "pan") {
72194           var getPath = path_default(projection2);
72195           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
72196           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
72197           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
72198           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
72199           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
72200             return getPath.area(d2) < 30;
72201           });
72202         }
72203       }
72204       function queueRedraw() {
72205         clearTimeout(_timeoutID);
72206         _timeoutID = setTimeout(function() {
72207           redraw();
72208         }, 750);
72209       }
72210       function toggle(d3_event) {
72211         if (d3_event) d3_event.preventDefault();
72212         _isHidden = !_isHidden;
72213         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
72214         if (_isHidden) {
72215           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
72216             selection2.selectAll(".map-in-map").style("display", "none");
72217           });
72218         } else {
72219           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
72220             redraw();
72221           });
72222         }
72223       }
72224       uiMapInMap.toggle = toggle;
72225       wrap2 = selection2.selectAll(".map-in-map").data([0]);
72226       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
72227       _dMini = [200, 150];
72228       _cMini = geoVecScale(_dMini, 0.5);
72229       context.map().on("drawn.map-in-map", function(drawn) {
72230         if (drawn.full === true) {
72231           redraw();
72232         }
72233       });
72234       redraw();
72235       context.keybinding().on(_t("background.minimap.key"), toggle);
72236     }
72237     return mapInMap;
72238   }
72239   var init_map_in_map = __esm({
72240     "modules/ui/map_in_map.js"() {
72241       "use strict";
72242       init_src2();
72243       init_src5();
72244       init_src12();
72245       init_localizer();
72246       init_geo2();
72247       init_renderer();
72248       init_svg();
72249       init_util();
72250     }
72251   });
72252
72253   // modules/ui/notice.js
72254   var notice_exports = {};
72255   __export(notice_exports, {
72256     uiNotice: () => uiNotice
72257   });
72258   function uiNotice(context) {
72259     return function(selection2) {
72260       var div = selection2.append("div").attr("class", "notice");
72261       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
72262         context.map().zoomEase(context.minEditableZoom());
72263       }).on("wheel", function(d3_event) {
72264         var e22 = new WheelEvent(d3_event.type, d3_event);
72265         context.surface().node().dispatchEvent(e22);
72266       });
72267       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
72268       function disableTooHigh() {
72269         var canEdit = context.map().zoom() >= context.minEditableZoom();
72270         div.style("display", canEdit ? "none" : "block");
72271       }
72272       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
72273       disableTooHigh();
72274     };
72275   }
72276   var init_notice = __esm({
72277     "modules/ui/notice.js"() {
72278       "use strict";
72279       init_debounce();
72280       init_localizer();
72281       init_svg();
72282     }
72283   });
72284
72285   // modules/ui/photoviewer.js
72286   var photoviewer_exports = {};
72287   __export(photoviewer_exports, {
72288     uiPhotoviewer: () => uiPhotoviewer
72289   });
72290   function uiPhotoviewer(context) {
72291     var dispatch14 = dispatch_default("resize");
72292     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72293     const addPhotoIdButton = /* @__PURE__ */ new Set(["mapillary", "panoramax"]);
72294     function photoviewer(selection2) {
72295       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
72296         for (const service of Object.values(services)) {
72297           if (typeof service.hideViewer === "function") {
72298             service.hideViewer(context);
72299           }
72300         }
72301       }).append("div").call(svgIcon("#iD-icon-close"));
72302       function preventDefault(d3_event) {
72303         d3_event.preventDefault();
72304       }
72305       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
72306         _pointerPrefix + "down",
72307         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
72308       );
72309       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
72310         _pointerPrefix + "down",
72311         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
72312       );
72313       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
72314         _pointerPrefix + "down",
72315         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
72316       );
72317       context.features().on("change.setPhotoFromViewer", function() {
72318         setPhotoTagButton();
72319       });
72320       context.history().on("change.setPhotoFromViewer", function() {
72321         setPhotoTagButton();
72322       });
72323       function setPhotoTagButton() {
72324         const service = getServiceId();
72325         const isActiveForService = addPhotoIdButton.has(service) && services[service].isViewerOpen() && layerEnabled(service) && context.mode().id === "select";
72326         renderAddPhotoIdButton(service, isActiveForService);
72327         function layerEnabled(which) {
72328           const layers = context.layers();
72329           const layer = layers.layer(which);
72330           return layer.enabled();
72331         }
72332         function getServiceId() {
72333           for (const serviceId in services) {
72334             const service2 = services[serviceId];
72335             if (typeof service2.isViewerOpen === "function") {
72336               if (service2.isViewerOpen()) {
72337                 return serviceId;
72338               }
72339             }
72340           }
72341           return false;
72342         }
72343         function renderAddPhotoIdButton(service2, shouldDisplay) {
72344           const button = selection2.selectAll(".set-photo-from-viewer").data(shouldDisplay ? [0] : []);
72345           button.exit().remove();
72346           const buttonEnter = button.enter().append("button").attr("class", "set-photo-from-viewer").call(svgIcon("#fas-eye-dropper")).call(
72347             uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
72348           );
72349           buttonEnter.select(".tooltip").classed("dark", true).style("width", "300px").merge(button).on("click", function(e3) {
72350             e3.preventDefault();
72351             e3.stopPropagation();
72352             const activeServiceId = getServiceId();
72353             const image = services[activeServiceId].getActiveImage();
72354             const action = (graph2) => context.selectedIDs().reduce((graph3, entityID) => {
72355               const tags = graph3.entity(entityID).tags;
72356               const action2 = actionChangeTags(entityID, { ...tags, [activeServiceId]: image.id });
72357               return action2(graph3);
72358             }, graph2);
72359             const annotation = _t("operations.change_tags.annotation");
72360             context.perform(action, annotation);
72361             buttonDisable("already_set");
72362           });
72363           if (service2 === "panoramax") {
72364             const panoramaxControls = selection2.select(".panoramax-wrapper .pnlm-zoom-controls.pnlm-controls");
72365             panoramaxControls.style("margin-top", shouldDisplay ? "36px" : "6px");
72366           }
72367           if (!shouldDisplay) return;
72368           const activeImage = services[service2].getActiveImage();
72369           const graph = context.graph();
72370           const entities = context.selectedIDs().map((id2) => graph.hasEntity(id2)).filter(Boolean);
72371           if (entities.map((entity) => entity.tags[service2]).every((value) => value === (activeImage == null ? void 0 : activeImage.id))) {
72372             buttonDisable("already_set");
72373           } else if (activeImage && entities.map((entity) => entity.extent(context.graph()).center()).every((loc) => geoSphericalDistance(loc, activeImage.loc) > 100)) {
72374             buttonDisable("too_far");
72375           } else {
72376             buttonDisable(false);
72377           }
72378         }
72379         function buttonDisable(reason) {
72380           const disabled = reason !== false;
72381           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
72382           button.attr("disabled", disabled ? "true" : null);
72383           button.classed("disabled", disabled);
72384           button.call(uiTooltip().destroyAny);
72385           if (disabled) {
72386             button.call(
72387               uiTooltip().title(() => _t.append(`inspector.set_photo_from_viewer.disable.${reason}`)).placement("right")
72388             );
72389           } else {
72390             button.call(
72391               uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
72392             );
72393           }
72394           button.select(".tooltip").classed("dark", true).style("width", "300px");
72395         }
72396       }
72397       function buildResizeListener(target, eventName, dispatch15, options) {
72398         var resizeOnX = !!options.resizeOnX;
72399         var resizeOnY = !!options.resizeOnY;
72400         var minHeight = options.minHeight || 240;
72401         var minWidth = options.minWidth || 320;
72402         var pointerId;
72403         var startX;
72404         var startY;
72405         var startWidth;
72406         var startHeight;
72407         function startResize(d3_event) {
72408           if (pointerId !== (d3_event.pointerId || "mouse")) return;
72409           d3_event.preventDefault();
72410           d3_event.stopPropagation();
72411           var mapSize = context.map().dimensions();
72412           if (resizeOnX) {
72413             var mapWidth = mapSize[0];
72414             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-left"), 10);
72415             var newWidth = clamp_default(startWidth + d3_event.clientX - startX, minWidth, mapWidth - viewerMargin * 2);
72416             target.style("width", newWidth + "px");
72417           }
72418           if (resizeOnY) {
72419             const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
72420             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
72421             var maxHeight = mapSize[1] - menuHeight - viewerMargin * 2;
72422             var newHeight = clamp_default(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
72423             target.style("height", newHeight + "px");
72424           }
72425           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
72426         }
72427         function stopResize(d3_event) {
72428           if (pointerId !== (d3_event.pointerId || "mouse")) return;
72429           d3_event.preventDefault();
72430           d3_event.stopPropagation();
72431           select_default2(window).on("." + eventName, null);
72432         }
72433         return function initResize(d3_event) {
72434           d3_event.preventDefault();
72435           d3_event.stopPropagation();
72436           pointerId = d3_event.pointerId || "mouse";
72437           startX = d3_event.clientX;
72438           startY = d3_event.clientY;
72439           var targetRect = target.node().getBoundingClientRect();
72440           startWidth = targetRect.width;
72441           startHeight = targetRect.height;
72442           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
72443           if (_pointerPrefix === "pointer") {
72444             select_default2(window).on("pointercancel." + eventName, stopResize, false);
72445           }
72446         };
72447       }
72448     }
72449     photoviewer.onMapResize = function() {
72450       var photoviewer2 = context.container().select(".photoviewer");
72451       var content = context.container().select(".main-content");
72452       var mapDimensions = utilGetDimensions(content, true);
72453       const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
72454       const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
72455       var photoDimensions = utilGetDimensions(photoviewer2, true);
72456       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - menuHeight - viewerMargin * 2) {
72457         var setPhotoDimensions = [
72458           Math.min(photoDimensions[0], mapDimensions[0]),
72459           Math.min(photoDimensions[1], mapDimensions[1] - menuHeight - viewerMargin * 2)
72460         ];
72461         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
72462         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
72463       }
72464     };
72465     function subtractPadding(dimensions, selection2) {
72466       return [
72467         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
72468         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
72469       ];
72470     }
72471     return utilRebind(photoviewer, dispatch14, "on");
72472   }
72473   var init_photoviewer = __esm({
72474     "modules/ui/photoviewer.js"() {
72475       "use strict";
72476       init_src5();
72477       init_lodash();
72478       init_localizer();
72479       init_src4();
72480       init_icon();
72481       init_dimensions();
72482       init_util();
72483       init_services();
72484       init_tooltip();
72485       init_actions();
72486       init_geo2();
72487     }
72488   });
72489
72490   // modules/ui/restore.js
72491   var restore_exports = {};
72492   __export(restore_exports, {
72493     uiRestore: () => uiRestore
72494   });
72495   function uiRestore(context) {
72496     return function(selection2) {
72497       if (!context.history().hasRestorableChanges()) return;
72498       let modalSelection = uiModal(selection2, true);
72499       modalSelection.select(".modal").attr("class", "modal fillL");
72500       let introModal = modalSelection.select(".content");
72501       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
72502       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
72503       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
72504       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
72505         context.history().restore();
72506         modalSelection.remove();
72507       });
72508       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
72509       restore.append("div").call(_t.append("restore.restore"));
72510       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
72511         context.history().clearSaved();
72512         modalSelection.remove();
72513       });
72514       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
72515       reset.append("div").call(_t.append("restore.reset"));
72516       restore.node().focus();
72517     };
72518   }
72519   var init_restore = __esm({
72520     "modules/ui/restore.js"() {
72521       "use strict";
72522       init_localizer();
72523       init_modal();
72524     }
72525   });
72526
72527   // modules/ui/scale.js
72528   var scale_exports2 = {};
72529   __export(scale_exports2, {
72530     uiScale: () => uiScale
72531   });
72532   function uiScale(context) {
72533     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
72534     function scaleDefs(loc1, loc2) {
72535       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;
72536       if (isImperial) {
72537         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
72538       } else {
72539         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
72540       }
72541       for (i3 = 0; i3 < buckets.length; i3++) {
72542         val = buckets[i3];
72543         if (dist >= val) {
72544           scale.dist = Math.floor(dist / val) * val;
72545           break;
72546         } else {
72547           scale.dist = +dist.toFixed(2);
72548         }
72549       }
72550       dLon = geoMetersToLon(scale.dist / conversion, lat);
72551       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
72552       scale.text = displayLength(scale.dist / conversion, isImperial);
72553       return scale;
72554     }
72555     function update(selection2) {
72556       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
72557       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
72558       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
72559     }
72560     return function(selection2) {
72561       function switchUnits() {
72562         isImperial = !isImperial;
72563         selection2.call(update);
72564       }
72565       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
72566       scalegroup.append("path").attr("class", "scale-path");
72567       selection2.append("div").attr("class", "scale-text");
72568       selection2.call(update);
72569       context.map().on("move.scale", function() {
72570         update(selection2);
72571       });
72572     };
72573   }
72574   var init_scale2 = __esm({
72575     "modules/ui/scale.js"() {
72576       "use strict";
72577       init_units();
72578       init_geo2();
72579       init_localizer();
72580     }
72581   });
72582
72583   // modules/ui/shortcuts.js
72584   var shortcuts_exports = {};
72585   __export(shortcuts_exports, {
72586     uiShortcuts: () => uiShortcuts
72587   });
72588   function uiShortcuts(context) {
72589     var detected = utilDetect();
72590     var _activeTab = 0;
72591     var _modalSelection;
72592     var _selection = select_default2(null);
72593     var _dataShortcuts;
72594     function shortcutsModal(_modalSelection2) {
72595       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
72596       var content = _modalSelection2.select(".content");
72597       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
72598       _mainFileFetcher.get("shortcuts").then(function(data) {
72599         _dataShortcuts = data;
72600         content.call(render);
72601       }).catch(function() {
72602       });
72603     }
72604     function render(selection2) {
72605       if (!_dataShortcuts) return;
72606       var wrapper = selection2.selectAll(".wrapper").data([0]);
72607       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
72608       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
72609       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
72610       wrapper = wrapper.merge(wrapperEnter);
72611       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
72612       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
72613         d3_event.preventDefault();
72614         var i3 = _dataShortcuts.indexOf(d2);
72615         _activeTab = i3;
72616         render(selection2);
72617       });
72618       tabsEnter.append("span").html(function(d2) {
72619         return _t.html(d2.text);
72620       });
72621       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
72622         return i3 === _activeTab;
72623       });
72624       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
72625       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
72626         return "shortcut-tab shortcut-tab-" + d2.tab;
72627       });
72628       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
72629         return d2.columns;
72630       }).enter().append("table").attr("class", "shortcut-column");
72631       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
72632         return d2.rows;
72633       }).enter().append("tr").attr("class", "shortcut-row");
72634       var sectionRows = rowsEnter.filter(function(d2) {
72635         return !d2.shortcuts;
72636       });
72637       sectionRows.append("td");
72638       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
72639         return _t.html(d2.text);
72640       });
72641       var shortcutRows = rowsEnter.filter(function(d2) {
72642         return d2.shortcuts;
72643       });
72644       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
72645       var modifierKeys = shortcutKeys.filter(function(d2) {
72646         return d2.modifiers;
72647       });
72648       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
72649         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
72650           return ["\u2318"];
72651         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
72652           return [];
72653         } else {
72654           return d2.modifiers;
72655         }
72656       }).enter().each(function() {
72657         var selection3 = select_default2(this);
72658         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
72659           return uiCmd.display(d2);
72660         });
72661         selection3.append("span").text("+");
72662       });
72663       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
72664         var arr = d2.shortcuts;
72665         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
72666           arr = ["Y"];
72667         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
72668           arr = ["F11"];
72669         }
72670         arr = arr.map(function(s2) {
72671           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
72672         });
72673         return utilArrayUniq(arr).map(function(s2) {
72674           return {
72675             shortcut: s2,
72676             separator: d2.separator,
72677             suffix: d2.suffix
72678           };
72679         });
72680       }).enter().each(function(d2, i3, nodes) {
72681         var selection3 = select_default2(this);
72682         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
72683         if (click && click[1]) {
72684           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
72685         } else if (d2.shortcut.toLowerCase() === "long-press") {
72686           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
72687         } else if (d2.shortcut.toLowerCase() === "tap") {
72688           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
72689         } else {
72690           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
72691             return d4.shortcut;
72692           });
72693         }
72694         if (i3 < nodes.length - 1) {
72695           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
72696         } else if (i3 === nodes.length - 1 && d2.suffix) {
72697           selection3.append("span").text(d2.suffix);
72698         }
72699       });
72700       shortcutKeys.filter(function(d2) {
72701         return d2.gesture;
72702       }).each(function() {
72703         var selection3 = select_default2(this);
72704         selection3.append("span").text("+");
72705         selection3.append("span").attr("class", "gesture").html(function(d2) {
72706           return _t.html(d2.gesture);
72707         });
72708       });
72709       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
72710         return d2.text ? _t.html(d2.text) : "\xA0";
72711       });
72712       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
72713         return i3 === _activeTab ? "flex" : "none";
72714       });
72715     }
72716     return function(selection2, show) {
72717       _selection = selection2;
72718       if (show) {
72719         _modalSelection = uiModal(selection2);
72720         _modalSelection.call(shortcutsModal);
72721       } else {
72722         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
72723           if (context.container().selectAll(".modal-shortcuts").size()) {
72724             if (_modalSelection) {
72725               _modalSelection.close();
72726               _modalSelection = null;
72727             }
72728           } else {
72729             _modalSelection = uiModal(_selection);
72730             _modalSelection.call(shortcutsModal);
72731           }
72732         });
72733       }
72734     };
72735   }
72736   var init_shortcuts = __esm({
72737     "modules/ui/shortcuts.js"() {
72738       "use strict";
72739       init_src5();
72740       init_file_fetcher();
72741       init_localizer();
72742       init_icon();
72743       init_cmd();
72744       init_modal();
72745       init_util();
72746       init_detect();
72747     }
72748   });
72749
72750   // node_modules/@mapbox/sexagesimal/index.js
72751   var require_sexagesimal = __commonJS({
72752     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
72753       module2.exports = element;
72754       module2.exports.pair = pair3;
72755       module2.exports.format = format2;
72756       module2.exports.formatPair = formatPair;
72757       module2.exports.coordToDMS = coordToDMS;
72758       function element(input, dims) {
72759         var result = search(input, dims);
72760         return result === null ? null : result.val;
72761       }
72762       function formatPair(input) {
72763         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
72764       }
72765       function format2(input, dim) {
72766         var dms = coordToDMS(input, dim);
72767         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
72768       }
72769       function coordToDMS(input, dim) {
72770         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
72771         var dir = dirs[input >= 0 ? 0 : 1];
72772         var abs3 = Math.abs(input);
72773         var whole = Math.floor(abs3);
72774         var fraction = abs3 - whole;
72775         var fractionMinutes = fraction * 60;
72776         var minutes = Math.floor(fractionMinutes);
72777         var seconds = Math.floor((fractionMinutes - minutes) * 60);
72778         return {
72779           whole,
72780           minutes,
72781           seconds,
72782           dir
72783         };
72784       }
72785       function search(input, dims) {
72786         if (!dims) dims = "NSEW";
72787         if (typeof input !== "string") return null;
72788         input = input.toUpperCase();
72789         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
72790         var m3 = input.match(regex);
72791         if (!m3) return null;
72792         var matched = m3[0];
72793         var dim;
72794         if (m3[1] && m3[5]) {
72795           dim = m3[1];
72796           matched = matched.slice(0, -1);
72797         } else {
72798           dim = m3[1] || m3[5];
72799         }
72800         if (dim && dims.indexOf(dim) === -1) return null;
72801         var deg = m3[2] ? parseFloat(m3[2]) : 0;
72802         var min3 = m3[3] ? parseFloat(m3[3]) / 60 : 0;
72803         var sec = m3[4] ? parseFloat(m3[4]) / 3600 : 0;
72804         var sign2 = deg < 0 ? -1 : 1;
72805         if (dim === "S" || dim === "W") sign2 *= -1;
72806         return {
72807           val: (Math.abs(deg) + min3 + sec) * sign2,
72808           dim,
72809           matched,
72810           remain: input.slice(matched.length)
72811         };
72812       }
72813       function pair3(input, dims) {
72814         input = input.trim();
72815         var one2 = search(input, dims);
72816         if (!one2) return null;
72817         input = one2.remain.trim();
72818         var two = search(input, dims);
72819         if (!two || two.remain) return null;
72820         if (one2.dim) {
72821           return swapdim(one2.val, two.val, one2.dim);
72822         } else {
72823           return [one2.val, two.val];
72824         }
72825       }
72826       function swapdim(a4, b3, dim) {
72827         if (dim === "N" || dim === "S") return [a4, b3];
72828         if (dim === "W" || dim === "E") return [b3, a4];
72829       }
72830     }
72831   });
72832
72833   // modules/ui/feature_list.js
72834   var feature_list_exports = {};
72835   __export(feature_list_exports, {
72836     uiFeatureList: () => uiFeatureList
72837   });
72838   function uiFeatureList(context) {
72839     var _geocodeResults;
72840     function featureList(selection2) {
72841       var header = selection2.append("div").attr("class", "header fillL");
72842       header.append("h2").call(_t.append("inspector.feature_list"));
72843       var searchWrap = selection2.append("div").attr("class", "search-header");
72844       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
72845       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
72846       var listWrap = selection2.append("div").attr("class", "inspector-body");
72847       var list = listWrap.append("div").attr("class", "feature-list");
72848       context.on("exit.feature-list", clearSearch);
72849       context.map().on("drawn.feature-list", mapDrawn);
72850       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
72851       function focusSearch(d3_event) {
72852         var mode = context.mode() && context.mode().id;
72853         if (mode !== "browse") return;
72854         d3_event.preventDefault();
72855         search.node().focus();
72856       }
72857       function keydown(d3_event) {
72858         if (d3_event.keyCode === 27) {
72859           search.node().blur();
72860         }
72861       }
72862       function keypress(d3_event) {
72863         var q3 = search.property("value"), items = list.selectAll(".feature-list-item");
72864         if (d3_event.keyCode === 13 && // ↩ Return
72865         q3.length && items.size()) {
72866           click(d3_event, items.datum());
72867         }
72868       }
72869       function inputevent() {
72870         _geocodeResults = void 0;
72871         drawList();
72872       }
72873       function clearSearch() {
72874         search.property("value", "");
72875         drawList();
72876       }
72877       function mapDrawn(e3) {
72878         if (e3.full) {
72879           drawList();
72880         }
72881       }
72882       function features() {
72883         var graph = context.graph();
72884         var visibleCenter = context.map().extent().center();
72885         var q3 = search.property("value").toLowerCase().trim();
72886         if (!q3) return [];
72887         const locationMatch = sexagesimal.pair(q3.toUpperCase()) || dmsMatcher(q3);
72888         const coordResult = [];
72889         if (locationMatch) {
72890           const latLon = [Number(locationMatch[0]), Number(locationMatch[1])];
72891           const lonLat = [latLon[1], latLon[0]];
72892           const isLatLonValid = latLon[0] >= -90 && latLon[0] <= 90 && latLon[1] >= -180 && latLon[1] <= 180;
72893           let isLonLatValid = lonLat[0] >= -90 && lonLat[0] <= 90 && lonLat[1] >= -180 && lonLat[1] <= 180;
72894           isLonLatValid && (isLonLatValid = !q3.match(/[NSEW]/i));
72895           isLonLatValid && (isLonLatValid = !locationMatch[2]);
72896           isLonLatValid && (isLonLatValid = lonLat[0] !== lonLat[1]);
72897           if (isLatLonValid) {
72898             coordResult.push({
72899               id: latLon[0] + "/" + latLon[1],
72900               geometry: "point",
72901               type: _t("inspector.location"),
72902               name: dmsCoordinatePair([latLon[1], latLon[0]]),
72903               location: latLon,
72904               zoom: locationMatch[2]
72905             });
72906           }
72907           if (isLonLatValid) {
72908             coordResult.push({
72909               id: lonLat[0] + "/" + lonLat[1],
72910               geometry: "point",
72911               type: _t("inspector.location"),
72912               name: dmsCoordinatePair([lonLat[1], lonLat[0]]),
72913               location: lonLat
72914             });
72915           }
72916         }
72917         const idMatch = !locationMatch && q3.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
72918         const idResult = [];
72919         if (idMatch) {
72920           var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
72921           var elemId = idMatch[2];
72922           idResult.push({
72923             id: elemType + elemId,
72924             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
72925             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
72926             name: elemId
72927           });
72928         }
72929         var allEntities = graph.entities;
72930         const localResults = [];
72931         for (var id2 in allEntities) {
72932           var entity = allEntities[id2];
72933           if (!entity) continue;
72934           var name = utilDisplayName(entity) || "";
72935           if (name.toLowerCase().indexOf(q3) < 0) continue;
72936           var matched = _mainPresetIndex.match(entity, graph);
72937           var type2 = matched && matched.name() || utilDisplayType(entity.id);
72938           var extent = entity.extent(graph);
72939           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
72940           localResults.push({
72941             id: entity.id,
72942             entity,
72943             geometry: entity.geometry(graph),
72944             type: type2,
72945             name,
72946             distance
72947           });
72948           if (localResults.length > 100) break;
72949         }
72950         localResults.sort((a4, b3) => a4.distance - b3.distance);
72951         const geocodeResults = [];
72952         (_geocodeResults || []).forEach(function(d2) {
72953           if (d2.osm_type && d2.osm_id) {
72954             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
72955             var tags = {};
72956             tags[d2.class] = d2.type;
72957             var attrs = { id: id3, type: d2.osm_type, tags };
72958             if (d2.osm_type === "way") {
72959               attrs.nodes = ["a", "a"];
72960             }
72961             var tempEntity = osmEntity(attrs);
72962             var tempGraph = coreGraph([tempEntity]);
72963             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
72964             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
72965             geocodeResults.push({
72966               id: tempEntity.id,
72967               geometry: tempEntity.geometry(tempGraph),
72968               type: type3,
72969               name: d2.display_name,
72970               extent: new geoExtent(
72971                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
72972                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
72973               )
72974             });
72975           }
72976         });
72977         const extraResults = [];
72978         if (q3.match(/^[0-9]+$/)) {
72979           extraResults.push({
72980             id: "n" + q3,
72981             geometry: "point",
72982             type: _t("inspector.node"),
72983             name: q3
72984           });
72985           extraResults.push({
72986             id: "w" + q3,
72987             geometry: "line",
72988             type: _t("inspector.way"),
72989             name: q3
72990           });
72991           extraResults.push({
72992             id: "r" + q3,
72993             geometry: "relation",
72994             type: _t("inspector.relation"),
72995             name: q3
72996           });
72997           extraResults.push({
72998             id: "note" + q3,
72999             geometry: "note",
73000             type: _t("note.note"),
73001             name: q3
73002           });
73003         }
73004         return [...idResult, ...localResults, ...coordResult, ...geocodeResults, ...extraResults];
73005       }
73006       function drawList() {
73007         var value = search.property("value");
73008         var results = features();
73009         list.classed("filtered", value.length);
73010         var resultsIndicator = list.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
73011         resultsIndicator.append("span").attr("class", "entity-name");
73012         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
73013         if (services.geocoder) {
73014           list.selectAll(".geocode-item").data([0]).enter().append("button").attr("class", "geocode-item secondary-action").on("click", geocoderSearch).append("div").attr("class", "label").append("span").attr("class", "entity-name").call(_t.append("geocoder.search"));
73015         }
73016         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
73017         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
73018         var items = list.selectAll(".feature-list-item").data(results, function(d2) {
73019           return d2.id;
73020         });
73021         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);
73022         var label = enter.append("div").attr("class", "label");
73023         label.each(function(d2) {
73024           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
73025         });
73026         label.append("span").attr("class", "entity-type").text(function(d2) {
73027           return d2.type;
73028         });
73029         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) {
73030           return d2.name;
73031         });
73032         enter.style("opacity", 0).transition().style("opacity", 1);
73033         items.exit().each((d2) => mouseout(void 0, d2)).remove();
73034         items.merge(enter).order();
73035       }
73036       function mouseover(d3_event, d2) {
73037         if (d2.location !== void 0) return;
73038         utilHighlightEntities([d2.id], true, context);
73039       }
73040       function mouseout(d3_event, d2) {
73041         if (d2.location !== void 0) return;
73042         utilHighlightEntities([d2.id], false, context);
73043       }
73044       function click(d3_event, d2) {
73045         d3_event.preventDefault();
73046         if (d2.location) {
73047           context.map().centerZoomEase([d2.location[1], d2.location[0]], d2.zoom || 19);
73048         } else if (d2.entity) {
73049           utilHighlightEntities([d2.id], false, context);
73050           context.enter(modeSelect(context, [d2.entity.id]));
73051           context.map().zoomToEase(d2.entity);
73052         } else if (d2.geometry === "note") {
73053           const noteId = d2.id.replace(/\D/g, "");
73054           context.moveToNote(noteId);
73055         } else {
73056           context.zoomToEntity(d2.id);
73057         }
73058       }
73059       function geocoderSearch() {
73060         services.geocoder.search(search.property("value"), function(err, resp) {
73061           _geocodeResults = resp || [];
73062           drawList();
73063         });
73064       }
73065     }
73066     return featureList;
73067   }
73068   var sexagesimal;
73069   var init_feature_list = __esm({
73070     "modules/ui/feature_list.js"() {
73071       "use strict";
73072       init_src5();
73073       sexagesimal = __toESM(require_sexagesimal());
73074       init_presets();
73075       init_localizer();
73076       init_units();
73077       init_graph();
73078       init_geo();
73079       init_geo2();
73080       init_select5();
73081       init_entity();
73082       init_tags();
73083       init_services();
73084       init_icon();
73085       init_cmd();
73086       init_util();
73087     }
73088   });
73089
73090   // modules/ui/sections/entity_issues.js
73091   var entity_issues_exports = {};
73092   __export(entity_issues_exports, {
73093     uiSectionEntityIssues: () => uiSectionEntityIssues
73094   });
73095   function uiSectionEntityIssues(context) {
73096     var preference = corePreferences("entity-issues.reference.expanded");
73097     var _expanded = preference === null ? true : preference === "true";
73098     var _entityIDs = [];
73099     var _issues = [];
73100     var _activeIssueID;
73101     var section = uiSection("entity-issues", context).shouldDisplay(function() {
73102       return _issues.length > 0;
73103     }).label(function() {
73104       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
73105     }).disclosureContent(renderDisclosureContent);
73106     context.validator().on("validated.entity_issues", function() {
73107       reloadIssues();
73108       section.reRender();
73109     }).on("focusedIssue.entity_issues", function(issue) {
73110       makeActiveIssue(issue.id);
73111     });
73112     function reloadIssues() {
73113       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
73114     }
73115     function makeActiveIssue(issueID) {
73116       _activeIssueID = issueID;
73117       section.selection().selectAll(".issue-container").classed("active", function(d2) {
73118         return d2.id === _activeIssueID;
73119       });
73120     }
73121     function renderDisclosureContent(selection2) {
73122       selection2.classed("grouped-items-area", true);
73123       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
73124       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
73125         return d2.key;
73126       });
73127       containers.exit().remove();
73128       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
73129       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
73130         return "issue severity-" + d2.severity;
73131       }).on("mouseover.highlight", function(d3_event, d2) {
73132         var ids = d2.entityIds.filter(function(e3) {
73133           return _entityIDs.indexOf(e3) === -1;
73134         });
73135         utilHighlightEntities(ids, true, context);
73136       }).on("mouseout.highlight", function(d3_event, d2) {
73137         var ids = d2.entityIds.filter(function(e3) {
73138           return _entityIDs.indexOf(e3) === -1;
73139         });
73140         utilHighlightEntities(ids, false, context);
73141       });
73142       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
73143       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
73144         makeActiveIssue(d2.id);
73145         var extent = d2.extent(context.graph());
73146         if (extent) {
73147           var setZoom = Math.max(context.map().zoom(), 19);
73148           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
73149         }
73150       });
73151       textEnter.each(function(d2) {
73152         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73153         select_default2(this).call(svgIcon(iconName, "issue-icon"));
73154       });
73155       textEnter.append("span").attr("class", "issue-message");
73156       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
73157       infoButton.on("click", function(d3_event) {
73158         d3_event.stopPropagation();
73159         d3_event.preventDefault();
73160         this.blur();
73161         var container = select_default2(this.parentNode.parentNode.parentNode);
73162         var info = container.selectAll(".issue-info");
73163         var isExpanded = info.classed("expanded");
73164         _expanded = !isExpanded;
73165         corePreferences("entity-issues.reference.expanded", _expanded);
73166         if (isExpanded) {
73167           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
73168             info.classed("expanded", false);
73169           });
73170         } else {
73171           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
73172             info.style("max-height", null);
73173           });
73174         }
73175       });
73176       itemsEnter.append("ul").attr("class", "issue-fix-list");
73177       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
73178         if (typeof d2.reference === "function") {
73179           select_default2(this).call(d2.reference);
73180         } else {
73181           select_default2(this).call(_t.append("inspector.no_documentation_key"));
73182         }
73183       });
73184       containers = containers.merge(containersEnter).classed("active", function(d2) {
73185         return d2.id === _activeIssueID;
73186       });
73187       containers.selectAll(".issue-message").text("").each(function(d2) {
73188         return d2.message(context)(select_default2(this));
73189       });
73190       var fixLists = containers.selectAll(".issue-fix-list");
73191       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
73192         return d2.fixes ? d2.fixes(context) : [];
73193       }, function(fix) {
73194         return fix.id;
73195       });
73196       fixes.exit().remove();
73197       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
73198       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
73199         if (select_default2(this).attr("disabled") || !d2.onClick) return;
73200         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3) return;
73201         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
73202         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
73203         new Promise(function(resolve, reject) {
73204           d2.onClick(context, resolve, reject);
73205           if (d2.onClick.length <= 1) {
73206             resolve();
73207           }
73208         }).then(function() {
73209           context.validator().validate();
73210         });
73211       }).on("mouseover.highlight", function(d3_event, d2) {
73212         utilHighlightEntities(d2.entityIds, true, context);
73213       }).on("mouseout.highlight", function(d3_event, d2) {
73214         utilHighlightEntities(d2.entityIds, false, context);
73215       });
73216       buttons.each(function(d2) {
73217         var iconName = d2.icon || "iD-icon-wrench";
73218         if (iconName.startsWith("maki")) {
73219           iconName += "-15";
73220         }
73221         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
73222       });
73223       buttons.append("span").attr("class", "fix-message").each(function(d2) {
73224         return d2.title(select_default2(this));
73225       });
73226       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
73227         return d2.onClick;
73228       }).attr("disabled", function(d2) {
73229         return d2.onClick ? null : "true";
73230       }).attr("title", function(d2) {
73231         if (d2.disabledReason) {
73232           return d2.disabledReason;
73233         }
73234         return null;
73235       });
73236     }
73237     section.entityIDs = function(val) {
73238       if (!arguments.length) return _entityIDs;
73239       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
73240         _entityIDs = val;
73241         _activeIssueID = null;
73242         reloadIssues();
73243       }
73244       return section;
73245     };
73246     return section;
73247   }
73248   var init_entity_issues = __esm({
73249     "modules/ui/sections/entity_issues.js"() {
73250       "use strict";
73251       init_src5();
73252       init_preferences();
73253       init_icon();
73254       init_array3();
73255       init_localizer();
73256       init_util();
73257       init_section();
73258     }
73259   });
73260
73261   // modules/ui/preset_icon.js
73262   var preset_icon_exports = {};
73263   __export(preset_icon_exports, {
73264     uiPresetIcon: () => uiPresetIcon
73265   });
73266   function uiPresetIcon() {
73267     let _preset;
73268     let _geometry;
73269     function presetIcon(selection2) {
73270       selection2.each(render);
73271     }
73272     function getIcon(p2, geom) {
73273       if (p2.isFallback && p2.isFallback()) return geom === "vertex" ? "" : "iD-icon-" + p2.id;
73274       if (p2.icon) return p2.icon;
73275       if (geom === "line") return "iD-other-line";
73276       if (geom === "vertex") return "temaki-vertex";
73277       return "maki-marker-stroked";
73278     }
73279     function renderPointBorder(container, drawPoint) {
73280       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
73281       pointBorder.exit().remove();
73282       let pointBorderEnter = pointBorder.enter();
73283       const w3 = 40;
73284       const h3 = 40;
73285       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`).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");
73286       pointBorder = pointBorderEnter.merge(pointBorder);
73287     }
73288     function renderCategoryBorder(container, category) {
73289       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
73290       categoryBorder.exit().remove();
73291       let categoryBorderEnter = categoryBorder.enter();
73292       const d2 = 60;
73293       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}`);
73294       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");
73295       categoryBorder = categoryBorderEnter.merge(categoryBorder);
73296       if (category) {
73297         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
73298       }
73299     }
73300     function renderCircleFill(container, drawVertex) {
73301       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
73302       vertexFill.exit().remove();
73303       let vertexFillEnter = vertexFill.enter();
73304       const w3 = 60;
73305       const h3 = 60;
73306       const d2 = 40;
73307       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`).append("circle").attr("cx", w3 / 2).attr("cy", h3 / 2).attr("r", d2 / 2);
73308       vertexFill = vertexFillEnter.merge(vertexFill);
73309     }
73310     function renderSquareFill(container, drawArea, tagClasses) {
73311       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
73312       fill.exit().remove();
73313       let fillEnter = fill.enter();
73314       const d2 = 60;
73315       const w3 = d2;
73316       const h3 = d2;
73317       const l2 = d2 * 2 / 3;
73318       const c1 = (w3 - l2) / 2;
73319       const c2 = c1 + l2;
73320       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73321       ["fill", "stroke"].forEach((klass) => {
73322         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
73323       });
73324       const rVertex = 2.5;
73325       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
73326         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
73327       });
73328       const rMidpoint = 1.25;
73329       [[c1, w3 / 2], [c2, w3 / 2], [h3 / 2, c1], [h3 / 2, c2]].forEach((point) => {
73330         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
73331       });
73332       fill = fillEnter.merge(fill);
73333       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
73334       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
73335     }
73336     function renderLine(container, drawLine, tagClasses) {
73337       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
73338       line.exit().remove();
73339       let lineEnter = line.enter();
73340       const d2 = 60;
73341       const w3 = d2;
73342       const h3 = d2;
73343       const y2 = Math.round(d2 * 0.72);
73344       const l2 = Math.round(d2 * 0.6);
73345       const r2 = 2.5;
73346       const x12 = (w3 - l2) / 2;
73347       const x2 = x12 + l2;
73348       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73349       ["casing", "stroke"].forEach((klass) => {
73350         lineEnter.append("path").attr("d", `M${x12} ${y2} L${x2} ${y2}`).attr("class", `line ${klass}`);
73351       });
73352       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point) => {
73353         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
73354       });
73355       line = lineEnter.merge(line);
73356       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
73357       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
73358     }
73359     function renderRoute(container, drawRoute, p2) {
73360       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
73361       route.exit().remove();
73362       let routeEnter = route.enter();
73363       const d2 = 60;
73364       const w3 = d2;
73365       const h3 = d2;
73366       const y12 = Math.round(d2 * 0.8);
73367       const y2 = Math.round(d2 * 0.68);
73368       const l2 = Math.round(d2 * 0.6);
73369       const r2 = 2;
73370       const x12 = (w3 - l2) / 2;
73371       const x2 = x12 + l2 / 3;
73372       const x3 = x2 + l2 / 3;
73373       const x4 = x3 + l2 / 3;
73374       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73375       ["casing", "stroke"].forEach((klass) => {
73376         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
73377         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
73378         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
73379       });
73380       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
73381         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
73382       });
73383       route = routeEnter.merge(route);
73384       if (drawRoute) {
73385         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
73386         const segmentPresetIDs = routeSegments[routeType];
73387         for (let i3 in segmentPresetIDs) {
73388           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
73389           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
73390           route.selectAll(`path.stroke.segment${i3}`).attr("class", `segment${i3} line stroke ${segmentTagClasses}`);
73391           route.selectAll(`path.casing.segment${i3}`).attr("class", `segment${i3} line casing ${segmentTagClasses}`);
73392         }
73393       }
73394     }
73395     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
73396       const isMaki = picon && /^maki-/.test(picon);
73397       const isTemaki = picon && /^temaki-/.test(picon);
73398       const isFa = picon && /^fa[srb]-/.test(picon);
73399       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
73400       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
73401       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
73402       icon2.exit().remove();
73403       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
73404       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
73405       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
73406       icon2.selectAll("use").attr("href", "#" + picon);
73407     }
73408     function renderImageIcon(container, imageURL) {
73409       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
73410       imageIcon.exit().remove();
73411       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);
73412       imageIcon.attr("src", imageURL);
73413     }
73414     const routeSegments = {
73415       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
73416       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
73417       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
73418       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
73419       ferry: ["route/ferry", "route/ferry", "route/ferry"],
73420       foot: ["highway/footway", "highway/footway", "highway/footway"],
73421       hiking: ["highway/path", "highway/path", "highway/path"],
73422       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
73423       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
73424       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
73425       mtb: ["highway/path", "highway/track", "highway/bridleway"],
73426       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
73427       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
73428       power: ["power/line", "power/line", "power/line"],
73429       road: ["highway/secondary", "highway/primary", "highway/trunk"],
73430       subway: ["railway/subway", "railway/subway", "railway/subway"],
73431       train: ["railway/rail", "railway/rail", "railway/rail"],
73432       tram: ["railway/tram", "railway/tram", "railway/tram"],
73433       railway: ["railway/rail", "railway/rail", "railway/rail"],
73434       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
73435     };
73436     function render() {
73437       let p2 = _preset.apply(this, arguments);
73438       let geom = _geometry ? _geometry.apply(this, arguments) : null;
73439       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
73440         geom = "route";
73441       }
73442       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
73443       const isFallback = p2.isFallback && p2.isFallback();
73444       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
73445       const picon = getIcon(p2, geom);
73446       const isCategory = !p2.setTags;
73447       const drawPoint = false;
73448       const drawVertex = picon !== null && geom === "vertex";
73449       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
73450       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
73451       const drawRoute = picon && geom === "route";
73452       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
73453       let tags = !isCategory ? p2.setTags({}, geom) : {};
73454       for (let k3 in tags) {
73455         if (tags[k3] === "*") {
73456           tags[k3] = "yes";
73457         }
73458       }
73459       let tagClasses = svgTagClasses().getClassesString(tags, "");
73460       let selection2 = select_default2(this);
73461       let container = selection2.selectAll(".preset-icon-container").data([0]);
73462       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
73463       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
73464       renderCategoryBorder(container, isCategory && p2);
73465       renderPointBorder(container, drawPoint);
73466       renderCircleFill(container, drawVertex);
73467       renderSquareFill(container, drawArea, tagClasses);
73468       renderLine(container, drawLine, tagClasses);
73469       renderRoute(container, drawRoute, p2);
73470       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
73471       renderImageIcon(container, imageURL);
73472     }
73473     presetIcon.preset = function(val) {
73474       if (!arguments.length) return _preset;
73475       _preset = utilFunctor(val);
73476       return presetIcon;
73477     };
73478     presetIcon.geometry = function(val) {
73479       if (!arguments.length) return _geometry;
73480       _geometry = utilFunctor(val);
73481       return presetIcon;
73482     };
73483     return presetIcon;
73484   }
73485   var init_preset_icon = __esm({
73486     "modules/ui/preset_icon.js"() {
73487       "use strict";
73488       init_src5();
73489       init_presets();
73490       init_preferences();
73491       init_svg();
73492       init_util();
73493     }
73494   });
73495
73496   // modules/ui/sections/feature_type.js
73497   var feature_type_exports = {};
73498   __export(feature_type_exports, {
73499     uiSectionFeatureType: () => uiSectionFeatureType
73500   });
73501   function uiSectionFeatureType(context) {
73502     var dispatch14 = dispatch_default("choose");
73503     var _entityIDs = [];
73504     var _presets = [];
73505     var _tagReference;
73506     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
73507     function renderDisclosureContent(selection2) {
73508       selection2.classed("preset-list-item", true);
73509       selection2.classed("mixed-types", _presets.length > 1);
73510       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
73511       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
73512         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
73513       );
73514       presetButton.append("div").attr("class", "preset-icon-container");
73515       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
73516       presetButtonWrap.append("div").attr("class", "accessory-buttons");
73517       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
73518       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
73519       if (_tagReference) {
73520         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
73521         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
73522       }
73523       selection2.selectAll(".preset-reset").on("click", function() {
73524         dispatch14.call("choose", this, _presets);
73525       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
73526         d3_event.preventDefault();
73527         d3_event.stopPropagation();
73528       });
73529       var geometries = entityGeometries();
73530       selection2.select(".preset-list-item button").call(
73531         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
73532       );
73533       var names = _presets.length === 1 ? [
73534         _presets[0].nameLabel(),
73535         _presets[0].subtitleLabel()
73536       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
73537       var label = selection2.select(".label-inner");
73538       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
73539       nameparts.exit().remove();
73540       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
73541         d2(select_default2(this));
73542       });
73543     }
73544     section.entityIDs = function(val) {
73545       if (!arguments.length) return _entityIDs;
73546       _entityIDs = val;
73547       return section;
73548     };
73549     section.presets = function(val) {
73550       if (!arguments.length) return _presets;
73551       if (!utilArrayIdentical(val, _presets)) {
73552         _presets = val;
73553         if (_presets.length === 1) {
73554           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
73555         }
73556       }
73557       return section;
73558     };
73559     function entityGeometries() {
73560       var counts = {};
73561       for (var i3 in _entityIDs) {
73562         var geometry = context.graph().geometry(_entityIDs[i3]);
73563         if (!counts[geometry]) counts[geometry] = 0;
73564         counts[geometry] += 1;
73565       }
73566       return Object.keys(counts).sort(function(geom1, geom2) {
73567         return counts[geom2] - counts[geom1];
73568       });
73569     }
73570     return utilRebind(section, dispatch14, "on");
73571   }
73572   var init_feature_type = __esm({
73573     "modules/ui/sections/feature_type.js"() {
73574       "use strict";
73575       init_src4();
73576       init_src5();
73577       init_presets();
73578       init_array3();
73579       init_localizer();
73580       init_tooltip();
73581       init_util();
73582       init_preset_icon();
73583       init_section();
73584       init_tag_reference();
73585     }
73586   });
73587
73588   // modules/ui/form_fields.js
73589   var form_fields_exports = {};
73590   __export(form_fields_exports, {
73591     uiFormFields: () => uiFormFields
73592   });
73593   function uiFormFields(context) {
73594     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
73595     var _fieldsArr = [];
73596     var _lastPlaceholder = "";
73597     var _state = "";
73598     var _klass = "";
73599     function formFields(selection2) {
73600       var allowedFields = _fieldsArr.filter(function(field) {
73601         return field.isAllowed();
73602       });
73603       var shown = allowedFields.filter(function(field) {
73604         return field.isShown();
73605       });
73606       var notShown = allowedFields.filter(function(field) {
73607         return !field.isShown();
73608       }).sort(function(a4, b3) {
73609         return a4.universal === b3.universal ? 0 : a4.universal ? 1 : -1;
73610       });
73611       var container = selection2.selectAll(".form-fields-container").data([0]);
73612       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
73613       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
73614         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
73615       });
73616       fields.exit().remove();
73617       var enter = fields.enter().append("div").attr("class", function(d2) {
73618         return "wrap-form-field wrap-form-field-" + d2.safeid;
73619       });
73620       fields = fields.merge(enter);
73621       fields.order().each(function(d2) {
73622         select_default2(this).call(d2.render);
73623       });
73624       var titles = [];
73625       var moreFields = notShown.map(function(field) {
73626         var title = field.title();
73627         titles.push(title);
73628         var terms = field.terms();
73629         if (field.key) terms.push(field.key);
73630         if (field.keys) terms = terms.concat(field.keys);
73631         return {
73632           display: field.label(),
73633           value: title,
73634           title,
73635           field,
73636           terms
73637         };
73638       });
73639       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
73640       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
73641       more.exit().remove();
73642       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
73643       moreEnter.append("span").call(_t.append("inspector.add_fields"));
73644       more = moreEnter.merge(more);
73645       var input = more.selectAll(".value").data([0]);
73646       input.exit().remove();
73647       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
73648       input.call(utilGetSetValue, "").call(
73649         moreCombo.data(moreFields).on("accept", function(d2) {
73650           if (!d2) return;
73651           var field = d2.field;
73652           field.show();
73653           selection2.call(formFields);
73654           field.focus();
73655         })
73656       );
73657       if (_lastPlaceholder !== placeholder) {
73658         input.attr("placeholder", placeholder);
73659         _lastPlaceholder = placeholder;
73660       }
73661     }
73662     formFields.fieldsArr = function(val) {
73663       if (!arguments.length) return _fieldsArr;
73664       _fieldsArr = val || [];
73665       return formFields;
73666     };
73667     formFields.state = function(val) {
73668       if (!arguments.length) return _state;
73669       _state = val;
73670       return formFields;
73671     };
73672     formFields.klass = function(val) {
73673       if (!arguments.length) return _klass;
73674       _klass = val;
73675       return formFields;
73676     };
73677     return formFields;
73678   }
73679   var init_form_fields = __esm({
73680     "modules/ui/form_fields.js"() {
73681       "use strict";
73682       init_src5();
73683       init_localizer();
73684       init_combobox();
73685       init_util();
73686     }
73687   });
73688
73689   // modules/ui/sections/preset_fields.js
73690   var preset_fields_exports = {};
73691   __export(preset_fields_exports, {
73692     uiSectionPresetFields: () => uiSectionPresetFields
73693   });
73694   function uiSectionPresetFields(context) {
73695     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
73696     var dispatch14 = dispatch_default("change", "revert");
73697     var formFields = uiFormFields(context);
73698     var _state;
73699     var _fieldsArr;
73700     var _presets = [];
73701     var _tags;
73702     var _entityIDs;
73703     function renderDisclosureContent(selection2) {
73704       if (!_fieldsArr) {
73705         var graph = context.graph();
73706         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
73707           geoms[graph.entity(entityID).geometry(graph)] = true;
73708           return geoms;
73709         }, {}));
73710         const loc = _entityIDs.reduce(function(extent, entityID) {
73711           var entity = context.graph().entity(entityID);
73712           return extent.extend(entity.extent(context.graph()));
73713         }, geoExtent()).center();
73714         var presetsManager = _mainPresetIndex;
73715         var allFields = [];
73716         var allMoreFields = [];
73717         var sharedTotalFields;
73718         _presets.forEach(function(preset) {
73719           var fields = preset.fields(loc);
73720           var moreFields = preset.moreFields(loc);
73721           allFields = utilArrayUnion(allFields, fields);
73722           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
73723           if (!sharedTotalFields) {
73724             sharedTotalFields = utilArrayUnion(fields, moreFields);
73725           } else {
73726             sharedTotalFields = sharedTotalFields.filter(function(field) {
73727               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
73728             });
73729           }
73730         });
73731         var sharedFields = allFields.filter(function(field) {
73732           return sharedTotalFields.indexOf(field) !== -1;
73733         });
73734         var sharedMoreFields = allMoreFields.filter(function(field) {
73735           return sharedTotalFields.indexOf(field) !== -1;
73736         });
73737         _fieldsArr = [];
73738         sharedFields.forEach(function(field) {
73739           if (field.matchAllGeometry(geometries)) {
73740             _fieldsArr.push(
73741               uiField(context, field, _entityIDs)
73742             );
73743           }
73744         });
73745         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
73746         if (singularEntity && singularEntity.type === "node" && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
73747           _fieldsArr.push(
73748             uiField(context, presetsManager.field("restrictions"), _entityIDs)
73749           );
73750         }
73751         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
73752         additionalFields.sort(function(field1, field2) {
73753           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
73754         });
73755         additionalFields.forEach(function(field) {
73756           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
73757             _fieldsArr.push(
73758               uiField(context, field, _entityIDs, { show: false })
73759             );
73760           }
73761         });
73762         _fieldsArr.forEach(function(field) {
73763           field.on("change", function(t2, onInput) {
73764             dispatch14.call("change", field, _entityIDs, t2, onInput);
73765           }).on("revert", function(keys2) {
73766             dispatch14.call("revert", field, keys2);
73767           });
73768         });
73769       }
73770       _fieldsArr.forEach(function(field) {
73771         field.state(_state).tags(_tags);
73772       });
73773       selection2.call(
73774         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
73775       );
73776     }
73777     section.presets = function(val) {
73778       if (!arguments.length) return _presets;
73779       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
73780         _presets = val;
73781         _fieldsArr = null;
73782       }
73783       return section;
73784     };
73785     section.state = function(val) {
73786       if (!arguments.length) return _state;
73787       _state = val;
73788       return section;
73789     };
73790     section.tags = function(val) {
73791       if (!arguments.length) return _tags;
73792       _tags = val;
73793       return section;
73794     };
73795     section.entityIDs = function(val) {
73796       if (!arguments.length) return _entityIDs;
73797       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
73798         _entityIDs = val;
73799         _fieldsArr = null;
73800       }
73801       return section;
73802     };
73803     return utilRebind(section, dispatch14, "on");
73804   }
73805   var init_preset_fields = __esm({
73806     "modules/ui/sections/preset_fields.js"() {
73807       "use strict";
73808       init_src4();
73809       init_presets();
73810       init_localizer();
73811       init_array3();
73812       init_util();
73813       init_extent();
73814       init_field2();
73815       init_form_fields();
73816       init_section();
73817     }
73818   });
73819
73820   // modules/ui/sections/raw_member_editor.js
73821   var raw_member_editor_exports = {};
73822   __export(raw_member_editor_exports, {
73823     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor
73824   });
73825   function uiSectionRawMemberEditor(context) {
73826     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
73827       if (!_entityIDs || _entityIDs.length !== 1) return false;
73828       var entity = context.hasEntity(_entityIDs[0]);
73829       return entity && entity.type === "relation";
73830     }).label(function() {
73831       var entity = context.hasEntity(_entityIDs[0]);
73832       if (!entity) return "";
73833       var gt2 = entity.members.length > _maxMembers ? ">" : "";
73834       var count = gt2 + entity.members.slice(0, _maxMembers).length;
73835       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
73836     }).disclosureContent(renderDisclosureContent);
73837     var taginfo = services.taginfo;
73838     var _entityIDs;
73839     var _maxMembers = 1e3;
73840     function downloadMember(d3_event, d2) {
73841       d3_event.preventDefault();
73842       select_default2(this).classed("loading", true);
73843       context.loadEntity(d2.id, function() {
73844         section.reRender();
73845       });
73846     }
73847     function zoomToMember(d3_event, d2) {
73848       d3_event.preventDefault();
73849       var entity = context.entity(d2.id);
73850       context.map().zoomToEase(entity);
73851       utilHighlightEntities([d2.id], true, context);
73852     }
73853     function selectMember(d3_event, d2) {
73854       d3_event.preventDefault();
73855       utilHighlightEntities([d2.id], false, context);
73856       var entity = context.entity(d2.id);
73857       var mapExtent = context.map().extent();
73858       if (!entity.intersects(mapExtent, context.graph())) {
73859         context.map().zoomToEase(entity);
73860       }
73861       context.enter(modeSelect(context, [d2.id]));
73862     }
73863     function changeRole(d3_event, d2) {
73864       var oldRole = d2.role;
73865       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
73866       if (oldRole !== newRole) {
73867         var member = { id: d2.id, type: d2.type, role: newRole };
73868         context.perform(
73869           actionChangeMember(d2.relation.id, member, d2.index),
73870           _t("operations.change_role.annotation", {
73871             n: 1
73872           })
73873         );
73874         context.validator().validate();
73875       }
73876     }
73877     function deleteMember(d3_event, d2) {
73878       utilHighlightEntities([d2.id], false, context);
73879       context.perform(
73880         actionDeleteMember(d2.relation.id, d2.index),
73881         _t("operations.delete_member.annotation", {
73882           n: 1
73883         })
73884       );
73885       if (!context.hasEntity(d2.relation.id)) {
73886         context.enter(modeBrowse(context));
73887       } else {
73888         context.validator().validate();
73889       }
73890     }
73891     function renderDisclosureContent(selection2) {
73892       var entityID = _entityIDs[0];
73893       var memberships = [];
73894       var entity = context.entity(entityID);
73895       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
73896         memberships.push({
73897           index,
73898           id: member.id,
73899           type: member.type,
73900           role: member.role,
73901           relation: entity,
73902           member: context.hasEntity(member.id),
73903           domId: utilUniqueDomId(entityID + "-member-" + index)
73904         });
73905       });
73906       var list = selection2.selectAll(".member-list").data([0]);
73907       list = list.enter().append("ul").attr("class", "member-list").merge(list);
73908       var items = list.selectAll("li").data(memberships, function(d2) {
73909         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
73910       });
73911       items.exit().each(unbind).remove();
73912       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
73913         return !d2.member;
73914       });
73915       itemsEnter.each(function(d2) {
73916         var item = select_default2(this);
73917         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
73918         if (d2.member) {
73919           item.on("mouseover", function() {
73920             utilHighlightEntities([d2.id], true, context);
73921           }).on("mouseout", function() {
73922             utilHighlightEntities([d2.id], false, context);
73923           });
73924           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
73925           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
73926             var matched = _mainPresetIndex.match(d4.member, context.graph());
73927             return matched && matched.name() || utilDisplayType(d4.member.id);
73928           });
73929           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) {
73930             return utilDisplayName(d4.member);
73931           });
73932           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
73933           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
73934         } else {
73935           var labelText = label.append("span").attr("class", "label-text");
73936           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
73937           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
73938           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
73939         }
73940       });
73941       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
73942       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
73943         return d2.domId;
73944       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
73945       if (taginfo) {
73946         wrapEnter.each(bindTypeahead);
73947       }
73948       items = items.merge(itemsEnter).order();
73949       items.select("input.member-role").property("value", function(d2) {
73950         return d2.role;
73951       }).on("blur", changeRole).on("change", changeRole);
73952       items.select("button.member-delete").on("click", deleteMember);
73953       var dragOrigin, targetIndex;
73954       items.call(
73955         drag_default().on("start", function(d3_event) {
73956           dragOrigin = {
73957             x: d3_event.x,
73958             y: d3_event.y
73959           };
73960           targetIndex = null;
73961         }).on("drag", function(d3_event) {
73962           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
73963           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
73964           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
73965           var index = items.nodes().indexOf(this);
73966           select_default2(this).classed("dragging", true);
73967           targetIndex = null;
73968           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
73969             var node = select_default2(this).node();
73970             if (index === index2) {
73971               return "translate(" + x2 + "px, " + y2 + "px)";
73972             } else if (index2 > index && d3_event.y > node.offsetTop) {
73973               if (targetIndex === null || index2 > targetIndex) {
73974                 targetIndex = index2;
73975               }
73976               return "translateY(-100%)";
73977             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
73978               if (targetIndex === null || index2 < targetIndex) {
73979                 targetIndex = index2;
73980               }
73981               return "translateY(100%)";
73982             }
73983             return null;
73984           });
73985         }).on("end", function(d3_event, d2) {
73986           if (!select_default2(this).classed("dragging")) return;
73987           var index = items.nodes().indexOf(this);
73988           select_default2(this).classed("dragging", false);
73989           selection2.selectAll("li.member-row").style("transform", null);
73990           if (targetIndex !== null) {
73991             context.perform(
73992               actionMoveMember(d2.relation.id, index, targetIndex),
73993               _t("operations.reorder_members.annotation")
73994             );
73995             context.validator().validate();
73996           }
73997         })
73998       );
73999       function bindTypeahead(d2) {
74000         var row = select_default2(this);
74001         var role = row.selectAll("input.member-role");
74002         var origValue = role.property("value");
74003         function sort(value, data) {
74004           var sameletter = [];
74005           var other = [];
74006           for (var i3 = 0; i3 < data.length; i3++) {
74007             if (data[i3].value.substring(0, value.length) === value) {
74008               sameletter.push(data[i3]);
74009             } else {
74010               other.push(data[i3]);
74011             }
74012           }
74013           return sameletter.concat(other);
74014         }
74015         role.call(
74016           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
74017             var geometry;
74018             if (d2.member) {
74019               geometry = context.graph().geometry(d2.member.id);
74020             } else if (d2.type === "relation") {
74021               geometry = "relation";
74022             } else if (d2.type === "way") {
74023               geometry = "line";
74024             } else {
74025               geometry = "point";
74026             }
74027             var rtype = entity.tags.type;
74028             taginfo.roles({
74029               debounce: true,
74030               rtype: rtype || "",
74031               geometry,
74032               query: role2
74033             }, function(err, data) {
74034               if (!err) callback(sort(role2, data));
74035             });
74036           }).on("cancel", function() {
74037             role.property("value", origValue);
74038           })
74039         );
74040       }
74041       function unbind() {
74042         var row = select_default2(this);
74043         row.selectAll("input.member-role").call(uiCombobox.off, context);
74044       }
74045     }
74046     section.entityIDs = function(val) {
74047       if (!arguments.length) return _entityIDs;
74048       _entityIDs = val;
74049       return section;
74050     };
74051     return section;
74052   }
74053   var init_raw_member_editor = __esm({
74054     "modules/ui/sections/raw_member_editor.js"() {
74055       "use strict";
74056       init_src6();
74057       init_src5();
74058       init_presets();
74059       init_localizer();
74060       init_change_member();
74061       init_delete_member();
74062       init_move_member();
74063       init_browse();
74064       init_select5();
74065       init_osm();
74066       init_tags();
74067       init_icon();
74068       init_services();
74069       init_combobox();
74070       init_section();
74071       init_util();
74072     }
74073   });
74074
74075   // modules/ui/sections/raw_membership_editor.js
74076   var raw_membership_editor_exports = {};
74077   __export(raw_membership_editor_exports, {
74078     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor
74079   });
74080   function uiSectionRawMembershipEditor(context) {
74081     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
74082       return _entityIDs && _entityIDs.length;
74083     }).label(function() {
74084       var parents = getSharedParentRelations();
74085       var gt2 = parents.length > _maxMemberships ? ">" : "";
74086       var count = gt2 + parents.slice(0, _maxMemberships).length;
74087       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
74088     }).disclosureContent(renderDisclosureContent);
74089     var taginfo = services.taginfo;
74090     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
74091       if (d2.relation) utilHighlightEntities([d2.relation.id], true, context);
74092     }).itemsMouseLeave(function(d3_event, d2) {
74093       if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
74094     });
74095     var _inChange = false;
74096     var _entityIDs = [];
74097     var _showBlank;
74098     var _maxMemberships = 1e3;
74099     const recentlyAdded = /* @__PURE__ */ new Set();
74100     function getSharedParentRelations() {
74101       var parents = [];
74102       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
74103         var entity = context.graph().hasEntity(_entityIDs[i3]);
74104         if (!entity) continue;
74105         if (i3 === 0) {
74106           parents = context.graph().parentRelations(entity);
74107         } else {
74108           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
74109         }
74110         if (!parents.length) break;
74111       }
74112       return parents;
74113     }
74114     function getMemberships() {
74115       var memberships = [];
74116       var relations = getSharedParentRelations().slice(0, _maxMemberships);
74117       var isMultiselect = _entityIDs.length > 1;
74118       var i3, relation, membership, index, member, indexedMember;
74119       for (i3 = 0; i3 < relations.length; i3++) {
74120         relation = relations[i3];
74121         membership = {
74122           relation,
74123           members: [],
74124           hash: osmEntity.key(relation)
74125         };
74126         for (index = 0; index < relation.members.length; index++) {
74127           member = relation.members[index];
74128           if (_entityIDs.indexOf(member.id) !== -1) {
74129             indexedMember = Object.assign({}, member, { index });
74130             membership.members.push(indexedMember);
74131             membership.hash += "," + index.toString();
74132             if (!isMultiselect) {
74133               memberships.push(membership);
74134               membership = {
74135                 relation,
74136                 members: [],
74137                 hash: osmEntity.key(relation)
74138               };
74139             }
74140           }
74141         }
74142         if (membership.members.length) memberships.push(membership);
74143       }
74144       memberships.forEach(function(membership2) {
74145         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
74146         var roles = [];
74147         membership2.members.forEach(function(member2) {
74148           if (roles.indexOf(member2.role) === -1) roles.push(member2.role);
74149         });
74150         membership2.role = roles.length === 1 ? roles[0] : roles;
74151       });
74152       const existingRelations = memberships.filter((membership2) => !recentlyAdded.has(membership2.relation.id)).map((membership2) => ({
74153         ...membership2,
74154         // We only sort relations that were not added just now.
74155         // Sorting uses the same label as shown in the UI.
74156         // If the label is not unique, the relation ID ensures
74157         // that the sort order is still stable.
74158         _sortKey: [
74159           baseDisplayValue(membership2.relation),
74160           membership2.relation.id
74161         ].join("-")
74162       })).sort((a4, b3) => {
74163         return a4._sortKey.localeCompare(
74164           b3._sortKey,
74165           _mainLocalizer.localeCodes(),
74166           { numeric: true }
74167         );
74168       });
74169       const newlyAddedRelations = memberships.filter((membership2) => recentlyAdded.has(membership2.relation.id));
74170       return [
74171         // the sorted relations come first
74172         ...existingRelations,
74173         // then the ones that were just added from this panel
74174         ...newlyAddedRelations
74175       ];
74176     }
74177     function selectRelation(d3_event, d2) {
74178       d3_event.preventDefault();
74179       utilHighlightEntities([d2.relation.id], false, context);
74180       context.enter(modeSelect(context, [d2.relation.id]));
74181     }
74182     function zoomToRelation(d3_event, d2) {
74183       d3_event.preventDefault();
74184       var entity = context.entity(d2.relation.id);
74185       context.map().zoomToEase(entity);
74186       utilHighlightEntities([d2.relation.id], true, context);
74187     }
74188     function changeRole(d3_event, d2) {
74189       if (d2 === 0) return;
74190       if (_inChange) return;
74191       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
74192       if (!newRole.trim() && typeof d2.role !== "string") return;
74193       var membersToUpdate = d2.members.filter(function(member) {
74194         return member.role !== newRole;
74195       });
74196       if (membersToUpdate.length) {
74197         _inChange = true;
74198         context.perform(
74199           function actionChangeMemberRoles(graph) {
74200             membersToUpdate.forEach(function(member) {
74201               var newMember = Object.assign({}, member, { role: newRole });
74202               delete newMember.index;
74203               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
74204             });
74205             return graph;
74206           },
74207           _t("operations.change_role.annotation", {
74208             n: membersToUpdate.length
74209           })
74210         );
74211         context.validator().validate();
74212       }
74213       _inChange = false;
74214     }
74215     function addMembership(d2, role) {
74216       _showBlank = false;
74217       function actionAddMembers(relationId, ids, role2) {
74218         return function(graph) {
74219           for (var i3 in ids) {
74220             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
74221             graph = actionAddMember(relationId, member)(graph);
74222           }
74223           return graph;
74224         };
74225       }
74226       if (d2.relation) {
74227         recentlyAdded.add(d2.relation.id);
74228         context.perform(
74229           actionAddMembers(d2.relation.id, _entityIDs, role),
74230           _t("operations.add_member.annotation", {
74231             n: _entityIDs.length
74232           })
74233         );
74234         context.validator().validate();
74235       } else {
74236         var relation = osmRelation();
74237         context.perform(
74238           actionAddEntity(relation),
74239           actionAddMembers(relation.id, _entityIDs, role),
74240           _t("operations.add.annotation.relation")
74241         );
74242         context.enter(modeSelect(context, [relation.id]).newFeature(true));
74243       }
74244     }
74245     function downloadMembers(d3_event, d2) {
74246       d3_event.preventDefault();
74247       const button = select_default2(this);
74248       button.classed("loading", true);
74249       context.loadEntity(d2.relation.id, function() {
74250         section.reRender();
74251       });
74252     }
74253     function deleteMembership(d3_event, d2) {
74254       this.blur();
74255       if (d2 === 0) return;
74256       utilHighlightEntities([d2.relation.id], false, context);
74257       var indexes = d2.members.map(function(member) {
74258         return member.index;
74259       });
74260       context.perform(
74261         actionDeleteMembers(d2.relation.id, indexes),
74262         _t("operations.delete_member.annotation", {
74263           n: _entityIDs.length
74264         })
74265       );
74266       context.validator().validate();
74267     }
74268     function fetchNearbyRelations(q3, callback) {
74269       var newRelation = {
74270         relation: null,
74271         value: _t("inspector.new_relation"),
74272         display: _t.append("inspector.new_relation")
74273       };
74274       var entityID = _entityIDs[0];
74275       var result = [];
74276       var graph = context.graph();
74277       function baseDisplayLabel(entity) {
74278         var matched = _mainPresetIndex.match(entity, graph);
74279         var presetName = matched && matched.name() || _t("inspector.relation");
74280         var entityName = utilDisplayName(entity) || "";
74281         return (selection2) => {
74282           selection2.append("b").text(presetName + " ");
74283           selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
74284         };
74285       }
74286       var explicitRelation = q3 && context.hasEntity(q3.toLowerCase());
74287       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
74288         result.push({
74289           relation: explicitRelation,
74290           value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
74291           display: baseDisplayLabel(explicitRelation)
74292         });
74293       } else {
74294         context.history().intersects(context.map().extent()).forEach(function(entity) {
74295           if (entity.type !== "relation" || entity.id === entityID) return;
74296           var value = baseDisplayValue(entity);
74297           if (q3 && (value + " " + entity.id).toLowerCase().indexOf(q3.toLowerCase()) === -1) return;
74298           result.push({
74299             relation: entity,
74300             value,
74301             display: baseDisplayLabel(entity)
74302           });
74303         });
74304         result.sort(function(a4, b3) {
74305           return osmRelation.creationOrder(a4.relation, b3.relation);
74306         });
74307         Object.values(utilArrayGroupBy(result, "value")).filter((v3) => v3.length > 1).flat().forEach((obj) => obj.value += " " + obj.relation.id);
74308       }
74309       result.forEach(function(obj) {
74310         obj.title = obj.value;
74311       });
74312       result.unshift(newRelation);
74313       callback(result);
74314     }
74315     function baseDisplayValue(entity) {
74316       const graph = context.graph();
74317       var matched = _mainPresetIndex.match(entity, graph);
74318       var presetName = matched && matched.name() || _t("inspector.relation");
74319       var entityName = utilDisplayName(entity) || "";
74320       return presetName + " " + entityName;
74321     }
74322     function renderDisclosureContent(selection2) {
74323       var memberships = getMemberships();
74324       var list = selection2.selectAll(".member-list").data([0]);
74325       list = list.enter().append("ul").attr("class", "member-list").merge(list);
74326       var items = list.selectAll("li.member-row-normal").data(memberships, function(d2) {
74327         return d2.hash;
74328       });
74329       items.exit().each(unbind).remove();
74330       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
74331       itemsEnter.on("mouseover", function(d3_event, d2) {
74332         utilHighlightEntities([d2.relation.id], true, context);
74333       }).on("mouseout", function(d3_event, d2) {
74334         utilHighlightEntities([d2.relation.id], false, context);
74335       });
74336       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
74337         return d2.domId;
74338       });
74339       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
74340       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
74341         var matched = _mainPresetIndex.match(d2.relation, context.graph());
74342         return matched && matched.name() || _t.html("inspector.relation");
74343       });
74344       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) {
74345         const matched = _mainPresetIndex.match(d2.relation, context.graph());
74346         return utilDisplayName(d2.relation, matched.suggestion);
74347       });
74348       labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
74349       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
74350       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
74351       items = items.merge(itemsEnter);
74352       items.selectAll("button.members-download").classed("hide", (d2) => {
74353         const graph = context.graph();
74354         return d2.relation.members.every((m3) => graph.hasEntity(m3.id));
74355       });
74356       const dupeLabels = new WeakSet(Object.values(
74357         utilArrayGroupBy(items.selectAll(".label-text").nodes(), "textContent")
74358       ).filter((v3) => v3.length > 1).flat());
74359       items.select(".label-text").each(function() {
74360         const label = select_default2(this);
74361         const entityName = label.select(".member-entity-name");
74362         if (dupeLabels.has(this)) {
74363           label.attr("title", (d2) => `${entityName.text()} ${d2.relation.id}`);
74364         } else {
74365           label.attr("title", () => entityName.text());
74366         }
74367       });
74368       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
74369       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
74370         return d2.domId;
74371       }).property("type", "text").property("value", function(d2) {
74372         return typeof d2.role === "string" ? d2.role : "";
74373       }).attr("title", function(d2) {
74374         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
74375       }).attr("placeholder", function(d2) {
74376         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
74377       }).classed("mixed", function(d2) {
74378         return Array.isArray(d2.role);
74379       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
74380       if (taginfo) {
74381         wrapEnter.each(bindTypeahead);
74382       }
74383       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
74384       newMembership.exit().remove();
74385       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
74386       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
74387       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
74388       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
74389         list.selectAll(".member-row-new").remove();
74390       });
74391       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
74392       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
74393       newMembership = newMembership.merge(newMembershipEnter);
74394       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
74395         nearbyCombo.on("accept", function(d2) {
74396           this.blur();
74397           acceptEntity.call(this, d2);
74398         }).on("cancel", cancelEntity)
74399       );
74400       var addRow = selection2.selectAll(".add-row").data([0]);
74401       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
74402       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
74403       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
74404       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
74405       addRowEnter.append("div").attr("class", "space-value");
74406       addRowEnter.append("div").attr("class", "space-buttons");
74407       addRow = addRow.merge(addRowEnter);
74408       addRow.select(".add-relation").on("click", function() {
74409         _showBlank = true;
74410         section.reRender();
74411         list.selectAll(".member-entity-input").node().focus();
74412       });
74413       function acceptEntity(d2) {
74414         if (!d2) {
74415           cancelEntity();
74416           return;
74417         }
74418         if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
74419         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
74420         addMembership(d2, role);
74421       }
74422       function cancelEntity() {
74423         var input = newMembership.selectAll(".member-entity-input");
74424         input.property("value", "");
74425         context.surface().selectAll(".highlighted").classed("highlighted", false);
74426       }
74427       function bindTypeahead(d2) {
74428         var row = select_default2(this);
74429         var role = row.selectAll("input.member-role");
74430         var origValue = role.property("value");
74431         function sort(value, data) {
74432           var sameletter = [];
74433           var other = [];
74434           for (var i3 = 0; i3 < data.length; i3++) {
74435             if (data[i3].value.substring(0, value.length) === value) {
74436               sameletter.push(data[i3]);
74437             } else {
74438               other.push(data[i3]);
74439             }
74440           }
74441           return sameletter.concat(other);
74442         }
74443         role.call(
74444           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
74445             var rtype = d2.relation.tags.type;
74446             taginfo.roles({
74447               debounce: true,
74448               rtype: rtype || "",
74449               geometry: context.graph().geometry(_entityIDs[0]),
74450               query: role2
74451             }, function(err, data) {
74452               if (!err) callback(sort(role2, data));
74453             });
74454           }).on("cancel", function() {
74455             role.property("value", origValue);
74456           })
74457         );
74458       }
74459       function unbind() {
74460         var row = select_default2(this);
74461         row.selectAll("input.member-role").call(uiCombobox.off, context);
74462       }
74463     }
74464     section.entityIDs = function(val) {
74465       if (!arguments.length) return _entityIDs;
74466       const didChange = _entityIDs.join(",") !== val.join(",");
74467       _entityIDs = val;
74468       _showBlank = false;
74469       if (didChange) {
74470         recentlyAdded.clear();
74471       }
74472       return section;
74473     };
74474     return section;
74475   }
74476   var init_raw_membership_editor = __esm({
74477     "modules/ui/sections/raw_membership_editor.js"() {
74478       "use strict";
74479       init_src5();
74480       init_presets();
74481       init_localizer();
74482       init_add_entity();
74483       init_add_member();
74484       init_change_member();
74485       init_delete_members();
74486       init_select5();
74487       init_osm();
74488       init_tags();
74489       init_services();
74490       init_icon();
74491       init_combobox();
74492       init_section();
74493       init_tooltip();
74494       init_array3();
74495       init_util();
74496     }
74497   });
74498
74499   // modules/ui/sections/selection_list.js
74500   var selection_list_exports = {};
74501   __export(selection_list_exports, {
74502     uiSectionSelectionList: () => uiSectionSelectionList
74503   });
74504   function uiSectionSelectionList(context) {
74505     var _selectedIDs = [];
74506     var section = uiSection("selected-features", context).shouldDisplay(function() {
74507       return _selectedIDs.length > 1;
74508     }).label(function() {
74509       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
74510     }).disclosureContent(renderDisclosureContent);
74511     context.history().on("change.selectionList", function(difference2) {
74512       if (difference2) {
74513         section.reRender();
74514       }
74515     });
74516     section.entityIDs = function(val) {
74517       if (!arguments.length) return _selectedIDs;
74518       _selectedIDs = val;
74519       return section;
74520     };
74521     function selectEntity(d3_event, entity) {
74522       context.enter(modeSelect(context, [entity.id]));
74523     }
74524     function deselectEntity(d3_event, entity) {
74525       var selectedIDs = _selectedIDs.slice();
74526       var index = selectedIDs.indexOf(entity.id);
74527       if (index > -1) {
74528         selectedIDs.splice(index, 1);
74529         context.enter(modeSelect(context, selectedIDs));
74530       }
74531     }
74532     function renderDisclosureContent(selection2) {
74533       var list = selection2.selectAll(".feature-list").data([0]);
74534       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
74535       var entities = _selectedIDs.map(function(id2) {
74536         return context.hasEntity(id2);
74537       }).filter(Boolean);
74538       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
74539       items.exit().remove();
74540       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
74541         select_default2(this).on("mouseover", function() {
74542           utilHighlightEntities([d2.id], true, context);
74543         }).on("mouseout", function() {
74544           utilHighlightEntities([d2.id], false, context);
74545         });
74546       });
74547       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
74548       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
74549       label.append("span").attr("class", "entity-type");
74550       label.append("span").attr("class", "entity-name");
74551       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
74552       items = items.merge(enter);
74553       items.selectAll(".entity-geom-icon use").attr("href", function() {
74554         var entity = this.parentNode.parentNode.__data__;
74555         return "#iD-icon-" + entity.geometry(context.graph());
74556       });
74557       items.selectAll(".entity-type").text(function(entity) {
74558         return _mainPresetIndex.match(entity, context.graph()).name();
74559       });
74560       items.selectAll(".entity-name").text(function(d2) {
74561         var entity = context.entity(d2.id);
74562         return utilDisplayName(entity);
74563       });
74564     }
74565     return section;
74566   }
74567   var init_selection_list = __esm({
74568     "modules/ui/sections/selection_list.js"() {
74569       "use strict";
74570       init_src5();
74571       init_presets();
74572       init_select5();
74573       init_osm();
74574       init_icon();
74575       init_section();
74576       init_localizer();
74577       init_util();
74578     }
74579   });
74580
74581   // modules/ui/entity_editor.js
74582   var entity_editor_exports = {};
74583   __export(entity_editor_exports, {
74584     uiEntityEditor: () => uiEntityEditor
74585   });
74586   function uiEntityEditor(context) {
74587     var dispatch14 = dispatch_default("choose");
74588     var _state = "select";
74589     var _coalesceChanges = false;
74590     var _modified = false;
74591     var _base;
74592     var _entityIDs;
74593     var _activePresets = [];
74594     var _newFeature;
74595     var _sections;
74596     function entityEditor(selection2) {
74597       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
74598       var header = selection2.selectAll(".header").data([0]);
74599       var headerEnter = header.enter().append("div").attr("class", "header fillL");
74600       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
74601       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
74602       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
74603         context.enter(modeBrowse(context));
74604       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
74605       headerEnter.append("h2");
74606       header = header.merge(headerEnter);
74607       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
74608       header.selectAll(".preset-reset").on("click", function() {
74609         dispatch14.call("choose", this, _activePresets);
74610       });
74611       var body = selection2.selectAll(".inspector-body").data([0]);
74612       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
74613       body = body.merge(bodyEnter);
74614       if (!_sections) {
74615         _sections = [
74616           uiSectionSelectionList(context),
74617           uiSectionFeatureType(context).on("choose", function(presets) {
74618             dispatch14.call("choose", this, presets);
74619           }),
74620           uiSectionEntityIssues(context),
74621           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
74622           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
74623           uiSectionRawMemberEditor(context),
74624           uiSectionRawMembershipEditor(context)
74625         ];
74626       }
74627       _sections.forEach(function(section) {
74628         if (section.entityIDs) {
74629           section.entityIDs(_entityIDs);
74630         }
74631         if (section.presets) {
74632           section.presets(_activePresets);
74633         }
74634         if (section.tags) {
74635           section.tags(combinedTags);
74636         }
74637         if (section.state) {
74638           section.state(_state);
74639         }
74640         body.call(section.render);
74641       });
74642       context.history().on("change.entity-editor", historyChanged);
74643       function historyChanged(difference2) {
74644         if (selection2.selectAll(".entity-editor").empty()) return;
74645         if (_state === "hide") return;
74646         var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
74647         if (!significant) return;
74648         _entityIDs = _entityIDs.filter(context.hasEntity);
74649         if (!_entityIDs.length) return;
74650         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
74651         loadActivePresets();
74652         var graph = context.graph();
74653         entityEditor.modified(_base !== graph);
74654         entityEditor(selection2);
74655         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
74656           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
74657         }
74658       }
74659     }
74660     function changeTags(entityIDs, changed, onInput) {
74661       var actions = [];
74662       for (var i3 in entityIDs) {
74663         var entityID = entityIDs[i3];
74664         var entity = context.entity(entityID);
74665         var tags = Object.assign({}, entity.tags);
74666         if (typeof changed === "function") {
74667           tags = changed(tags);
74668         } else {
74669           for (var k3 in changed) {
74670             if (!k3) continue;
74671             var v3 = changed[k3];
74672             if (typeof v3 === "object") {
74673               tags[k3] = tags[v3.oldKey];
74674             } else if (v3 !== void 0 || tags.hasOwnProperty(k3)) {
74675               tags[k3] = v3;
74676             }
74677           }
74678         }
74679         if (!onInput) {
74680           tags = utilCleanTags(tags);
74681         }
74682         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
74683           actions.push(actionChangeTags(entityID, tags));
74684         }
74685       }
74686       if (actions.length) {
74687         var combinedAction = function(graph) {
74688           actions.forEach(function(action) {
74689             graph = action(graph);
74690           });
74691           return graph;
74692         };
74693         var annotation = _t("operations.change_tags.annotation");
74694         if (_coalesceChanges) {
74695           context.overwrite(combinedAction, annotation);
74696         } else {
74697           context.perform(combinedAction, annotation);
74698         }
74699         _coalesceChanges = !!onInput;
74700       }
74701       if (!onInput) {
74702         context.validator().validate();
74703       }
74704     }
74705     function revertTags(keys2) {
74706       var actions = [];
74707       for (var i3 in _entityIDs) {
74708         var entityID = _entityIDs[i3];
74709         var original = context.graph().base().entities[entityID];
74710         var changed = {};
74711         for (var j3 in keys2) {
74712           var key = keys2[j3];
74713           changed[key] = original ? original.tags[key] : void 0;
74714         }
74715         var entity = context.entity(entityID);
74716         var tags = Object.assign({}, entity.tags);
74717         for (var k3 in changed) {
74718           if (!k3) continue;
74719           var v3 = changed[k3];
74720           if (v3 !== void 0 || tags.hasOwnProperty(k3)) {
74721             tags[k3] = v3;
74722           }
74723         }
74724         tags = utilCleanTags(tags);
74725         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
74726           actions.push(actionChangeTags(entityID, tags));
74727         }
74728       }
74729       if (actions.length) {
74730         var combinedAction = function(graph) {
74731           actions.forEach(function(action) {
74732             graph = action(graph);
74733           });
74734           return graph;
74735         };
74736         var annotation = _t("operations.change_tags.annotation");
74737         if (_coalesceChanges) {
74738           context.overwrite(combinedAction, annotation);
74739         } else {
74740           context.perform(combinedAction, annotation);
74741         }
74742       }
74743       context.validator().validate();
74744     }
74745     entityEditor.modified = function(val) {
74746       if (!arguments.length) return _modified;
74747       _modified = val;
74748       return entityEditor;
74749     };
74750     entityEditor.state = function(val) {
74751       if (!arguments.length) return _state;
74752       _state = val;
74753       return entityEditor;
74754     };
74755     entityEditor.entityIDs = function(val) {
74756       if (!arguments.length) return _entityIDs;
74757       _base = context.graph();
74758       _coalesceChanges = false;
74759       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor;
74760       _entityIDs = val;
74761       loadActivePresets(true);
74762       return entityEditor.modified(false);
74763     };
74764     entityEditor.newFeature = function(val) {
74765       if (!arguments.length) return _newFeature;
74766       _newFeature = val;
74767       return entityEditor;
74768     };
74769     function loadActivePresets(isForNewSelection) {
74770       var graph = context.graph();
74771       var counts = {};
74772       for (var i3 in _entityIDs) {
74773         var entity = graph.hasEntity(_entityIDs[i3]);
74774         if (!entity) return;
74775         var match = _mainPresetIndex.match(entity, graph);
74776         if (!counts[match.id]) counts[match.id] = 0;
74777         counts[match.id] += 1;
74778       }
74779       var matches = Object.keys(counts).sort(function(p1, p2) {
74780         return counts[p2] - counts[p1];
74781       }).map(function(pID) {
74782         return _mainPresetIndex.item(pID);
74783       });
74784       if (!isForNewSelection) {
74785         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
74786         if (weakPreset && matches.length === 1 && matches[0].isFallback()) return;
74787       }
74788       entityEditor.presets(matches);
74789     }
74790     entityEditor.presets = function(val) {
74791       if (!arguments.length) return _activePresets;
74792       if (!utilArrayIdentical(val, _activePresets)) {
74793         _activePresets = val;
74794       }
74795       return entityEditor;
74796     };
74797     return utilRebind(entityEditor, dispatch14, "on");
74798   }
74799   var import_fast_deep_equal10;
74800   var init_entity_editor = __esm({
74801     "modules/ui/entity_editor.js"() {
74802       "use strict";
74803       init_src4();
74804       import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
74805       init_presets();
74806       init_localizer();
74807       init_change_tags();
74808       init_browse();
74809       init_icon();
74810       init_array3();
74811       init_util();
74812       init_entity_issues();
74813       init_feature_type();
74814       init_preset_fields();
74815       init_raw_member_editor();
74816       init_raw_membership_editor();
74817       init_raw_tag_editor();
74818       init_selection_list();
74819     }
74820   });
74821
74822   // modules/ui/preset_list.js
74823   var preset_list_exports = {};
74824   __export(preset_list_exports, {
74825     uiPresetList: () => uiPresetList
74826   });
74827   function uiPresetList(context) {
74828     var dispatch14 = dispatch_default("cancel", "choose");
74829     var _entityIDs;
74830     var _currLoc;
74831     var _currentPresets;
74832     var _autofocus = false;
74833     function presetList(selection2) {
74834       if (!_entityIDs) return;
74835       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
74836       selection2.html("");
74837       var messagewrap = selection2.append("div").attr("class", "header fillL");
74838       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
74839       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
74840         dispatch14.call("cancel", this);
74841       }).call(svgIcon("#iD-icon-close"));
74842       function initialKeydown(d3_event) {
74843         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
74844           d3_event.preventDefault();
74845           d3_event.stopPropagation();
74846           operationDelete(context, _entityIDs)();
74847         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
74848           d3_event.preventDefault();
74849           d3_event.stopPropagation();
74850           context.undo();
74851         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
74852           select_default2(this).on("keydown", keydown);
74853           keydown.call(this, d3_event);
74854         }
74855       }
74856       function keydown(d3_event) {
74857         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
74858         search.node().selectionStart === search.property("value").length) {
74859           d3_event.preventDefault();
74860           d3_event.stopPropagation();
74861           var buttons = list.selectAll(".preset-list-button");
74862           if (!buttons.empty()) buttons.nodes()[0].focus();
74863         }
74864       }
74865       function keypress(d3_event) {
74866         var value = search.property("value");
74867         if (d3_event.keyCode === 13 && // ↩ Return
74868         value.length) {
74869           list.selectAll(".preset-list-item:first-child").each(function(d2) {
74870             d2.choose.call(this);
74871           });
74872         }
74873       }
74874       function inputevent() {
74875         var value = search.property("value");
74876         list.classed("filtered", value.length);
74877         var results, messageText;
74878         if (value.length) {
74879           results = presets.search(value, entityGeometries()[0], _currLoc);
74880           messageText = _t.html("inspector.results", {
74881             n: results.collection.length,
74882             search: value
74883           });
74884         } else {
74885           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
74886           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
74887           messageText = _t.html("inspector.choose");
74888         }
74889         list.call(drawList, results);
74890         message.html(messageText);
74891       }
74892       var searchWrap = selection2.append("div").attr("class", "search-header");
74893       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
74894       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));
74895       if (_autofocus) {
74896         search.node().focus();
74897         setTimeout(function() {
74898           search.node().focus();
74899         }, 0);
74900       }
74901       var listWrap = selection2.append("div").attr("class", "inspector-body");
74902       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
74903       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
74904       context.features().on("change.preset-list", updateForFeatureHiddenState);
74905     }
74906     function drawList(list, presets) {
74907       presets = presets.matchAllGeometry(entityGeometries());
74908       var collection = presets.collection.reduce(function(collection2, preset) {
74909         if (!preset) return collection2;
74910         if (preset.members) {
74911           if (preset.members.collection.filter(function(preset2) {
74912             return preset2.addable();
74913           }).length > 1) {
74914             collection2.push(CategoryItem(preset));
74915           }
74916         } else if (preset.addable()) {
74917           collection2.push(PresetItem(preset));
74918         }
74919         return collection2;
74920       }, []);
74921       var items = list.selectAll(".preset-list-item").data(collection, function(d2) {
74922         return d2.preset.id;
74923       });
74924       items.order();
74925       items.exit().remove();
74926       items.enter().append("div").attr("class", function(item) {
74927         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
74928       }).classed("current", function(item) {
74929         return _currentPresets.indexOf(item.preset) !== -1;
74930       }).each(function(item) {
74931         select_default2(this).call(item);
74932       }).style("opacity", 0).transition().style("opacity", 1);
74933       updateForFeatureHiddenState();
74934     }
74935     function itemKeydown(d3_event) {
74936       var item = select_default2(this.closest(".preset-list-item"));
74937       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
74938       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
74939         d3_event.preventDefault();
74940         d3_event.stopPropagation();
74941         var nextItem = select_default2(item.node().nextElementSibling);
74942         if (nextItem.empty()) {
74943           if (!parentItem.empty()) {
74944             nextItem = select_default2(parentItem.node().nextElementSibling);
74945           }
74946         } else if (select_default2(this).classed("expanded")) {
74947           nextItem = item.select(".subgrid .preset-list-item:first-child");
74948         }
74949         if (!nextItem.empty()) {
74950           nextItem.select(".preset-list-button").node().focus();
74951         }
74952       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
74953         d3_event.preventDefault();
74954         d3_event.stopPropagation();
74955         var previousItem = select_default2(item.node().previousElementSibling);
74956         if (previousItem.empty()) {
74957           if (!parentItem.empty()) {
74958             previousItem = parentItem;
74959           }
74960         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
74961           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
74962         }
74963         if (!previousItem.empty()) {
74964           previousItem.select(".preset-list-button").node().focus();
74965         } else {
74966           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
74967           search.node().focus();
74968         }
74969       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
74970         d3_event.preventDefault();
74971         d3_event.stopPropagation();
74972         if (!parentItem.empty()) {
74973           parentItem.select(".preset-list-button").node().focus();
74974         }
74975       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
74976         d3_event.preventDefault();
74977         d3_event.stopPropagation();
74978         item.datum().choose.call(select_default2(this).node());
74979       }
74980     }
74981     function CategoryItem(preset) {
74982       var box, sublist, shown = false;
74983       function item(selection2) {
74984         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
74985         function click() {
74986           var isExpanded = select_default2(this).classed("expanded");
74987           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
74988           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
74989           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
74990           item.choose();
74991         }
74992         var geometries = entityGeometries();
74993         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) {
74994           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
74995             d3_event.preventDefault();
74996             d3_event.stopPropagation();
74997             if (!select_default2(this).classed("expanded")) {
74998               click.call(this, d3_event);
74999             }
75000           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
75001             d3_event.preventDefault();
75002             d3_event.stopPropagation();
75003             if (select_default2(this).classed("expanded")) {
75004               click.call(this, d3_event);
75005             }
75006           } else {
75007             itemKeydown.call(this, d3_event);
75008           }
75009         });
75010         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
75011         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");
75012         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
75013         box.append("div").attr("class", "arrow");
75014         sublist = box.append("div").attr("class", "preset-list fillL3");
75015       }
75016       item.choose = function() {
75017         if (!box || !sublist) return;
75018         if (shown) {
75019           shown = false;
75020           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
75021         } else {
75022           shown = true;
75023           var members = preset.members.matchAllGeometry(entityGeometries());
75024           sublist.call(drawList, members);
75025           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
75026         }
75027       };
75028       item.preset = preset;
75029       return item;
75030     }
75031     function PresetItem(preset) {
75032       function item(selection2) {
75033         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
75034         var geometries = entityGeometries();
75035         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);
75036         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
75037         var nameparts = [
75038           preset.nameLabel(),
75039           preset.subtitleLabel()
75040         ].filter(Boolean);
75041         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
75042           d2(select_default2(this));
75043         });
75044         wrap2.call(item.reference.button);
75045         selection2.call(item.reference.body);
75046       }
75047       item.choose = function() {
75048         if (select_default2(this).classed("disabled")) return;
75049         if (!context.inIntro()) {
75050           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
75051         }
75052         context.perform(
75053           function(graph) {
75054             for (var i3 in _entityIDs) {
75055               var entityID = _entityIDs[i3];
75056               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
75057               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
75058             }
75059             return graph;
75060           },
75061           _t("operations.change_tags.annotation")
75062         );
75063         context.validator().validate();
75064         dispatch14.call("choose", this, preset);
75065       };
75066       item.help = function(d3_event) {
75067         d3_event.stopPropagation();
75068         item.reference.toggle();
75069       };
75070       item.preset = preset;
75071       item.reference = uiTagReference(preset.reference(), context);
75072       return item;
75073     }
75074     function updateForFeatureHiddenState() {
75075       if (!_entityIDs.every(context.hasEntity)) return;
75076       var geometries = entityGeometries();
75077       var button = context.container().selectAll(".preset-list .preset-list-button");
75078       button.call(uiTooltip().destroyAny);
75079       button.each(function(item, index) {
75080         var hiddenPresetFeaturesId;
75081         for (var i3 in geometries) {
75082           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
75083           if (hiddenPresetFeaturesId) break;
75084         }
75085         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
75086         select_default2(this).classed("disabled", isHiddenPreset);
75087         if (isHiddenPreset) {
75088           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
75089           select_default2(this).call(
75090             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
75091               features: _t("feature." + hiddenPresetFeaturesId + ".description")
75092             })).placement(index < 2 ? "bottom" : "top")
75093           );
75094         }
75095       });
75096     }
75097     presetList.autofocus = function(val) {
75098       if (!arguments.length) return _autofocus;
75099       _autofocus = val;
75100       return presetList;
75101     };
75102     presetList.entityIDs = function(val) {
75103       if (!arguments.length) return _entityIDs;
75104       _entityIDs = val;
75105       _currLoc = null;
75106       if (_entityIDs && _entityIDs.length) {
75107         const extent = _entityIDs.reduce(function(extent2, entityID) {
75108           var entity = context.graph().entity(entityID);
75109           return extent2.extend(entity.extent(context.graph()));
75110         }, geoExtent());
75111         _currLoc = extent.center();
75112         var presets = _entityIDs.map(function(entityID) {
75113           return _mainPresetIndex.match(context.entity(entityID), context.graph());
75114         });
75115         presetList.presets(presets);
75116       }
75117       return presetList;
75118     };
75119     presetList.presets = function(val) {
75120       if (!arguments.length) return _currentPresets;
75121       _currentPresets = val;
75122       return presetList;
75123     };
75124     function entityGeometries() {
75125       var counts = {};
75126       for (var i3 in _entityIDs) {
75127         var entityID = _entityIDs[i3];
75128         var entity = context.entity(entityID);
75129         var geometry = entity.geometry(context.graph());
75130         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
75131           geometry = "point";
75132         }
75133         if (!counts[geometry]) counts[geometry] = 0;
75134         counts[geometry] += 1;
75135       }
75136       return Object.keys(counts).sort(function(geom1, geom2) {
75137         return counts[geom2] - counts[geom1];
75138       });
75139     }
75140     return utilRebind(presetList, dispatch14, "on");
75141   }
75142   var init_preset_list = __esm({
75143     "modules/ui/preset_list.js"() {
75144       "use strict";
75145       init_src4();
75146       init_src5();
75147       init_debounce();
75148       init_presets();
75149       init_localizer();
75150       init_change_preset();
75151       init_delete();
75152       init_svg();
75153       init_tooltip();
75154       init_extent();
75155       init_preset_icon();
75156       init_tag_reference();
75157       init_util();
75158     }
75159   });
75160
75161   // modules/ui/inspector.js
75162   var inspector_exports = {};
75163   __export(inspector_exports, {
75164     uiInspector: () => uiInspector
75165   });
75166   function uiInspector(context) {
75167     var presetList = uiPresetList(context);
75168     var entityEditor = uiEntityEditor(context);
75169     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
75170     var _state = "select";
75171     var _entityIDs;
75172     var _newFeature = false;
75173     function inspector(selection2) {
75174       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
75175         inspector.setPreset();
75176       });
75177       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
75178       wrap2 = selection2.selectAll(".panewrap").data([0]);
75179       var enter = wrap2.enter().append("div").attr("class", "panewrap");
75180       enter.append("div").attr("class", "preset-list-pane pane");
75181       enter.append("div").attr("class", "entity-editor-pane pane");
75182       wrap2 = wrap2.merge(enter);
75183       presetPane = wrap2.selectAll(".preset-list-pane");
75184       editorPane = wrap2.selectAll(".entity-editor-pane");
75185       function shouldDefaultToPresetList() {
75186         if (_state !== "select") return false;
75187         if (_entityIDs.length !== 1) return false;
75188         var entityID = _entityIDs[0];
75189         var entity = context.hasEntity(entityID);
75190         if (!entity) return false;
75191         if (entity.hasNonGeometryTags()) return false;
75192         if (_newFeature) return true;
75193         if (entity.geometry(context.graph()) !== "vertex") return false;
75194         if (context.graph().parentRelations(entity).length) return false;
75195         if (context.validator().getEntityIssues(entityID).length) return false;
75196         if (entity.type === "node" && entity.isHighwayIntersection(context.graph())) return false;
75197         return true;
75198       }
75199       if (shouldDefaultToPresetList()) {
75200         wrap2.style("right", "-100%");
75201         editorPane.classed("hide", true);
75202         presetPane.classed("hide", false).call(presetList);
75203       } else {
75204         wrap2.style("right", "0%");
75205         presetPane.classed("hide", true);
75206         editorPane.classed("hide", false).call(entityEditor);
75207       }
75208       var footer = selection2.selectAll(".footer").data([0]);
75209       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
75210       footer.call(
75211         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
75212       );
75213     }
75214     inspector.showList = function(presets) {
75215       presetPane.classed("hide", false);
75216       wrap2.transition().styleTween("right", function() {
75217         return value_default("0%", "-100%");
75218       }).on("end", function() {
75219         editorPane.classed("hide", true);
75220       });
75221       if (presets) {
75222         presetList.presets(presets);
75223       }
75224       presetPane.call(presetList.autofocus(true));
75225     };
75226     inspector.setPreset = function(preset) {
75227       if (preset && preset.id === "type/multipolygon") {
75228         presetPane.call(presetList.autofocus(true));
75229       } else {
75230         editorPane.classed("hide", false);
75231         wrap2.transition().styleTween("right", function() {
75232           return value_default("-100%", "0%");
75233         }).on("end", function() {
75234           presetPane.classed("hide", true);
75235         });
75236         if (preset) {
75237           entityEditor.presets([preset]);
75238         }
75239         editorPane.call(entityEditor);
75240       }
75241     };
75242     inspector.state = function(val) {
75243       if (!arguments.length) return _state;
75244       _state = val;
75245       entityEditor.state(_state);
75246       context.container().selectAll(".field-help-body").remove();
75247       return inspector;
75248     };
75249     inspector.entityIDs = function(val) {
75250       if (!arguments.length) return _entityIDs;
75251       _entityIDs = val;
75252       return inspector;
75253     };
75254     inspector.newFeature = function(val) {
75255       if (!arguments.length) return _newFeature;
75256       _newFeature = val;
75257       return inspector;
75258     };
75259     return inspector;
75260   }
75261   var init_inspector = __esm({
75262     "modules/ui/inspector.js"() {
75263       "use strict";
75264       init_src8();
75265       init_src5();
75266       init_entity_editor();
75267       init_preset_list();
75268       init_view_on_osm();
75269     }
75270   });
75271
75272   // modules/ui/sidebar.js
75273   var sidebar_exports = {};
75274   __export(sidebar_exports, {
75275     uiSidebar: () => uiSidebar
75276   });
75277   function uiSidebar(context) {
75278     var inspector = uiInspector(context);
75279     var dataEditor = uiDataEditor(context);
75280     var noteEditor = uiNoteEditor(context);
75281     var keepRightEditor = uiKeepRightEditor(context);
75282     var osmoseEditor = uiOsmoseEditor(context);
75283     var _current;
75284     var _wasData = false;
75285     var _wasNote = false;
75286     var _wasQaItem = false;
75287     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
75288     function sidebar(selection2) {
75289       var container = context.container();
75290       var minWidth = 240;
75291       var sidebarWidth;
75292       var containerWidth;
75293       var dragOffset;
75294       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
75295       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
75296       var downPointerId, lastClientX, containerLocGetter;
75297       function pointerdown(d3_event) {
75298         if (downPointerId) return;
75299         if ("button" in d3_event && d3_event.button !== 0) return;
75300         downPointerId = d3_event.pointerId || "mouse";
75301         lastClientX = d3_event.clientX;
75302         containerLocGetter = utilFastMouse(container.node());
75303         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
75304         sidebarWidth = selection2.node().getBoundingClientRect().width;
75305         containerWidth = container.node().getBoundingClientRect().width;
75306         var widthPct = sidebarWidth / containerWidth * 100;
75307         selection2.style("width", widthPct + "%").style("max-width", "85%");
75308         resizer.classed("dragging", true);
75309         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
75310           d3_event2.preventDefault();
75311         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
75312       }
75313       function pointermove(d3_event) {
75314         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
75315         d3_event.preventDefault();
75316         var dx = d3_event.clientX - lastClientX;
75317         lastClientX = d3_event.clientX;
75318         var isRTL = _mainLocalizer.textDirection() === "rtl";
75319         var scaleX = isRTL ? 0 : 1;
75320         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
75321         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
75322         sidebarWidth = isRTL ? containerWidth - x2 : x2;
75323         var isCollapsed = selection2.classed("collapsed");
75324         var shouldCollapse = sidebarWidth < minWidth;
75325         selection2.classed("collapsed", shouldCollapse);
75326         if (shouldCollapse) {
75327           if (!isCollapsed) {
75328             selection2.style(xMarginProperty, "-400px").style("width", "400px");
75329             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
75330           }
75331         } else {
75332           var widthPct = sidebarWidth / containerWidth * 100;
75333           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
75334           if (isCollapsed) {
75335             context.ui().onResize([-sidebarWidth * scaleX, 0]);
75336           } else {
75337             context.ui().onResize([-dx * scaleX, 0]);
75338           }
75339         }
75340       }
75341       function pointerup(d3_event) {
75342         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
75343         downPointerId = null;
75344         resizer.classed("dragging", false);
75345         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
75346       }
75347       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
75348       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
75349       var hoverModeSelect = function(targets) {
75350         context.container().selectAll(".feature-list-item button").classed("hover", false);
75351         if (context.selectedIDs().length > 1 && targets && targets.length) {
75352           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
75353             return targets.indexOf(node) !== -1;
75354           });
75355           if (!elements.empty()) {
75356             elements.classed("hover", true);
75357           }
75358         }
75359       };
75360       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
75361       function hover(targets) {
75362         var datum2 = targets && targets.length && targets[0];
75363         if (datum2 && datum2.__featurehash__) {
75364           _wasData = true;
75365           sidebar.show(dataEditor.datum(datum2));
75366           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75367         } else if (datum2 instanceof osmNote) {
75368           if (context.mode().id === "drag-note") return;
75369           _wasNote = true;
75370           var osm = services.osm;
75371           if (osm) {
75372             datum2 = osm.getNote(datum2.id);
75373           }
75374           sidebar.show(noteEditor.note(datum2));
75375           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75376         } else if (datum2 instanceof QAItem) {
75377           _wasQaItem = true;
75378           var errService = services[datum2.service];
75379           if (errService) {
75380             datum2 = errService.getError(datum2.id);
75381           }
75382           var errEditor;
75383           if (datum2.service === "keepRight") {
75384             errEditor = keepRightEditor;
75385           } else {
75386             errEditor = osmoseEditor;
75387           }
75388           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
75389             return d2.id === datum2.id;
75390           });
75391           sidebar.show(errEditor.error(datum2));
75392           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75393         } else if (!_current && datum2 instanceof osmEntity) {
75394           featureListWrap.classed("inspector-hidden", true);
75395           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
75396           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
75397             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
75398             inspectorWrap.call(inspector);
75399           }
75400         } else if (!_current) {
75401           featureListWrap.classed("inspector-hidden", false);
75402           inspectorWrap.classed("inspector-hidden", true);
75403           inspector.state("hide");
75404         } else if (_wasData || _wasNote || _wasQaItem) {
75405           _wasNote = false;
75406           _wasData = false;
75407           _wasQaItem = false;
75408           context.container().selectAll(".note").classed("hover", false);
75409           context.container().selectAll(".qaItem").classed("hover", false);
75410           sidebar.hide();
75411         }
75412       }
75413       sidebar.hover = throttle_default(hover, 200);
75414       sidebar.intersects = function(extent) {
75415         var rect = selection2.node().getBoundingClientRect();
75416         return extent.intersects([
75417           context.projection.invert([0, rect.height]),
75418           context.projection.invert([rect.width, 0])
75419         ]);
75420       };
75421       sidebar.select = function(ids, newFeature) {
75422         sidebar.hide();
75423         if (ids && ids.length) {
75424           var entity = ids.length === 1 && context.entity(ids[0]);
75425           if (entity && newFeature && selection2.classed("collapsed")) {
75426             var extent = entity.extent(context.graph());
75427             sidebar.expand(sidebar.intersects(extent));
75428           }
75429           featureListWrap.classed("inspector-hidden", true);
75430           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
75431           inspector.state("select").entityIDs(ids).newFeature(newFeature);
75432           inspectorWrap.call(inspector);
75433         } else {
75434           inspector.state("hide");
75435         }
75436       };
75437       sidebar.showPresetList = function() {
75438         inspector.showList();
75439       };
75440       sidebar.show = function(component, element) {
75441         featureListWrap.classed("inspector-hidden", true);
75442         inspectorWrap.classed("inspector-hidden", true);
75443         if (_current) _current.remove();
75444         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
75445       };
75446       sidebar.hide = function() {
75447         featureListWrap.classed("inspector-hidden", false);
75448         inspectorWrap.classed("inspector-hidden", true);
75449         if (_current) _current.remove();
75450         _current = null;
75451       };
75452       sidebar.expand = function(moveMap) {
75453         if (selection2.classed("collapsed")) {
75454           sidebar.toggle(moveMap);
75455         }
75456       };
75457       sidebar.collapse = function(moveMap) {
75458         if (!selection2.classed("collapsed")) {
75459           sidebar.toggle(moveMap);
75460         }
75461       };
75462       sidebar.toggle = function(moveMap) {
75463         if (context.inIntro()) return;
75464         var isCollapsed = selection2.classed("collapsed");
75465         var isCollapsing = !isCollapsed;
75466         var isRTL = _mainLocalizer.textDirection() === "rtl";
75467         var scaleX = isRTL ? 0 : 1;
75468         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
75469         sidebarWidth = selection2.node().getBoundingClientRect().width;
75470         selection2.style("width", sidebarWidth + "px");
75471         var startMargin, endMargin, lastMargin;
75472         if (isCollapsing) {
75473           startMargin = lastMargin = 0;
75474           endMargin = -sidebarWidth;
75475         } else {
75476           startMargin = lastMargin = -sidebarWidth;
75477           endMargin = 0;
75478         }
75479         if (!isCollapsing) {
75480           selection2.classed("collapsed", isCollapsing);
75481         }
75482         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
75483           var i3 = number_default(startMargin, endMargin);
75484           return function(t2) {
75485             var dx = lastMargin - Math.round(i3(t2));
75486             lastMargin = lastMargin - dx;
75487             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
75488           };
75489         }).on("end", function() {
75490           if (isCollapsing) {
75491             selection2.classed("collapsed", isCollapsing);
75492           }
75493           if (!isCollapsing) {
75494             var containerWidth2 = container.node().getBoundingClientRect().width;
75495             var widthPct = sidebarWidth / containerWidth2 * 100;
75496             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
75497           }
75498         });
75499       };
75500       resizer.on("dblclick", function(d3_event) {
75501         d3_event.preventDefault();
75502         if (d3_event.sourceEvent) {
75503           d3_event.sourceEvent.preventDefault();
75504         }
75505         sidebar.toggle();
75506       });
75507       context.map().on("crossEditableZoom.sidebar", function(within) {
75508         if (!within && !selection2.select(".inspector-hover").empty()) {
75509           hover([]);
75510         }
75511       });
75512     }
75513     sidebar.showPresetList = function() {
75514     };
75515     sidebar.hover = function() {
75516     };
75517     sidebar.hover.cancel = function() {
75518     };
75519     sidebar.intersects = function() {
75520     };
75521     sidebar.select = function() {
75522     };
75523     sidebar.show = function() {
75524     };
75525     sidebar.hide = function() {
75526     };
75527     sidebar.expand = function() {
75528     };
75529     sidebar.collapse = function() {
75530     };
75531     sidebar.toggle = function() {
75532     };
75533     return sidebar;
75534   }
75535   var init_sidebar = __esm({
75536     "modules/ui/sidebar.js"() {
75537       "use strict";
75538       init_throttle();
75539       init_src8();
75540       init_src5();
75541       init_array3();
75542       init_util();
75543       init_osm();
75544       init_services();
75545       init_data_editor();
75546       init_feature_list();
75547       init_inspector();
75548       init_keepRight_editor();
75549       init_osmose_editor();
75550       init_note_editor();
75551       init_localizer();
75552     }
75553   });
75554
75555   // modules/ui/source_switch.js
75556   var source_switch_exports = {};
75557   __export(source_switch_exports, {
75558     uiSourceSwitch: () => uiSourceSwitch
75559   });
75560   function uiSourceSwitch(context) {
75561     var keys2;
75562     function click(d3_event) {
75563       d3_event.preventDefault();
75564       var osm = context.connection();
75565       if (!osm) return;
75566       if (context.inIntro()) return;
75567       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes"))) return;
75568       var isLive = select_default2(this).classed("live");
75569       isLive = !isLive;
75570       context.enter(modeBrowse(context));
75571       context.history().clearSaved();
75572       context.flush();
75573       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
75574       osm.switch(isLive ? keys2[0] : keys2[1]);
75575     }
75576     var sourceSwitch = function(selection2) {
75577       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
75578     };
75579     sourceSwitch.keys = function(_3) {
75580       if (!arguments.length) return keys2;
75581       keys2 = _3;
75582       return sourceSwitch;
75583     };
75584     return sourceSwitch;
75585   }
75586   var init_source_switch = __esm({
75587     "modules/ui/source_switch.js"() {
75588       "use strict";
75589       init_src5();
75590       init_localizer();
75591       init_browse();
75592     }
75593   });
75594
75595   // modules/ui/spinner.js
75596   var spinner_exports = {};
75597   __export(spinner_exports, {
75598     uiSpinner: () => uiSpinner
75599   });
75600   function uiSpinner(context) {
75601     var osm = context.connection();
75602     return function(selection2) {
75603       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
75604       if (osm) {
75605         osm.on("loading.spinner", function() {
75606           img.transition().style("opacity", 1);
75607         }).on("loaded.spinner", function() {
75608           img.transition().style("opacity", 0);
75609         });
75610       }
75611     };
75612   }
75613   var init_spinner = __esm({
75614     "modules/ui/spinner.js"() {
75615       "use strict";
75616     }
75617   });
75618
75619   // modules/ui/sections/privacy.js
75620   var privacy_exports = {};
75621   __export(privacy_exports, {
75622     uiSectionPrivacy: () => uiSectionPrivacy
75623   });
75624   function uiSectionPrivacy(context) {
75625     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
75626     function renderDisclosureContent(selection2) {
75627       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
75628       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(
75629         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
75630       );
75631       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
75632         d3_event.preventDefault();
75633         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
75634       });
75635       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
75636       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
75637       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"));
75638     }
75639     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
75640     return section;
75641   }
75642   var init_privacy = __esm({
75643     "modules/ui/sections/privacy.js"() {
75644       "use strict";
75645       init_preferences();
75646       init_localizer();
75647       init_tooltip();
75648       init_icon();
75649       init_section();
75650     }
75651   });
75652
75653   // modules/ui/splash.js
75654   var splash_exports = {};
75655   __export(splash_exports, {
75656     uiSplash: () => uiSplash
75657   });
75658   function uiSplash(context) {
75659     return (selection2) => {
75660       if (context.history().hasRestorableChanges()) return;
75661       let updateMessage = "";
75662       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
75663       let showSplash = !corePreferences("sawSplash");
75664       if (sawPrivacyVersion && sawPrivacyVersion !== context.privacyVersion) {
75665         updateMessage = _t("splash.privacy_update");
75666         showSplash = true;
75667       }
75668       if (!showSplash) return;
75669       corePreferences("sawSplash", true);
75670       corePreferences("sawPrivacyVersion", context.privacyVersion);
75671       _mainFileFetcher.get("intro_graph");
75672       let modalSelection = uiModal(selection2);
75673       modalSelection.select(".modal").attr("class", "modal-splash modal");
75674       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
75675       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
75676       let modalSection = introModal.append("div").attr("class", "modal-section");
75677       modalSection.append("p").html(_t.html("splash.text", {
75678         version: context.version,
75679         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
75680         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
75681       }));
75682       modalSection.append("p").html(_t.html("splash.privacy", {
75683         updateMessage,
75684         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
75685       }));
75686       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
75687       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
75688       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
75689         context.container().call(uiIntro(context));
75690         modalSelection.close();
75691       });
75692       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
75693       walkthrough.append("div").call(_t.append("splash.walkthrough"));
75694       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
75695       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
75696       startEditing.append("div").call(_t.append("splash.start"));
75697       modalSelection.select("button.close").attr("class", "hide");
75698     };
75699   }
75700   var init_splash = __esm({
75701     "modules/ui/splash.js"() {
75702       "use strict";
75703       init_preferences();
75704       init_file_fetcher();
75705       init_localizer();
75706       init_intro2();
75707       init_modal();
75708       init_privacy();
75709     }
75710   });
75711
75712   // modules/ui/status.js
75713   var status_exports = {};
75714   __export(status_exports, {
75715     uiStatus: () => uiStatus
75716   });
75717   function uiStatus(context) {
75718     var osm = context.connection();
75719     return function(selection2) {
75720       if (!osm) return;
75721       function update(err, apiStatus) {
75722         selection2.html("");
75723         if (err) {
75724           if (apiStatus === "connectionSwitched") {
75725             return;
75726           } else if (apiStatus === "rateLimited") {
75727             if (!osm.authenticated()) {
75728               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) {
75729                 d3_event.preventDefault();
75730                 osm.authenticate();
75731               });
75732             } else {
75733               selection2.call(_t.append("osm_api_status.message.rateLimited"));
75734             }
75735           } else {
75736             var throttledRetry = throttle_default(function() {
75737               context.loadTiles(context.projection);
75738               osm.reloadApiStatus();
75739             }, 2e3);
75740             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) {
75741               d3_event.preventDefault();
75742               throttledRetry();
75743             });
75744           }
75745         } else if (apiStatus === "readonly") {
75746           selection2.call(_t.append("osm_api_status.message.readonly"));
75747         } else if (apiStatus === "offline") {
75748           selection2.call(_t.append("osm_api_status.message.offline"));
75749         }
75750         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
75751       }
75752       osm.on("apiStatusChange.uiStatus", update);
75753       context.history().on("storage_error", () => {
75754         selection2.selectAll("span.local-storage-full").remove();
75755         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
75756         selection2.classed("error", true);
75757       });
75758       window.setInterval(function() {
75759         osm.reloadApiStatus();
75760       }, 9e4);
75761       osm.reloadApiStatus();
75762     };
75763   }
75764   var init_status = __esm({
75765     "modules/ui/status.js"() {
75766       "use strict";
75767       init_throttle();
75768       init_localizer();
75769       init_icon();
75770     }
75771   });
75772
75773   // modules/ui/tools/modes.js
75774   var modes_exports = {};
75775   __export(modes_exports, {
75776     uiToolDrawModes: () => uiToolDrawModes
75777   });
75778   function uiToolDrawModes(context) {
75779     var tool = {
75780       id: "old_modes",
75781       label: _t.append("toolbar.add_feature")
75782     };
75783     var modes = [
75784       modeAddPoint(context, {
75785         title: _t.append("modes.add_point.title"),
75786         button: "point",
75787         description: _t.append("modes.add_point.description"),
75788         preset: _mainPresetIndex.item("point"),
75789         key: "1"
75790       }),
75791       modeAddLine(context, {
75792         title: _t.append("modes.add_line.title"),
75793         button: "line",
75794         description: _t.append("modes.add_line.description"),
75795         preset: _mainPresetIndex.item("line"),
75796         key: "2"
75797       }),
75798       modeAddArea(context, {
75799         title: _t.append("modes.add_area.title"),
75800         button: "area",
75801         description: _t.append("modes.add_area.description"),
75802         preset: _mainPresetIndex.item("area"),
75803         key: "3"
75804       })
75805     ];
75806     function enabled(_mode) {
75807       return osmEditable();
75808     }
75809     function osmEditable() {
75810       return context.editable();
75811     }
75812     modes.forEach(function(mode) {
75813       context.keybinding().on(mode.key, function() {
75814         if (!enabled(mode)) return;
75815         if (mode.id === context.mode().id) {
75816           context.enter(modeBrowse(context));
75817         } else {
75818           context.enter(mode);
75819         }
75820       });
75821     });
75822     tool.render = function(selection2) {
75823       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
75824       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
75825       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
75826       context.on("enter.modes", update);
75827       update();
75828       function update() {
75829         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
75830           return d2.id;
75831         });
75832         buttons.exit().remove();
75833         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
75834           return d2.id + " add-button bar-button";
75835         }).on("click.mode-buttons", function(d3_event, d2) {
75836           if (!enabled(d2)) return;
75837           var currMode = context.mode().id;
75838           if (/^draw/.test(currMode)) return;
75839           if (d2.id === currMode) {
75840             context.enter(modeBrowse(context));
75841           } else {
75842             context.enter(d2);
75843           }
75844         }).call(
75845           uiTooltip().placement("bottom").title(function(d2) {
75846             return d2.description;
75847           }).keys(function(d2) {
75848             return [d2.key];
75849           }).scrollContainer(context.container().select(".top-toolbar"))
75850         );
75851         buttonsEnter.each(function(d2) {
75852           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
75853         });
75854         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
75855           mode.title(select_default2(this));
75856         });
75857         if (buttons.enter().size() || buttons.exit().size()) {
75858           context.ui().checkOverflow(".top-toolbar", true);
75859         }
75860         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
75861           return !enabled(d2);
75862         }).classed("disabled", function(d2) {
75863           return !enabled(d2);
75864         }).attr("aria-pressed", function(d2) {
75865           return context.mode() && context.mode().button === d2.button;
75866         }).classed("active", function(d2) {
75867           return context.mode() && context.mode().button === d2.button;
75868         });
75869       }
75870     };
75871     return tool;
75872   }
75873   var init_modes = __esm({
75874     "modules/ui/tools/modes.js"() {
75875       "use strict";
75876       init_debounce();
75877       init_src5();
75878       init_modes2();
75879       init_presets();
75880       init_localizer();
75881       init_svg();
75882       init_tooltip();
75883     }
75884   });
75885
75886   // modules/ui/tools/notes.js
75887   var notes_exports2 = {};
75888   __export(notes_exports2, {
75889     uiToolNotes: () => uiToolNotes
75890   });
75891   function uiToolNotes(context) {
75892     var tool = {
75893       id: "notes",
75894       label: _t.append("modes.add_note.label")
75895     };
75896     var mode = modeAddNote(context);
75897     function enabled() {
75898       return notesEnabled() && notesEditable();
75899     }
75900     function notesEnabled() {
75901       var noteLayer = context.layers().layer("notes");
75902       return noteLayer && noteLayer.enabled();
75903     }
75904     function notesEditable() {
75905       var mode2 = context.mode();
75906       return context.map().notesEditable() && mode2 && mode2.id !== "save";
75907     }
75908     context.keybinding().on(mode.key, function() {
75909       if (!enabled()) return;
75910       if (mode.id === context.mode().id) {
75911         context.enter(modeBrowse(context));
75912       } else {
75913         context.enter(mode);
75914       }
75915     });
75916     tool.render = function(selection2) {
75917       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
75918       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
75919       context.on("enter.notes", update);
75920       update();
75921       function update() {
75922         var showNotes = notesEnabled();
75923         var data = showNotes ? [mode] : [];
75924         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
75925           return d2.id;
75926         });
75927         buttons.exit().remove();
75928         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
75929           return d2.id + " add-button bar-button";
75930         }).on("click.notes", function(d3_event, d2) {
75931           if (!enabled()) return;
75932           var currMode = context.mode().id;
75933           if (/^draw/.test(currMode)) return;
75934           if (d2.id === currMode) {
75935             context.enter(modeBrowse(context));
75936           } else {
75937             context.enter(d2);
75938           }
75939         }).call(
75940           uiTooltip().placement("bottom").title(function(d2) {
75941             return d2.description;
75942           }).keys(function(d2) {
75943             return [d2.key];
75944           }).scrollContainer(context.container().select(".top-toolbar"))
75945         );
75946         buttonsEnter.each(function(d2) {
75947           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
75948         });
75949         if (buttons.enter().size() || buttons.exit().size()) {
75950           context.ui().checkOverflow(".top-toolbar", true);
75951         }
75952         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
75953           return !enabled();
75954         }).attr("aria-disabled", function() {
75955           return !enabled();
75956         }).classed("active", function(d2) {
75957           return context.mode() && context.mode().button === d2.button;
75958         }).attr("aria-pressed", function(d2) {
75959           return context.mode() && context.mode().button === d2.button;
75960         });
75961       }
75962     };
75963     tool.uninstall = function() {
75964       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
75965       context.map().on("move.notes", null).on("drawn.notes", null);
75966     };
75967     return tool;
75968   }
75969   var init_notes2 = __esm({
75970     "modules/ui/tools/notes.js"() {
75971       "use strict";
75972       init_debounce();
75973       init_src5();
75974       init_modes2();
75975       init_localizer();
75976       init_svg();
75977       init_tooltip();
75978     }
75979   });
75980
75981   // modules/ui/tools/save.js
75982   var save_exports = {};
75983   __export(save_exports, {
75984     uiToolSave: () => uiToolSave
75985   });
75986   function uiToolSave(context) {
75987     var tool = {
75988       id: "save",
75989       label: _t.append("save.title")
75990     };
75991     var button = null;
75992     var tooltipBehavior = null;
75993     var history = context.history();
75994     var key = uiCmd("\u2318S");
75995     var _numChanges = 0;
75996     function isSaving() {
75997       var mode = context.mode();
75998       return mode && mode.id === "save";
75999     }
76000     function isDisabled() {
76001       return _numChanges === 0 || isSaving();
76002     }
76003     function save(d3_event) {
76004       d3_event.preventDefault();
76005       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
76006         context.enter(modeSave(context));
76007       }
76008     }
76009     function bgColor(numChanges) {
76010       var step;
76011       if (numChanges === 0) {
76012         return null;
76013       } else if (numChanges <= 50) {
76014         step = numChanges / 50;
76015         return rgb_default("#fff", "#ff8")(step);
76016       } else {
76017         step = Math.min((numChanges - 50) / 50, 1);
76018         return rgb_default("#ff8", "#f88")(step);
76019       }
76020     }
76021     function updateCount() {
76022       var val = history.difference().summary().length;
76023       if (val === _numChanges) return;
76024       _numChanges = val;
76025       if (tooltipBehavior) {
76026         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
76027       }
76028       if (button) {
76029         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
76030         button.select("span.count").text(_numChanges);
76031       }
76032     }
76033     tool.render = function(selection2) {
76034       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
76035       var lastPointerUpType;
76036       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
76037         lastPointerUpType = d3_event.pointerType;
76038       }).on("click", function(d3_event) {
76039         save(d3_event);
76040         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
76041           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
76042         }
76043         lastPointerUpType = null;
76044       }).call(tooltipBehavior);
76045       button.call(svgIcon("#iD-icon-save"));
76046       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
76047       updateCount();
76048       context.keybinding().on(key, save, true);
76049       context.history().on("change.save", updateCount);
76050       context.on("enter.save", function() {
76051         if (button) {
76052           button.classed("disabled", isDisabled());
76053           if (isSaving()) {
76054             button.call(tooltipBehavior.hide);
76055           }
76056         }
76057       });
76058     };
76059     tool.uninstall = function() {
76060       context.keybinding().off(key, true);
76061       context.history().on("change.save", null);
76062       context.on("enter.save", null);
76063       button = null;
76064       tooltipBehavior = null;
76065     };
76066     return tool;
76067   }
76068   var init_save = __esm({
76069     "modules/ui/tools/save.js"() {
76070       "use strict";
76071       init_src8();
76072       init_localizer();
76073       init_modes2();
76074       init_svg();
76075       init_cmd();
76076       init_tooltip();
76077     }
76078   });
76079
76080   // modules/ui/tools/sidebar_toggle.js
76081   var sidebar_toggle_exports = {};
76082   __export(sidebar_toggle_exports, {
76083     uiToolSidebarToggle: () => uiToolSidebarToggle
76084   });
76085   function uiToolSidebarToggle(context) {
76086     var tool = {
76087       id: "sidebar_toggle",
76088       label: _t.append("toolbar.inspect")
76089     };
76090     tool.render = function(selection2) {
76091       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
76092         context.ui().sidebar.toggle();
76093       }).call(
76094         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
76095       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
76096     };
76097     return tool;
76098   }
76099   var init_sidebar_toggle = __esm({
76100     "modules/ui/tools/sidebar_toggle.js"() {
76101       "use strict";
76102       init_localizer();
76103       init_svg();
76104       init_tooltip();
76105     }
76106   });
76107
76108   // modules/ui/tools/undo_redo.js
76109   var undo_redo_exports = {};
76110   __export(undo_redo_exports, {
76111     uiToolUndoRedo: () => uiToolUndoRedo
76112   });
76113   function uiToolUndoRedo(context) {
76114     var tool = {
76115       id: "undo_redo",
76116       label: _t.append("toolbar.undo_redo")
76117     };
76118     var commands = [{
76119       id: "undo",
76120       cmd: uiCmd("\u2318Z"),
76121       action: function() {
76122         context.undo();
76123       },
76124       annotation: function() {
76125         return context.history().undoAnnotation();
76126       },
76127       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
76128     }, {
76129       id: "redo",
76130       cmd: uiCmd("\u2318\u21E7Z"),
76131       action: function() {
76132         context.redo();
76133       },
76134       annotation: function() {
76135         return context.history().redoAnnotation();
76136       },
76137       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
76138     }];
76139     function editable() {
76140       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
76141         true
76142         /* ignore min zoom */
76143       );
76144     }
76145     tool.render = function(selection2) {
76146       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
76147         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
76148       }).keys(function(d2) {
76149         return [d2.cmd];
76150       }).scrollContainer(context.container().select(".top-toolbar"));
76151       var lastPointerUpType;
76152       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
76153         return "disabled " + d2.id + "-button bar-button";
76154       }).on("pointerup", function(d3_event) {
76155         lastPointerUpType = d3_event.pointerType;
76156       }).on("click", function(d3_event, d2) {
76157         d3_event.preventDefault();
76158         var annotation = d2.annotation();
76159         if (editable() && annotation) {
76160           d2.action();
76161         }
76162         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
76163           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
76164           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
76165         }
76166         lastPointerUpType = null;
76167       }).call(tooltipBehavior);
76168       buttons.each(function(d2) {
76169         select_default2(this).call(svgIcon("#" + d2.icon));
76170       });
76171       context.keybinding().on(commands[0].cmd, function(d3_event) {
76172         d3_event.preventDefault();
76173         if (editable()) commands[0].action();
76174       }).on(commands[1].cmd, function(d3_event) {
76175         d3_event.preventDefault();
76176         if (editable()) commands[1].action();
76177       });
76178       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
76179       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
76180       context.history().on("change.undo_redo", function(difference2) {
76181         if (difference2) update();
76182       });
76183       context.on("enter.undo_redo", update);
76184       function update() {
76185         buttons.classed("disabled", function(d2) {
76186           return !editable() || !d2.annotation();
76187         }).each(function() {
76188           var selection3 = select_default2(this);
76189           if (!selection3.select(".tooltip.in").empty()) {
76190             selection3.call(tooltipBehavior.updateContent);
76191           }
76192         });
76193       }
76194     };
76195     tool.uninstall = function() {
76196       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
76197       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
76198       context.history().on("change.undo_redo", null);
76199       context.on("enter.undo_redo", null);
76200     };
76201     return tool;
76202   }
76203   var init_undo_redo = __esm({
76204     "modules/ui/tools/undo_redo.js"() {
76205       "use strict";
76206       init_debounce();
76207       init_src5();
76208       init_localizer();
76209       init_svg();
76210       init_cmd();
76211       init_tooltip();
76212     }
76213   });
76214
76215   // modules/ui/tools/index.js
76216   var tools_exports = {};
76217   __export(tools_exports, {
76218     uiToolDrawModes: () => uiToolDrawModes,
76219     uiToolNotes: () => uiToolNotes,
76220     uiToolSave: () => uiToolSave,
76221     uiToolSidebarToggle: () => uiToolSidebarToggle,
76222     uiToolUndoRedo: () => uiToolUndoRedo
76223   });
76224   var init_tools = __esm({
76225     "modules/ui/tools/index.js"() {
76226       "use strict";
76227       init_modes();
76228       init_notes2();
76229       init_save();
76230       init_sidebar_toggle();
76231       init_undo_redo();
76232     }
76233   });
76234
76235   // modules/ui/top_toolbar.js
76236   var top_toolbar_exports = {};
76237   __export(top_toolbar_exports, {
76238     uiTopToolbar: () => uiTopToolbar
76239   });
76240   function uiTopToolbar(context) {
76241     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
76242     function notesEnabled() {
76243       var noteLayer = context.layers().layer("notes");
76244       return noteLayer && noteLayer.enabled();
76245     }
76246     function topToolbar(bar) {
76247       bar.on("wheel.topToolbar", function(d3_event) {
76248         if (!d3_event.deltaX) {
76249           bar.node().scrollLeft += d3_event.deltaY;
76250         }
76251       });
76252       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
76253       context.layers().on("change.topToolbar", debouncedUpdate);
76254       update();
76255       function update() {
76256         var tools = [
76257           sidebarToggle,
76258           "spacer",
76259           modes
76260         ];
76261         tools.push("spacer");
76262         if (notesEnabled()) {
76263           tools = tools.concat([notes, "spacer"]);
76264         }
76265         tools = tools.concat([undoRedo, save]);
76266         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
76267           return d2.id || d2;
76268         });
76269         toolbarItems.exit().each(function(d2) {
76270           if (d2.uninstall) {
76271             d2.uninstall();
76272           }
76273         }).remove();
76274         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
76275           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
76276           if (d2.klass) classes += " " + d2.klass;
76277           return classes;
76278         });
76279         var actionableItems = itemsEnter.filter(function(d2) {
76280           return d2 !== "spacer";
76281         });
76282         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
76283           select_default2(this).call(d2.render, bar);
76284         });
76285         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
76286           d2.label(select_default2(this));
76287         });
76288       }
76289     }
76290     return topToolbar;
76291   }
76292   var init_top_toolbar = __esm({
76293     "modules/ui/top_toolbar.js"() {
76294       "use strict";
76295       init_src5();
76296       init_debounce();
76297       init_tools();
76298     }
76299   });
76300
76301   // modules/ui/version.js
76302   var version_exports = {};
76303   __export(version_exports, {
76304     uiVersion: () => uiVersion
76305   });
76306   function uiVersion(context) {
76307     var currVersion = context.version;
76308     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
76309     if (sawVersion === null && matchedVersion !== null) {
76310       if (corePreferences("sawVersion")) {
76311         isNewUser = false;
76312         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
76313       } else {
76314         isNewUser = true;
76315         isNewVersion = true;
76316       }
76317       corePreferences("sawVersion", currVersion);
76318       sawVersion = currVersion;
76319     }
76320     return function(selection2) {
76321       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
76322       if (isNewVersion && !isNewUser) {
76323         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(
76324           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
76325         );
76326       }
76327     };
76328   }
76329   var sawVersion, isNewVersion, isNewUser;
76330   var init_version = __esm({
76331     "modules/ui/version.js"() {
76332       "use strict";
76333       init_preferences();
76334       init_localizer();
76335       init_icon();
76336       init_tooltip();
76337       sawVersion = null;
76338       isNewVersion = false;
76339       isNewUser = false;
76340     }
76341   });
76342
76343   // modules/ui/zoom.js
76344   var zoom_exports = {};
76345   __export(zoom_exports, {
76346     uiZoom: () => uiZoom
76347   });
76348   function uiZoom(context) {
76349     var zooms = [{
76350       id: "zoom-in",
76351       icon: "iD-icon-plus",
76352       title: _t.append("zoom.in"),
76353       action: zoomIn,
76354       disabled: function() {
76355         return !context.map().canZoomIn();
76356       },
76357       disabledTitle: _t.append("zoom.disabled.in"),
76358       key: "+"
76359     }, {
76360       id: "zoom-out",
76361       icon: "iD-icon-minus",
76362       title: _t.append("zoom.out"),
76363       action: zoomOut,
76364       disabled: function() {
76365         return !context.map().canZoomOut();
76366       },
76367       disabledTitle: _t.append("zoom.disabled.out"),
76368       key: "-"
76369     }];
76370     function zoomIn(d3_event) {
76371       if (d3_event.shiftKey) return;
76372       d3_event.preventDefault();
76373       context.map().zoomIn();
76374     }
76375     function zoomOut(d3_event) {
76376       if (d3_event.shiftKey) return;
76377       d3_event.preventDefault();
76378       context.map().zoomOut();
76379     }
76380     function zoomInFurther(d3_event) {
76381       if (d3_event.shiftKey) return;
76382       d3_event.preventDefault();
76383       context.map().zoomInFurther();
76384     }
76385     function zoomOutFurther(d3_event) {
76386       if (d3_event.shiftKey) return;
76387       d3_event.preventDefault();
76388       context.map().zoomOutFurther();
76389     }
76390     return function(selection2) {
76391       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
76392         if (d2.disabled()) {
76393           return d2.disabledTitle;
76394         }
76395         return d2.title;
76396       }).keys(function(d2) {
76397         return [d2.key];
76398       });
76399       var lastPointerUpType;
76400       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
76401         return d2.id;
76402       }).on("pointerup.editor", function(d3_event) {
76403         lastPointerUpType = d3_event.pointerType;
76404       }).on("click.editor", function(d3_event, d2) {
76405         if (!d2.disabled()) {
76406           d2.action(d3_event);
76407         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
76408           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
76409         }
76410         lastPointerUpType = null;
76411       }).call(tooltipBehavior);
76412       buttons.each(function(d2) {
76413         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
76414       });
76415       utilKeybinding.plusKeys.forEach(function(key) {
76416         context.keybinding().on([key], zoomIn);
76417         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
76418       });
76419       utilKeybinding.minusKeys.forEach(function(key) {
76420         context.keybinding().on([key], zoomOut);
76421         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
76422       });
76423       function updateButtonStates() {
76424         buttons.classed("disabled", function(d2) {
76425           return d2.disabled();
76426         }).each(function() {
76427           var selection3 = select_default2(this);
76428           if (!selection3.select(".tooltip.in").empty()) {
76429             selection3.call(tooltipBehavior.updateContent);
76430           }
76431         });
76432       }
76433       updateButtonStates();
76434       context.map().on("move.uiZoom", updateButtonStates);
76435     };
76436   }
76437   var init_zoom3 = __esm({
76438     "modules/ui/zoom.js"() {
76439       "use strict";
76440       init_src5();
76441       init_localizer();
76442       init_icon();
76443       init_cmd();
76444       init_tooltip();
76445       init_keybinding();
76446     }
76447   });
76448
76449   // modules/ui/zoom_to_selection.js
76450   var zoom_to_selection_exports = {};
76451   __export(zoom_to_selection_exports, {
76452     uiZoomToSelection: () => uiZoomToSelection
76453   });
76454   function uiZoomToSelection(context) {
76455     function isDisabled() {
76456       var mode = context.mode();
76457       return !mode || !mode.zoomToSelected;
76458     }
76459     var _lastPointerUpType;
76460     function pointerup(d3_event) {
76461       _lastPointerUpType = d3_event.pointerType;
76462     }
76463     function click(d3_event) {
76464       d3_event.preventDefault();
76465       if (isDisabled()) {
76466         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
76467           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
76468         }
76469       } else {
76470         var mode = context.mode();
76471         if (mode && mode.zoomToSelected) {
76472           mode.zoomToSelected();
76473         }
76474       }
76475       _lastPointerUpType = null;
76476     }
76477     return function(selection2) {
76478       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
76479         if (isDisabled()) {
76480           return _t.append("inspector.zoom_to.no_selection");
76481         }
76482         return _t.append("inspector.zoom_to.title");
76483       }).keys([_t("inspector.zoom_to.key")]);
76484       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
76485       function setEnabledState() {
76486         button.classed("disabled", isDisabled());
76487         if (!button.select(".tooltip.in").empty()) {
76488           button.call(tooltipBehavior.updateContent);
76489         }
76490       }
76491       context.on("enter.uiZoomToSelection", setEnabledState);
76492       setEnabledState();
76493     };
76494   }
76495   var init_zoom_to_selection = __esm({
76496     "modules/ui/zoom_to_selection.js"() {
76497       "use strict";
76498       init_localizer();
76499       init_tooltip();
76500       init_icon();
76501     }
76502   });
76503
76504   // modules/ui/pane.js
76505   var pane_exports = {};
76506   __export(pane_exports, {
76507     uiPane: () => uiPane
76508   });
76509   function uiPane(id2, context) {
76510     var _key;
76511     var _label = "";
76512     var _description = "";
76513     var _iconName = "";
76514     var _sections;
76515     var _paneSelection = select_default2(null);
76516     var _paneTooltip;
76517     var pane = {
76518       id: id2
76519     };
76520     pane.label = function(val) {
76521       if (!arguments.length) return _label;
76522       _label = val;
76523       return pane;
76524     };
76525     pane.key = function(val) {
76526       if (!arguments.length) return _key;
76527       _key = val;
76528       return pane;
76529     };
76530     pane.description = function(val) {
76531       if (!arguments.length) return _description;
76532       _description = val;
76533       return pane;
76534     };
76535     pane.iconName = function(val) {
76536       if (!arguments.length) return _iconName;
76537       _iconName = val;
76538       return pane;
76539     };
76540     pane.sections = function(val) {
76541       if (!arguments.length) return _sections;
76542       _sections = val;
76543       return pane;
76544     };
76545     pane.selection = function() {
76546       return _paneSelection;
76547     };
76548     function hidePane() {
76549       context.ui().togglePanes();
76550     }
76551     pane.togglePane = function(d3_event) {
76552       if (d3_event) d3_event.preventDefault();
76553       _paneTooltip.hide();
76554       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
76555     };
76556     pane.renderToggleButton = function(selection2) {
76557       if (!_paneTooltip) {
76558         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
76559       }
76560       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
76561     };
76562     pane.renderContent = function(selection2) {
76563       if (_sections) {
76564         _sections.forEach(function(section) {
76565           selection2.call(section.render);
76566         });
76567       }
76568     };
76569     pane.renderPane = function(selection2) {
76570       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
76571       var heading = _paneSelection.append("div").attr("class", "pane-heading");
76572       heading.append("h2").text("").call(_label);
76573       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
76574       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
76575       if (_key) {
76576         context.keybinding().on(_key, pane.togglePane);
76577       }
76578     };
76579     return pane;
76580   }
76581   var init_pane = __esm({
76582     "modules/ui/pane.js"() {
76583       "use strict";
76584       init_src5();
76585       init_icon();
76586       init_localizer();
76587       init_tooltip();
76588     }
76589   });
76590
76591   // modules/ui/sections/background_display_options.js
76592   var background_display_options_exports = {};
76593   __export(background_display_options_exports, {
76594     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions
76595   });
76596   function uiSectionBackgroundDisplayOptions(context) {
76597     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
76598     var _storedOpacity = corePreferences("background-opacity");
76599     var _minVal = 0;
76600     var _maxVal = 3;
76601     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
76602     var _options = {
76603       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
76604       contrast: 1,
76605       saturation: 1,
76606       sharpness: 1
76607     };
76608     function updateValue(d2, val) {
76609       val = clamp_default(val, _minVal, _maxVal);
76610       _options[d2] = val;
76611       context.background()[d2](val);
76612       if (d2 === "brightness") {
76613         corePreferences("background-opacity", val);
76614       }
76615       section.reRender();
76616     }
76617     function renderDisclosureContent(selection2) {
76618       var container = selection2.selectAll(".display-options-container").data([0]);
76619       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
76620       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
76621         return "display-control display-control-" + d2;
76622       });
76623       slidersEnter.html(function(d2) {
76624         return _t.html("background." + d2);
76625       }).append("span").attr("class", function(d2) {
76626         return "display-option-value display-option-value-" + d2;
76627       });
76628       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
76629       sildersControlEnter.append("input").attr("class", function(d2) {
76630         return "display-option-input display-option-input-" + d2;
76631       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.01").on("input", function(d3_event, d2) {
76632         var val = select_default2(this).property("value");
76633         if (!val && d3_event && d3_event.target) {
76634           val = d3_event.target.value;
76635         }
76636         updateValue(d2, val);
76637       });
76638       sildersControlEnter.append("button").attr("title", function(d2) {
76639         return `${_t("background.reset")} ${_t("background." + d2)}`;
76640       }).attr("class", function(d2) {
76641         return "display-option-reset display-option-reset-" + d2;
76642       }).on("click", function(d3_event, d2) {
76643         if (d3_event.button !== 0) return;
76644         updateValue(d2, 1);
76645       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
76646       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
76647         d3_event.preventDefault();
76648         for (var i3 = 0; i3 < _sliders.length; i3++) {
76649           updateValue(_sliders[i3], 1);
76650         }
76651       });
76652       container = containerEnter.merge(container);
76653       container.selectAll(".display-option-input").property("value", function(d2) {
76654         return _options[d2];
76655       });
76656       container.selectAll(".display-option-value").text(function(d2) {
76657         return Math.floor(_options[d2] * 100) + "%";
76658       });
76659       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
76660         return _options[d2] === 1;
76661       });
76662       if (containerEnter.size() && _options.brightness !== 1) {
76663         context.background().brightness(_options.brightness);
76664       }
76665     }
76666     return section;
76667   }
76668   var init_background_display_options = __esm({
76669     "modules/ui/sections/background_display_options.js"() {
76670       "use strict";
76671       init_src5();
76672       init_lodash();
76673       init_preferences();
76674       init_localizer();
76675       init_icon();
76676       init_section();
76677     }
76678   });
76679
76680   // modules/ui/settings/custom_background.js
76681   var custom_background_exports = {};
76682   __export(custom_background_exports, {
76683     uiSettingsCustomBackground: () => uiSettingsCustomBackground
76684   });
76685   function uiSettingsCustomBackground() {
76686     var dispatch14 = dispatch_default("change");
76687     function render(selection2) {
76688       var _origSettings = {
76689         template: corePreferences("background-custom-template")
76690       };
76691       var _currSettings = {
76692         template: corePreferences("background-custom-template")
76693       };
76694       var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
76695       var modal = uiConfirm(selection2).okButton();
76696       modal.classed("settings-modal settings-custom-background", true);
76697       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
76698       var textSection = modal.select(".modal-section.message-text");
76699       var instructions = `${_t.html("settings.custom_background.instructions.info")}
76700
76701 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
76702 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
76703 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
76704 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
76705 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
76706
76707 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
76708 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
76709 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
76710 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
76711 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
76712 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
76713
76714 #### ${_t.html("settings.custom_background.instructions.example")}
76715 \`${example}\``;
76716       textSection.append("div").attr("class", "instructions-template").html(k(instructions));
76717       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
76718       var buttonSection = modal.select(".modal-section.buttons");
76719       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
76720       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
76721       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
76722       function isSaveDisabled() {
76723         return null;
76724       }
76725       function clickCancel() {
76726         textSection.select(".field-template").property("value", _origSettings.template);
76727         corePreferences("background-custom-template", _origSettings.template);
76728         this.blur();
76729         modal.close();
76730       }
76731       function clickSave() {
76732         _currSettings.template = textSection.select(".field-template").property("value");
76733         corePreferences("background-custom-template", _currSettings.template);
76734         this.blur();
76735         modal.close();
76736         dispatch14.call("change", this, _currSettings);
76737       }
76738     }
76739     return utilRebind(render, dispatch14, "on");
76740   }
76741   var init_custom_background = __esm({
76742     "modules/ui/settings/custom_background.js"() {
76743       "use strict";
76744       init_src4();
76745       init_marked_esm();
76746       init_preferences();
76747       init_localizer();
76748       init_confirm();
76749       init_util();
76750     }
76751   });
76752
76753   // modules/ui/sections/background_list.js
76754   var background_list_exports = {};
76755   __export(background_list_exports, {
76756     uiSectionBackgroundList: () => uiSectionBackgroundList
76757   });
76758   function uiSectionBackgroundList(context) {
76759     var _backgroundList = select_default2(null);
76760     var _customSource = context.background().findSource("custom");
76761     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
76762     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
76763     function previousBackgroundID() {
76764       return corePreferences("background-last-used-toggle");
76765     }
76766     function renderDisclosureContent(selection2) {
76767       var container = selection2.selectAll(".layer-background-list").data([0]);
76768       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
76769       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
76770       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
76771         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
76772       );
76773       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76774         d3_event.preventDefault();
76775         uiMapInMap.toggle();
76776       });
76777       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
76778       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
76779         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
76780       );
76781       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76782         d3_event.preventDefault();
76783         context.ui().info.toggle("background");
76784       });
76785       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
76786       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
76787         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
76788       );
76789       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76790         d3_event.preventDefault();
76791         context.ui().info.toggle("location");
76792       });
76793       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
76794       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"));
76795       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
76796         chooseBackground(d2);
76797       }, function(d2) {
76798         return !d2.isHidden() && !d2.overlay;
76799       });
76800     }
76801     function setTooltips(selection2) {
76802       selection2.each(function(d2, i3, nodes) {
76803         var item = select_default2(this).select("label");
76804         var span = item.select("span");
76805         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
76806         var hasDescription = d2.hasDescription();
76807         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
76808         item.call(uiTooltip().destroyAny);
76809         if (d2.id === previousBackgroundID()) {
76810           item.call(
76811             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
76812           );
76813         } else if (hasDescription || isOverflowing) {
76814           item.call(
76815             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
76816           );
76817         }
76818       });
76819     }
76820     function drawListItems(layerList, type2, change, filter2) {
76821       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a4, b3) {
76822         return a4.best() && !b3.best() ? -1 : b3.best() && !a4.best() ? 1 : descending(a4.area(), b3.area()) || ascending(a4.name(), b3.name()) || 0;
76823       });
76824       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
76825         return d2.id + "---" + i3;
76826       });
76827       layerLinks.exit().remove();
76828       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
76829         return d2.id === "custom";
76830       }).classed("best", function(d2) {
76831         return d2.best();
76832       });
76833       var label = enter.append("label");
76834       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
76835         return d2.id;
76836       }).on("change", change);
76837       label.append("span").each(function(d2) {
76838         d2.label()(select_default2(this));
76839       });
76840       enter.filter(function(d2) {
76841         return d2.id === "custom";
76842       }).append("button").attr("class", "layer-browse").call(
76843         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76844       ).on("click", function(d3_event) {
76845         d3_event.preventDefault();
76846         editCustom();
76847       }).call(svgIcon("#iD-icon-more"));
76848       enter.filter(function(d2) {
76849         return d2.best();
76850       }).append("div").attr("class", "best").call(
76851         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76852       ).append("span").text("\u2605");
76853       layerList.call(updateLayerSelections);
76854     }
76855     function updateLayerSelections(selection2) {
76856       function active(d2) {
76857         return context.background().showsLayer(d2);
76858       }
76859       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
76860         return d2.id === previousBackgroundID();
76861       }).call(setTooltips).selectAll("input").property("checked", active);
76862     }
76863     function chooseBackground(d2) {
76864       if (d2.id === "custom" && !d2.template()) {
76865         return editCustom();
76866       }
76867       var previousBackground = context.background().baseLayerSource();
76868       corePreferences("background-last-used-toggle", previousBackground.id);
76869       corePreferences("background-last-used", d2.id);
76870       context.background().baseLayerSource(d2);
76871     }
76872     function customChanged(d2) {
76873       if (d2 && d2.template) {
76874         _customSource.template(d2.template);
76875         chooseBackground(_customSource);
76876       } else {
76877         _customSource.template("");
76878         chooseBackground(context.background().findSource("none"));
76879       }
76880     }
76881     function editCustom() {
76882       context.container().call(_settingsCustomBackground);
76883     }
76884     context.background().on("change.background_list", function() {
76885       _backgroundList.call(updateLayerSelections);
76886     });
76887     context.map().on(
76888       "move.background_list",
76889       debounce_default(function() {
76890         window.requestIdleCallback(section.reRender);
76891       }, 1e3)
76892     );
76893     return section;
76894   }
76895   var init_background_list = __esm({
76896     "modules/ui/sections/background_list.js"() {
76897       "use strict";
76898       init_debounce();
76899       init_src();
76900       init_src5();
76901       init_preferences();
76902       init_localizer();
76903       init_tooltip();
76904       init_icon();
76905       init_cmd();
76906       init_custom_background();
76907       init_map_in_map();
76908       init_section();
76909     }
76910   });
76911
76912   // modules/ui/sections/background_offset.js
76913   var background_offset_exports = {};
76914   __export(background_offset_exports, {
76915     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset
76916   });
76917   function uiSectionBackgroundOffset(context) {
76918     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
76919     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
76920     var _directions = [
76921       ["top", [0, -0.5]],
76922       ["left", [-0.5, 0]],
76923       ["right", [0.5, 0]],
76924       ["bottom", [0, 0.5]]
76925     ];
76926     function updateValue() {
76927       var meters = geoOffsetToMeters(context.background().offset());
76928       var x2 = +meters[0].toFixed(2);
76929       var y2 = +meters[1].toFixed(2);
76930       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
76931       context.container().selectAll(".nudge-reset").classed("disabled", function() {
76932         return x2 === 0 && y2 === 0;
76933       });
76934     }
76935     function resetOffset() {
76936       context.background().offset([0, 0]);
76937       updateValue();
76938     }
76939     function nudge(d2) {
76940       context.background().nudge(d2, context.map().zoom());
76941       updateValue();
76942     }
76943     function inputOffset() {
76944       var input = select_default2(this);
76945       var d2 = input.node().value;
76946       if (d2 === "") return resetOffset();
76947       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
76948         return !isNaN(n3) && n3;
76949       });
76950       if (d2.length !== 2 || !d2[0] || !d2[1]) {
76951         input.classed("error", true);
76952         return;
76953       }
76954       context.background().offset(geoMetersToOffset(d2));
76955       updateValue();
76956     }
76957     function dragOffset(d3_event) {
76958       if (d3_event.button !== 0) return;
76959       var origin = [d3_event.clientX, d3_event.clientY];
76960       var pointerId = d3_event.pointerId || "mouse";
76961       context.container().append("div").attr("class", "nudge-surface");
76962       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
76963       if (_pointerPrefix === "pointer") {
76964         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
76965       }
76966       function pointermove(d3_event2) {
76967         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
76968         var latest = [d3_event2.clientX, d3_event2.clientY];
76969         var d2 = [
76970           -(origin[0] - latest[0]) / 4,
76971           -(origin[1] - latest[1]) / 4
76972         ];
76973         origin = latest;
76974         nudge(d2);
76975       }
76976       function pointerup(d3_event2) {
76977         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
76978         if (d3_event2.button !== 0) return;
76979         context.container().selectAll(".nudge-surface").remove();
76980         select_default2(window).on(".drag-bg-offset", null);
76981       }
76982     }
76983     function renderDisclosureContent(selection2) {
76984       var container = selection2.selectAll(".nudge-container").data([0]);
76985       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
76986       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
76987       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
76988       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
76989       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
76990       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
76991         return _t(`background.nudge.${d2[0]}`);
76992       }).attr("class", function(d2) {
76993         return d2[0] + " nudge";
76994       }).on("click", function(d3_event, d2) {
76995         nudge(d2[1]);
76996       });
76997       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
76998         d3_event.preventDefault();
76999         resetOffset();
77000       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
77001       updateValue();
77002     }
77003     context.background().on("change.backgroundOffset-update", updateValue);
77004     return section;
77005   }
77006   var init_background_offset = __esm({
77007     "modules/ui/sections/background_offset.js"() {
77008       "use strict";
77009       init_src5();
77010       init_localizer();
77011       init_geo2();
77012       init_icon();
77013       init_section();
77014     }
77015   });
77016
77017   // modules/ui/sections/overlay_list.js
77018   var overlay_list_exports = {};
77019   __export(overlay_list_exports, {
77020     uiSectionOverlayList: () => uiSectionOverlayList
77021   });
77022   function uiSectionOverlayList(context) {
77023     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
77024     var _overlayList = select_default2(null);
77025     function setTooltips(selection2) {
77026       selection2.each(function(d2, i3, nodes) {
77027         var item = select_default2(this).select("label");
77028         var span = item.select("span");
77029         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
77030         var description = d2.description();
77031         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
77032         item.call(uiTooltip().destroyAny);
77033         if (description || isOverflowing) {
77034           item.call(
77035             uiTooltip().placement(placement).title(() => description || d2.name())
77036           );
77037         }
77038       });
77039     }
77040     function updateLayerSelections(selection2) {
77041       function active(d2) {
77042         return context.background().showsLayer(d2);
77043       }
77044       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
77045     }
77046     function chooseOverlay(d3_event, d2) {
77047       d3_event.preventDefault();
77048       context.background().toggleOverlayLayer(d2);
77049       _overlayList.call(updateLayerSelections);
77050       document.activeElement.blur();
77051     }
77052     function drawListItems(layerList, type2, change, filter2) {
77053       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
77054       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
77055         return d2.name();
77056       });
77057       layerLinks.exit().remove();
77058       var enter = layerLinks.enter().append("li");
77059       var label = enter.append("label");
77060       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
77061       label.append("span").each(function(d2) {
77062         d2.label()(select_default2(this));
77063       });
77064       layerList.selectAll("li").sort(sortSources);
77065       layerList.call(updateLayerSelections);
77066       function sortSources(a4, b3) {
77067         return a4.best() && !b3.best() ? -1 : b3.best() && !a4.best() ? 1 : descending(a4.area(), b3.area()) || ascending(a4.name(), b3.name()) || 0;
77068       }
77069     }
77070     function renderDisclosureContent(selection2) {
77071       var container = selection2.selectAll(".layer-overlay-list").data([0]);
77072       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
77073       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
77074         return !d2.isHidden() && d2.overlay;
77075       });
77076     }
77077     context.map().on(
77078       "move.overlay_list",
77079       debounce_default(function() {
77080         window.requestIdleCallback(section.reRender);
77081       }, 1e3)
77082     );
77083     return section;
77084   }
77085   var init_overlay_list = __esm({
77086     "modules/ui/sections/overlay_list.js"() {
77087       "use strict";
77088       init_debounce();
77089       init_src();
77090       init_src5();
77091       init_localizer();
77092       init_tooltip();
77093       init_section();
77094     }
77095   });
77096
77097   // modules/ui/panes/background.js
77098   var background_exports3 = {};
77099   __export(background_exports3, {
77100     uiPaneBackground: () => uiPaneBackground
77101   });
77102   function uiPaneBackground(context) {
77103     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
77104       uiSectionBackgroundList(context),
77105       uiSectionOverlayList(context),
77106       uiSectionBackgroundDisplayOptions(context),
77107       uiSectionBackgroundOffset(context)
77108     ]);
77109     return backgroundPane;
77110   }
77111   var init_background3 = __esm({
77112     "modules/ui/panes/background.js"() {
77113       "use strict";
77114       init_localizer();
77115       init_pane();
77116       init_background_display_options();
77117       init_background_list();
77118       init_background_offset();
77119       init_overlay_list();
77120     }
77121   });
77122
77123   // modules/ui/panes/help.js
77124   var help_exports = {};
77125   __export(help_exports, {
77126     uiPaneHelp: () => uiPaneHelp
77127   });
77128   function uiPaneHelp(context) {
77129     var docKeys = [
77130       ["help", [
77131         "welcome",
77132         "open_data_h",
77133         "open_data",
77134         "before_start_h",
77135         "before_start",
77136         "open_source_h",
77137         "open_source",
77138         "open_source_attribution",
77139         "open_source_help"
77140       ]],
77141       ["overview", [
77142         "navigation_h",
77143         "navigation_drag",
77144         "navigation_zoom",
77145         "features_h",
77146         "features",
77147         "nodes_ways"
77148       ]],
77149       ["editing", [
77150         "select_h",
77151         "select_left_click",
77152         "select_right_click",
77153         "select_space",
77154         "multiselect_h",
77155         "multiselect",
77156         "multiselect_shift_click",
77157         "multiselect_lasso",
77158         "undo_redo_h",
77159         "undo_redo",
77160         "save_h",
77161         "save",
77162         "save_validation",
77163         "upload_h",
77164         "upload",
77165         "backups_h",
77166         "backups",
77167         "keyboard_h",
77168         "keyboard"
77169       ]],
77170       ["feature_editor", [
77171         "intro",
77172         "definitions",
77173         "type_h",
77174         "type",
77175         "type_picker",
77176         "fields_h",
77177         "fields_all_fields",
77178         "fields_example",
77179         "fields_add_field",
77180         "tags_h",
77181         "tags_all_tags",
77182         "tags_resources"
77183       ]],
77184       ["points", [
77185         "intro",
77186         "add_point_h",
77187         "add_point",
77188         "add_point_finish",
77189         "move_point_h",
77190         "move_point",
77191         "delete_point_h",
77192         "delete_point",
77193         "delete_point_command"
77194       ]],
77195       ["lines", [
77196         "intro",
77197         "add_line_h",
77198         "add_line",
77199         "add_line_draw",
77200         "add_line_continue",
77201         "add_line_finish",
77202         "modify_line_h",
77203         "modify_line_dragnode",
77204         "modify_line_addnode",
77205         "connect_line_h",
77206         "connect_line",
77207         "connect_line_display",
77208         "connect_line_drag",
77209         "connect_line_tag",
77210         "disconnect_line_h",
77211         "disconnect_line_command",
77212         "move_line_h",
77213         "move_line_command",
77214         "move_line_connected",
77215         "delete_line_h",
77216         "delete_line",
77217         "delete_line_command"
77218       ]],
77219       ["areas", [
77220         "intro",
77221         "point_or_area_h",
77222         "point_or_area",
77223         "add_area_h",
77224         "add_area_command",
77225         "add_area_draw",
77226         "add_area_continue",
77227         "add_area_finish",
77228         "square_area_h",
77229         "square_area_command",
77230         "modify_area_h",
77231         "modify_area_dragnode",
77232         "modify_area_addnode",
77233         "delete_area_h",
77234         "delete_area",
77235         "delete_area_command"
77236       ]],
77237       ["relations", [
77238         "intro",
77239         "edit_relation_h",
77240         "edit_relation",
77241         "edit_relation_add",
77242         "edit_relation_delete",
77243         "maintain_relation_h",
77244         "maintain_relation",
77245         "relation_types_h",
77246         "multipolygon_h",
77247         "multipolygon",
77248         "multipolygon_create",
77249         "multipolygon_merge",
77250         "turn_restriction_h",
77251         "turn_restriction",
77252         "turn_restriction_field",
77253         "turn_restriction_editing",
77254         "route_h",
77255         "route",
77256         "route_add",
77257         "boundary_h",
77258         "boundary",
77259         "boundary_add"
77260       ]],
77261       ["operations", [
77262         "intro",
77263         "intro_2",
77264         "straighten",
77265         "orthogonalize",
77266         "circularize",
77267         "move",
77268         "rotate",
77269         "reflect",
77270         "continue",
77271         "reverse",
77272         "disconnect",
77273         "split",
77274         "extract",
77275         "merge",
77276         "delete",
77277         "downgrade",
77278         "copy_paste"
77279       ]],
77280       ["notes", [
77281         "intro",
77282         "add_note_h",
77283         "add_note",
77284         "place_note",
77285         "move_note",
77286         "update_note_h",
77287         "update_note",
77288         "save_note_h",
77289         "save_note"
77290       ]],
77291       ["imagery", [
77292         "intro",
77293         "sources_h",
77294         "choosing",
77295         "sources",
77296         "offsets_h",
77297         "offset",
77298         "offset_change"
77299       ]],
77300       ["streetlevel", [
77301         "intro",
77302         "using_h",
77303         "using",
77304         "photos",
77305         "viewer"
77306       ]],
77307       ["gps", [
77308         "intro",
77309         "survey",
77310         "using_h",
77311         "using",
77312         "tracing",
77313         "upload"
77314       ]],
77315       ["qa", [
77316         "intro",
77317         "tools_h",
77318         "tools",
77319         "issues_h",
77320         "issues"
77321       ]]
77322     ];
77323     var headings = {
77324       "help.help.open_data_h": 3,
77325       "help.help.before_start_h": 3,
77326       "help.help.open_source_h": 3,
77327       "help.overview.navigation_h": 3,
77328       "help.overview.features_h": 3,
77329       "help.editing.select_h": 3,
77330       "help.editing.multiselect_h": 3,
77331       "help.editing.undo_redo_h": 3,
77332       "help.editing.save_h": 3,
77333       "help.editing.upload_h": 3,
77334       "help.editing.backups_h": 3,
77335       "help.editing.keyboard_h": 3,
77336       "help.feature_editor.type_h": 3,
77337       "help.feature_editor.fields_h": 3,
77338       "help.feature_editor.tags_h": 3,
77339       "help.points.add_point_h": 3,
77340       "help.points.move_point_h": 3,
77341       "help.points.delete_point_h": 3,
77342       "help.lines.add_line_h": 3,
77343       "help.lines.modify_line_h": 3,
77344       "help.lines.connect_line_h": 3,
77345       "help.lines.disconnect_line_h": 3,
77346       "help.lines.move_line_h": 3,
77347       "help.lines.delete_line_h": 3,
77348       "help.areas.point_or_area_h": 3,
77349       "help.areas.add_area_h": 3,
77350       "help.areas.square_area_h": 3,
77351       "help.areas.modify_area_h": 3,
77352       "help.areas.delete_area_h": 3,
77353       "help.relations.edit_relation_h": 3,
77354       "help.relations.maintain_relation_h": 3,
77355       "help.relations.relation_types_h": 2,
77356       "help.relations.multipolygon_h": 3,
77357       "help.relations.turn_restriction_h": 3,
77358       "help.relations.route_h": 3,
77359       "help.relations.boundary_h": 3,
77360       "help.notes.add_note_h": 3,
77361       "help.notes.update_note_h": 3,
77362       "help.notes.save_note_h": 3,
77363       "help.imagery.sources_h": 3,
77364       "help.imagery.offsets_h": 3,
77365       "help.streetlevel.using_h": 3,
77366       "help.gps.using_h": 3,
77367       "help.qa.tools_h": 3,
77368       "help.qa.issues_h": 3
77369     };
77370     var docs = docKeys.map(function(key) {
77371       var helpkey = "help." + key[0];
77372       var helpPaneReplacements = { version: context.version };
77373       var text = key[1].reduce(function(all, part) {
77374         var subkey = helpkey + "." + part;
77375         var depth = headings[subkey];
77376         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
77377         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
77378       }, "");
77379       return {
77380         title: _t.html(helpkey + ".title"),
77381         content: k(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
77382       };
77383     });
77384     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
77385     helpPane.renderContent = function(content) {
77386       function clickHelp(d2, i3) {
77387         var rtl = _mainLocalizer.textDirection() === "rtl";
77388         content.property("scrollTop", 0);
77389         helpPane.selection().select(".pane-heading h2").html(d2.title);
77390         body.html(d2.content);
77391         body.selectAll("a").attr("target", "_blank");
77392         menuItems.classed("selected", function(m3) {
77393           return m3.title === d2.title;
77394         });
77395         nav.html("");
77396         if (rtl) {
77397           nav.call(drawNext).call(drawPrevious);
77398         } else {
77399           nav.call(drawPrevious).call(drawNext);
77400         }
77401         function drawNext(selection2) {
77402           if (i3 < docs.length - 1) {
77403             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
77404               d3_event.preventDefault();
77405               clickHelp(docs[i3 + 1], i3 + 1);
77406             });
77407             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
77408           }
77409         }
77410         function drawPrevious(selection2) {
77411           if (i3 > 0) {
77412             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
77413               d3_event.preventDefault();
77414               clickHelp(docs[i3 - 1], i3 - 1);
77415             });
77416             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
77417           }
77418         }
77419       }
77420       function clickWalkthrough(d3_event) {
77421         d3_event.preventDefault();
77422         if (context.inIntro()) return;
77423         context.container().call(uiIntro(context));
77424         context.ui().togglePanes();
77425       }
77426       function clickShortcuts(d3_event) {
77427         d3_event.preventDefault();
77428         context.container().call(context.ui().shortcuts, true);
77429       }
77430       var toc = content.append("ul").attr("class", "toc");
77431       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
77432         return d2.title;
77433       }).on("click", function(d3_event, d2) {
77434         d3_event.preventDefault();
77435         clickHelp(d2, docs.indexOf(d2));
77436       });
77437       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
77438         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
77439       ).append("a").attr("href", "#").on("click", clickShortcuts);
77440       shortcuts.append("div").call(_t.append("shortcuts.title"));
77441       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
77442       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
77443       walkthrough.append("div").call(_t.append("splash.walkthrough"));
77444       var helpContent = content.append("div").attr("class", "left-content");
77445       var body = helpContent.append("div").attr("class", "body");
77446       var nav = helpContent.append("div").attr("class", "nav");
77447       clickHelp(docs[0], 0);
77448     };
77449     return helpPane;
77450   }
77451   var init_help = __esm({
77452     "modules/ui/panes/help.js"() {
77453       "use strict";
77454       init_marked_esm();
77455       init_icon();
77456       init_intro();
77457       init_pane();
77458       init_localizer();
77459       init_tooltip();
77460       init_helper();
77461     }
77462   });
77463
77464   // modules/ui/sections/validation_issues.js
77465   var validation_issues_exports = {};
77466   __export(validation_issues_exports, {
77467     uiSectionValidationIssues: () => uiSectionValidationIssues
77468   });
77469   function uiSectionValidationIssues(id2, severity, context) {
77470     var _issues = [];
77471     var section = uiSection(id2, context).label(function() {
77472       if (!_issues) return "";
77473       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
77474       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
77475     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
77476       return _issues && _issues.length;
77477     });
77478     function getOptions() {
77479       return {
77480         what: corePreferences("validate-what") || "edited",
77481         where: corePreferences("validate-where") || "all"
77482       };
77483     }
77484     function reloadIssues() {
77485       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
77486     }
77487     function renderDisclosureContent(selection2) {
77488       var center = context.map().center();
77489       var graph = context.graph();
77490       var issues = _issues.map(function withDistance(issue) {
77491         var extent = issue.extent(graph);
77492         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
77493         return Object.assign(issue, { dist });
77494       }).sort(function byDistance(a4, b3) {
77495         return a4.dist - b3.dist;
77496       });
77497       issues = issues.slice(0, 1e3);
77498       selection2.call(drawIssuesList, issues);
77499     }
77500     function drawIssuesList(selection2, issues) {
77501       var list = selection2.selectAll(".issues-list").data([0]);
77502       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
77503       var items = list.selectAll("li").data(issues, function(d2) {
77504         return d2.key;
77505       });
77506       items.exit().remove();
77507       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
77508         return "issue severity-" + d2.severity;
77509       });
77510       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
77511         context.validator().focusIssue(d2);
77512       }).on("mouseover", function(d3_event, d2) {
77513         utilHighlightEntities(d2.entityIds, true, context);
77514       }).on("mouseout", function(d3_event, d2) {
77515         utilHighlightEntities(d2.entityIds, false, context);
77516       });
77517       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
77518       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
77519         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
77520         select_default2(this).call(svgIcon(iconName));
77521       });
77522       textEnter.append("span").attr("class", "issue-message");
77523       items = items.merge(itemsEnter).order();
77524       items.selectAll(".issue-message").text("").each(function(d2) {
77525         return d2.message(context)(select_default2(this));
77526       });
77527     }
77528     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
77529       window.requestIdleCallback(function() {
77530         reloadIssues();
77531         section.reRender();
77532       });
77533     });
77534     context.map().on(
77535       "move.uiSectionValidationIssues" + id2,
77536       debounce_default(function() {
77537         window.requestIdleCallback(function() {
77538           if (getOptions().where === "visible") {
77539             reloadIssues();
77540           }
77541           section.reRender();
77542         });
77543       }, 1e3)
77544     );
77545     return section;
77546   }
77547   var init_validation_issues = __esm({
77548     "modules/ui/sections/validation_issues.js"() {
77549       "use strict";
77550       init_debounce();
77551       init_src5();
77552       init_geo2();
77553       init_icon();
77554       init_preferences();
77555       init_localizer();
77556       init_util();
77557       init_section();
77558     }
77559   });
77560
77561   // modules/ui/sections/validation_options.js
77562   var validation_options_exports = {};
77563   __export(validation_options_exports, {
77564     uiSectionValidationOptions: () => uiSectionValidationOptions
77565   });
77566   function uiSectionValidationOptions(context) {
77567     var section = uiSection("issues-options", context).content(renderContent);
77568     function renderContent(selection2) {
77569       var container = selection2.selectAll(".issues-options-container").data([0]);
77570       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
77571       var data = [
77572         { key: "what", values: ["edited", "all"] },
77573         { key: "where", values: ["visible", "all"] }
77574       ];
77575       var options = container.selectAll(".issues-option").data(data, function(d2) {
77576         return d2.key;
77577       });
77578       var optionsEnter = options.enter().append("div").attr("class", function(d2) {
77579         return "issues-option issues-option-" + d2.key;
77580       });
77581       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
77582         return _t.html("issues.options." + d2.key + ".title");
77583       });
77584       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
77585         return d2.values.map(function(val) {
77586           return { value: val, key: d2.key };
77587         });
77588       }).enter().append("label");
77589       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
77590         return "issues-option-" + d2.key;
77591       }).attr("value", function(d2) {
77592         return d2.value;
77593       }).property("checked", function(d2) {
77594         return getOptions()[d2.key] === d2.value;
77595       }).on("change", function(d3_event, d2) {
77596         updateOptionValue(d3_event, d2.key, d2.value);
77597       });
77598       valuesEnter.append("span").html(function(d2) {
77599         return _t.html("issues.options." + d2.key + "." + d2.value);
77600       });
77601     }
77602     function getOptions() {
77603       return {
77604         what: corePreferences("validate-what") || "edited",
77605         // 'all', 'edited'
77606         where: corePreferences("validate-where") || "all"
77607         // 'all', 'visible'
77608       };
77609     }
77610     function updateOptionValue(d3_event, d2, val) {
77611       if (!val && d3_event && d3_event.target) {
77612         val = d3_event.target.value;
77613       }
77614       corePreferences("validate-" + d2, val);
77615       context.validator().validate();
77616     }
77617     return section;
77618   }
77619   var init_validation_options = __esm({
77620     "modules/ui/sections/validation_options.js"() {
77621       "use strict";
77622       init_preferences();
77623       init_localizer();
77624       init_section();
77625     }
77626   });
77627
77628   // modules/ui/sections/validation_rules.js
77629   var validation_rules_exports = {};
77630   __export(validation_rules_exports, {
77631     uiSectionValidationRules: () => uiSectionValidationRules
77632   });
77633   function uiSectionValidationRules(context) {
77634     var MINSQUARE = 0;
77635     var MAXSQUARE = 20;
77636     var DEFAULTSQUARE = 5;
77637     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
77638     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
77639       return key !== "maprules";
77640     }).sort(function(key1, key2) {
77641       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
77642     });
77643     function renderDisclosureContent(selection2) {
77644       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
77645       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
77646       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
77647       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
77648       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
77649         d3_event.preventDefault();
77650         context.validator().disableRules(_ruleKeys);
77651       });
77652       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
77653         d3_event.preventDefault();
77654         context.validator().disableRules([]);
77655       });
77656       container = container.merge(containerEnter);
77657       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
77658     }
77659     function drawListItems(selection2, data, type2, name, change, active) {
77660       var items = selection2.selectAll("li").data(data);
77661       items.exit().remove();
77662       var enter = items.enter().append("li");
77663       if (name === "rule") {
77664         enter.call(
77665           uiTooltip().title(function(d2) {
77666             return _t.append("issues." + d2 + ".tip");
77667           }).placement("top")
77668         );
77669       }
77670       var label = enter.append("label");
77671       label.append("input").attr("type", type2).attr("name", name).on("change", change);
77672       label.append("span").html(function(d2) {
77673         var params = {};
77674         if (d2 === "unsquare_way") {
77675           params.val = { html: '<span class="square-degrees"></span>' };
77676         }
77677         return _t.html("issues." + d2 + ".title", params);
77678       });
77679       items = items.merge(enter);
77680       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
77681       var degStr = corePreferences("validate-square-degrees");
77682       if (degStr === null) {
77683         degStr = DEFAULTSQUARE.toString();
77684       }
77685       var span = items.selectAll(".square-degrees");
77686       var input = span.selectAll(".square-degrees-input").data([0]);
77687       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) {
77688         d3_event.preventDefault();
77689         d3_event.stopPropagation();
77690         this.select();
77691       }).on("keyup", function(d3_event) {
77692         if (d3_event.keyCode === 13) {
77693           this.blur();
77694           this.select();
77695         }
77696       }).on("blur", changeSquare).merge(input).property("value", degStr);
77697     }
77698     function changeSquare() {
77699       var input = select_default2(this);
77700       var degStr = utilGetSetValue(input).trim();
77701       var degNum = Number(degStr);
77702       if (!isFinite(degNum)) {
77703         degNum = DEFAULTSQUARE;
77704       } else if (degNum > MAXSQUARE) {
77705         degNum = MAXSQUARE;
77706       } else if (degNum < MINSQUARE) {
77707         degNum = MINSQUARE;
77708       }
77709       degNum = Math.round(degNum * 10) / 10;
77710       degStr = degNum.toString();
77711       input.property("value", degStr);
77712       corePreferences("validate-square-degrees", degStr);
77713       context.validator().revalidateUnsquare();
77714     }
77715     function isRuleEnabled(d2) {
77716       return context.validator().isRuleEnabled(d2);
77717     }
77718     function toggleRule(d3_event, d2) {
77719       context.validator().toggleRule(d2);
77720     }
77721     context.validator().on("validated.uiSectionValidationRules", function() {
77722       window.requestIdleCallback(section.reRender);
77723     });
77724     return section;
77725   }
77726   var init_validation_rules = __esm({
77727     "modules/ui/sections/validation_rules.js"() {
77728       "use strict";
77729       init_src5();
77730       init_preferences();
77731       init_localizer();
77732       init_util();
77733       init_tooltip();
77734       init_section();
77735     }
77736   });
77737
77738   // modules/ui/sections/validation_status.js
77739   var validation_status_exports = {};
77740   __export(validation_status_exports, {
77741     uiSectionValidationStatus: () => uiSectionValidationStatus
77742   });
77743   function uiSectionValidationStatus(context) {
77744     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
77745       var issues = context.validator().getIssues(getOptions());
77746       return issues.length === 0;
77747     });
77748     function getOptions() {
77749       return {
77750         what: corePreferences("validate-what") || "edited",
77751         where: corePreferences("validate-where") || "all"
77752       };
77753     }
77754     function renderContent(selection2) {
77755       var box = selection2.selectAll(".box").data([0]);
77756       var boxEnter = box.enter().append("div").attr("class", "box");
77757       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
77758       var noIssuesMessage = boxEnter.append("span");
77759       noIssuesMessage.append("strong").attr("class", "message");
77760       noIssuesMessage.append("br");
77761       noIssuesMessage.append("span").attr("class", "details");
77762       renderIgnoredIssuesReset(selection2);
77763       setNoIssuesText(selection2);
77764     }
77765     function renderIgnoredIssuesReset(selection2) {
77766       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
77767       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
77768       resetIgnored.exit().remove();
77769       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
77770       resetIgnoredEnter.append("a").attr("href", "#");
77771       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
77772       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
77773       resetIgnored.on("click", function(d3_event) {
77774         d3_event.preventDefault();
77775         context.validator().resetIgnoredIssues();
77776       });
77777     }
77778     function setNoIssuesText(selection2) {
77779       var opts = getOptions();
77780       function checkForHiddenIssues(cases) {
77781         for (var type2 in cases) {
77782           var hiddenOpts = cases[type2];
77783           var hiddenIssues = context.validator().getIssues(hiddenOpts);
77784           if (hiddenIssues.length) {
77785             selection2.select(".box .details").html("").call(_t.append(
77786               "issues.no_issues.hidden_issues." + type2,
77787               { count: hiddenIssues.length.toString() }
77788             ));
77789             return;
77790           }
77791         }
77792         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
77793       }
77794       var messageType;
77795       if (opts.what === "edited" && opts.where === "visible") {
77796         messageType = "edits_in_view";
77797         checkForHiddenIssues({
77798           elsewhere: { what: "edited", where: "all" },
77799           everything_else: { what: "all", where: "visible" },
77800           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
77801           everything_else_elsewhere: { what: "all", where: "all" },
77802           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
77803           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
77804           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
77805         });
77806       } else if (opts.what === "edited" && opts.where === "all") {
77807         messageType = "edits";
77808         checkForHiddenIssues({
77809           everything_else: { what: "all", where: "all" },
77810           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
77811           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
77812         });
77813       } else if (opts.what === "all" && opts.where === "visible") {
77814         messageType = "everything_in_view";
77815         checkForHiddenIssues({
77816           elsewhere: { what: "all", where: "all" },
77817           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
77818           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
77819           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
77820           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
77821         });
77822       } else if (opts.what === "all" && opts.where === "all") {
77823         messageType = "everything";
77824         checkForHiddenIssues({
77825           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
77826           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
77827         });
77828       }
77829       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
77830         messageType = "no_edits";
77831       }
77832       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
77833     }
77834     context.validator().on("validated.uiSectionValidationStatus", function() {
77835       window.requestIdleCallback(section.reRender);
77836     });
77837     context.map().on(
77838       "move.uiSectionValidationStatus",
77839       debounce_default(function() {
77840         window.requestIdleCallback(section.reRender);
77841       }, 1e3)
77842     );
77843     return section;
77844   }
77845   var init_validation_status = __esm({
77846     "modules/ui/sections/validation_status.js"() {
77847       "use strict";
77848       init_debounce();
77849       init_icon();
77850       init_preferences();
77851       init_localizer();
77852       init_section();
77853     }
77854   });
77855
77856   // modules/ui/panes/issues.js
77857   var issues_exports = {};
77858   __export(issues_exports, {
77859     uiPaneIssues: () => uiPaneIssues
77860   });
77861   function uiPaneIssues(context) {
77862     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
77863       uiSectionValidationOptions(context),
77864       uiSectionValidationStatus(context),
77865       uiSectionValidationIssues("issues-errors", "error", context),
77866       uiSectionValidationIssues("issues-warnings", "warning", context),
77867       uiSectionValidationRules(context)
77868     ]);
77869     return issuesPane;
77870   }
77871   var init_issues = __esm({
77872     "modules/ui/panes/issues.js"() {
77873       "use strict";
77874       init_localizer();
77875       init_pane();
77876       init_validation_issues();
77877       init_validation_options();
77878       init_validation_rules();
77879       init_validation_status();
77880     }
77881   });
77882
77883   // modules/ui/settings/custom_data.js
77884   var custom_data_exports = {};
77885   __export(custom_data_exports, {
77886     uiSettingsCustomData: () => uiSettingsCustomData
77887   });
77888   function uiSettingsCustomData(context) {
77889     var dispatch14 = dispatch_default("change");
77890     function render(selection2) {
77891       var dataLayer = context.layers().layer("data");
77892       var _origSettings = {
77893         fileList: dataLayer && dataLayer.fileList() || null,
77894         url: corePreferences("settings-custom-data-url")
77895       };
77896       var _currSettings = {
77897         fileList: dataLayer && dataLayer.fileList() || null
77898         // url: prefs('settings-custom-data-url')
77899       };
77900       var modal = uiConfirm(selection2).okButton();
77901       modal.classed("settings-modal settings-custom-data", true);
77902       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
77903       var textSection = modal.select(".modal-section.message-text");
77904       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
77905       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) {
77906         var files = d3_event.target.files;
77907         if (files && files.length) {
77908           _currSettings.url = "";
77909           textSection.select(".field-url").property("value", "");
77910           _currSettings.fileList = files;
77911         } else {
77912           _currSettings.fileList = null;
77913         }
77914       });
77915       textSection.append("h4").call(_t.append("settings.custom_data.or"));
77916       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
77917       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
77918       var buttonSection = modal.select(".modal-section.buttons");
77919       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
77920       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
77921       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
77922       function isSaveDisabled() {
77923         return null;
77924       }
77925       function clickCancel() {
77926         textSection.select(".field-url").property("value", _origSettings.url);
77927         corePreferences("settings-custom-data-url", _origSettings.url);
77928         this.blur();
77929         modal.close();
77930       }
77931       function clickSave() {
77932         _currSettings.url = textSection.select(".field-url").property("value").trim();
77933         if (_currSettings.url) {
77934           _currSettings.fileList = null;
77935         }
77936         if (_currSettings.fileList) {
77937           _currSettings.url = "";
77938         }
77939         corePreferences("settings-custom-data-url", _currSettings.url);
77940         this.blur();
77941         modal.close();
77942         dispatch14.call("change", this, _currSettings);
77943       }
77944     }
77945     return utilRebind(render, dispatch14, "on");
77946   }
77947   var init_custom_data = __esm({
77948     "modules/ui/settings/custom_data.js"() {
77949       "use strict";
77950       init_src4();
77951       init_preferences();
77952       init_localizer();
77953       init_confirm();
77954       init_util();
77955     }
77956   });
77957
77958   // modules/ui/sections/data_layers.js
77959   var data_layers_exports = {};
77960   __export(data_layers_exports, {
77961     uiSectionDataLayers: () => uiSectionDataLayers
77962   });
77963   function uiSectionDataLayers(context) {
77964     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
77965     var layers = context.layers();
77966     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
77967     function renderDisclosureContent(selection2) {
77968       var container = selection2.selectAll(".data-layer-container").data([0]);
77969       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
77970     }
77971     function showsLayer(which) {
77972       var layer = layers.layer(which);
77973       if (layer) {
77974         return layer.enabled();
77975       }
77976       return false;
77977     }
77978     function setLayer(which, enabled) {
77979       var mode = context.mode();
77980       if (mode && /^draw/.test(mode.id)) return;
77981       var layer = layers.layer(which);
77982       if (layer) {
77983         layer.enabled(enabled);
77984         if (!enabled && (which === "osm" || which === "notes")) {
77985           context.enter(modeBrowse(context));
77986         }
77987       }
77988     }
77989     function toggleLayer(which) {
77990       setLayer(which, !showsLayer(which));
77991     }
77992     function drawOsmItems(selection2) {
77993       var osmKeys = ["osm", "notes"];
77994       var osmLayers = layers.all().filter(function(obj) {
77995         return osmKeys.indexOf(obj.id) !== -1;
77996       });
77997       var ul = selection2.selectAll(".layer-list-osm").data([0]);
77998       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
77999       var li = ul.selectAll(".list-item").data(osmLayers);
78000       li.exit().remove();
78001       var liEnter = li.enter().append("li").attr("class", function(d2) {
78002         return "list-item list-item-" + d2.id;
78003       });
78004       var labelEnter = liEnter.append("label").each(function(d2) {
78005         if (d2.id === "osm") {
78006           select_default2(this).call(
78007             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
78008           );
78009         } else {
78010           select_default2(this).call(
78011             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
78012           );
78013         }
78014       });
78015       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78016         toggleLayer(d2.id);
78017       });
78018       labelEnter.append("span").html(function(d2) {
78019         return _t.html("map_data.layers." + d2.id + ".title");
78020       });
78021       li.merge(liEnter).classed("active", function(d2) {
78022         return d2.layer.enabled();
78023       }).selectAll("input").property("checked", function(d2) {
78024         return d2.layer.enabled();
78025       });
78026     }
78027     function drawQAItems(selection2) {
78028       var qaKeys = ["keepRight", "osmose"];
78029       var qaLayers = layers.all().filter(function(obj) {
78030         return qaKeys.indexOf(obj.id) !== -1;
78031       });
78032       var ul = selection2.selectAll(".layer-list-qa").data([0]);
78033       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
78034       var li = ul.selectAll(".list-item").data(qaLayers);
78035       li.exit().remove();
78036       var liEnter = li.enter().append("li").attr("class", function(d2) {
78037         return "list-item list-item-" + d2.id;
78038       });
78039       var labelEnter = liEnter.append("label").each(function(d2) {
78040         select_default2(this).call(
78041           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
78042         );
78043       });
78044       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78045         toggleLayer(d2.id);
78046       });
78047       labelEnter.append("span").each(function(d2) {
78048         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
78049       });
78050       li.merge(liEnter).classed("active", function(d2) {
78051         return d2.layer.enabled();
78052       }).selectAll("input").property("checked", function(d2) {
78053         return d2.layer.enabled();
78054       });
78055     }
78056     function drawVectorItems(selection2) {
78057       var dataLayer = layers.layer("data");
78058       var vtData = [
78059         {
78060           name: "Detroit Neighborhoods/Parks",
78061           src: "neighborhoods-parks",
78062           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
78063           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"
78064         },
78065         {
78066           name: "Detroit Composite POIs",
78067           src: "composite-poi",
78068           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
78069           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"
78070         },
78071         {
78072           name: "Detroit All-The-Places POIs",
78073           src: "alltheplaces-poi",
78074           tooltip: "Public domain business location data created by web scrapers.",
78075           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"
78076         }
78077       ];
78078       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
78079       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
78080       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
78081       container.exit().remove();
78082       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
78083       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
78084       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
78085       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");
78086       container = container.merge(containerEnter);
78087       var ul = container.selectAll(".layer-list-vectortile");
78088       var li = ul.selectAll(".list-item").data(vtData);
78089       li.exit().remove();
78090       var liEnter = li.enter().append("li").attr("class", function(d2) {
78091         return "list-item list-item-" + d2.src;
78092       });
78093       var labelEnter = liEnter.append("label").each(function(d2) {
78094         select_default2(this).call(
78095           uiTooltip().title(d2.tooltip).placement("top")
78096         );
78097       });
78098       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
78099       labelEnter.append("span").text(function(d2) {
78100         return d2.name;
78101       });
78102       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
78103       function isVTLayerSelected(d2) {
78104         return dataLayer && dataLayer.template() === d2.template;
78105       }
78106       function selectVTLayer(d3_event, d2) {
78107         corePreferences("settings-custom-data-url", d2.template);
78108         if (dataLayer) {
78109           dataLayer.template(d2.template, d2.src);
78110           dataLayer.enabled(true);
78111         }
78112       }
78113     }
78114     function drawCustomDataItems(selection2) {
78115       var dataLayer = layers.layer("data");
78116       var hasData = dataLayer && dataLayer.hasData();
78117       var showsData = hasData && dataLayer.enabled();
78118       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
78119       ul.exit().remove();
78120       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
78121       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
78122       var labelEnter = liEnter.append("label").call(
78123         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
78124       );
78125       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
78126         toggleLayer("data");
78127       });
78128       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
78129       liEnter.append("button").attr("class", "open-data-options").call(
78130         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78131       ).on("click", function(d3_event) {
78132         d3_event.preventDefault();
78133         editCustom();
78134       }).call(svgIcon("#iD-icon-more"));
78135       liEnter.append("button").attr("class", "zoom-to-data").call(
78136         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78137       ).on("click", function(d3_event) {
78138         if (select_default2(this).classed("disabled")) return;
78139         d3_event.preventDefault();
78140         d3_event.stopPropagation();
78141         dataLayer.fitZoom();
78142       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
78143       ul = ul.merge(ulEnter);
78144       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
78145       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
78146     }
78147     function editCustom() {
78148       context.container().call(settingsCustomData);
78149     }
78150     function customChanged(d2) {
78151       var dataLayer = layers.layer("data");
78152       if (d2 && d2.url) {
78153         dataLayer.url(d2.url);
78154       } else if (d2 && d2.fileList) {
78155         dataLayer.fileList(d2.fileList);
78156       }
78157     }
78158     function drawPanelItems(selection2) {
78159       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
78160       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
78161         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
78162       );
78163       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
78164         d3_event.preventDefault();
78165         context.ui().info.toggle("history");
78166       });
78167       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
78168       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
78169         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
78170       );
78171       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
78172         d3_event.preventDefault();
78173         context.ui().info.toggle("measurement");
78174       });
78175       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
78176     }
78177     context.layers().on("change.uiSectionDataLayers", section.reRender);
78178     context.map().on(
78179       "move.uiSectionDataLayers",
78180       debounce_default(function() {
78181         window.requestIdleCallback(section.reRender);
78182       }, 1e3)
78183     );
78184     return section;
78185   }
78186   var init_data_layers = __esm({
78187     "modules/ui/sections/data_layers.js"() {
78188       "use strict";
78189       init_debounce();
78190       init_src5();
78191       init_preferences();
78192       init_localizer();
78193       init_tooltip();
78194       init_icon();
78195       init_geo2();
78196       init_browse();
78197       init_cmd();
78198       init_section();
78199       init_custom_data();
78200     }
78201   });
78202
78203   // modules/ui/sections/map_features.js
78204   var map_features_exports = {};
78205   __export(map_features_exports, {
78206     uiSectionMapFeatures: () => uiSectionMapFeatures
78207   });
78208   function uiSectionMapFeatures(context) {
78209     var _features = context.features().keys();
78210     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78211     function renderDisclosureContent(selection2) {
78212       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
78213       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
78214       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
78215       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
78216       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
78217         d3_event.preventDefault();
78218         context.features().disableAll();
78219       });
78220       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
78221         d3_event.preventDefault();
78222         context.features().enableAll();
78223       });
78224       container = container.merge(containerEnter);
78225       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
78226     }
78227     function drawListItems(selection2, data, type2, name, change, active) {
78228       var items = selection2.selectAll("li").data(data);
78229       items.exit().remove();
78230       var enter = items.enter().append("li").call(
78231         uiTooltip().title(function(d2) {
78232           var tip = _t.append(name + "." + d2 + ".tooltip");
78233           if (autoHiddenFeature(d2)) {
78234             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
78235             return (selection3) => {
78236               selection3.call(tip);
78237               selection3.append("div").call(msg);
78238             };
78239           }
78240           return tip;
78241         }).placement("top")
78242       );
78243       var label = enter.append("label");
78244       label.append("input").attr("type", type2).attr("name", name).on("change", change);
78245       label.append("span").html(function(d2) {
78246         return _t.html(name + "." + d2 + ".description");
78247       });
78248       items = items.merge(enter);
78249       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
78250     }
78251     function autoHiddenFeature(d2) {
78252       return context.features().autoHidden(d2);
78253     }
78254     function showsFeature(d2) {
78255       return context.features().enabled(d2);
78256     }
78257     function clickFeature(d3_event, d2) {
78258       context.features().toggle(d2);
78259     }
78260     function showsLayer(id2) {
78261       var layer = context.layers().layer(id2);
78262       return layer && layer.enabled();
78263     }
78264     context.features().on("change.map_features", section.reRender);
78265     return section;
78266   }
78267   var init_map_features = __esm({
78268     "modules/ui/sections/map_features.js"() {
78269       "use strict";
78270       init_localizer();
78271       init_tooltip();
78272       init_section();
78273     }
78274   });
78275
78276   // modules/ui/sections/map_style_options.js
78277   var map_style_options_exports = {};
78278   __export(map_style_options_exports, {
78279     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions
78280   });
78281   function uiSectionMapStyleOptions(context) {
78282     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78283     function renderDisclosureContent(selection2) {
78284       var container = selection2.selectAll(".layer-fill-list").data([0]);
78285       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
78286       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
78287       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
78288         return context.surface().classed("highlight-edited");
78289       });
78290     }
78291     function drawListItems(selection2, data, type2, name, change, active) {
78292       var items = selection2.selectAll("li").data(data);
78293       items.exit().remove();
78294       var enter = items.enter().append("li").call(
78295         uiTooltip().title(function(d2) {
78296           return _t.append(name + "." + d2 + ".tooltip");
78297         }).keys(function(d2) {
78298           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
78299           if (d2 === "highlight_edits") key = _t("map_data.highlight_edits.key");
78300           return key ? [key] : null;
78301         }).placement("top")
78302       );
78303       var label = enter.append("label");
78304       label.append("input").attr("type", type2).attr("name", name).on("change", change);
78305       label.append("span").html(function(d2) {
78306         return _t.html(name + "." + d2 + ".description");
78307       });
78308       items = items.merge(enter);
78309       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
78310     }
78311     function isActiveFill(d2) {
78312       return context.map().activeAreaFill() === d2;
78313     }
78314     function toggleHighlightEdited(d3_event) {
78315       d3_event.preventDefault();
78316       context.map().toggleHighlightEdited();
78317     }
78318     function setFill(d3_event, d2) {
78319       context.map().activeAreaFill(d2);
78320     }
78321     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
78322     return section;
78323   }
78324   var init_map_style_options = __esm({
78325     "modules/ui/sections/map_style_options.js"() {
78326       "use strict";
78327       init_localizer();
78328       init_tooltip();
78329       init_section();
78330     }
78331   });
78332
78333   // modules/ui/settings/local_photos.js
78334   var local_photos_exports2 = {};
78335   __export(local_photos_exports2, {
78336     uiSettingsLocalPhotos: () => uiSettingsLocalPhotos
78337   });
78338   function uiSettingsLocalPhotos(context) {
78339     var dispatch14 = dispatch_default("change");
78340     var photoLayer = context.layers().layer("local-photos");
78341     var modal;
78342     function render(selection2) {
78343       modal = uiConfirm(selection2).okButton();
78344       modal.classed("settings-modal settings-local-photos", true);
78345       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
78346       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
78347       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
78348       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
78349       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) {
78350         var files = d3_event.target.files;
78351         if (files && files.length) {
78352           photoList.select("ul").append("li").classed("placeholder", true).append("div");
78353           dispatch14.call("change", this, files);
78354         }
78355         d3_event.target.value = null;
78356       });
78357       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
78358       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
78359       photoList.append("ul");
78360       updatePhotoList(photoList.select("ul"));
78361       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
78362     }
78363     function updatePhotoList(container) {
78364       var _a4;
78365       function locationUnavailable(d2) {
78366         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
78367       }
78368       container.selectAll("li.placeholder").remove();
78369       let selection2 = container.selectAll("li").data((_a4 = photoLayer.getPhotos()) != null ? _a4 : [], (d2) => d2.id);
78370       selection2.exit().remove();
78371       const selectionEnter = selection2.enter().append("li");
78372       selectionEnter.append("span").classed("filename", true);
78373       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
78374       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
78375         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
78376       );
78377       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
78378       selection2 = selection2.merge(selectionEnter);
78379       selection2.classed("invalid", locationUnavailable);
78380       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
78381       selection2.select("span.filename").on("click", (d3_event, d2) => {
78382         photoLayer.openPhoto(d3_event, d2, false);
78383       });
78384       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
78385         photoLayer.openPhoto(d3_event, d2, true);
78386       });
78387       selection2.select("button.remove").on("click", (d3_event, d2) => {
78388         photoLayer.removePhoto(d2.id);
78389         updatePhotoList(container);
78390       });
78391     }
78392     return utilRebind(render, dispatch14, "on");
78393   }
78394   var init_local_photos2 = __esm({
78395     "modules/ui/settings/local_photos.js"() {
78396       "use strict";
78397       init_src4();
78398       init_lodash();
78399       init_localizer();
78400       init_confirm();
78401       init_util();
78402       init_tooltip();
78403       init_svg();
78404     }
78405   });
78406
78407   // modules/ui/sections/photo_overlays.js
78408   var photo_overlays_exports = {};
78409   __export(photo_overlays_exports, {
78410     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays
78411   });
78412   function uiSectionPhotoOverlays(context) {
78413     let _savedLayers = [];
78414     let _layersHidden = false;
78415     const _streetLayerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
78416     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
78417     var layers = context.layers();
78418     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78419     const photoDates = {};
78420     const now3 = +/* @__PURE__ */ new Date();
78421     function renderDisclosureContent(selection2) {
78422       var container = selection2.selectAll(".photo-overlay-container").data([0]);
78423       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateSlider).call(drawUsernameFilter).call(drawLocalPhotos);
78424     }
78425     function drawPhotoItems(selection2) {
78426       var photoKeys = context.photos().overlayLayerIDs();
78427       var photoLayers = layers.all().filter(function(obj) {
78428         return photoKeys.indexOf(obj.id) !== -1;
78429       });
78430       var data = photoLayers.filter(function(obj) {
78431         if (!obj.layer.supported()) return false;
78432         if (layerEnabled(obj)) return true;
78433         if (typeof obj.layer.validHere === "function") {
78434           return obj.layer.validHere(context.map().extent(), context.map().zoom());
78435         }
78436         return true;
78437       });
78438       function layerSupported(d2) {
78439         return d2.layer && d2.layer.supported();
78440       }
78441       function layerEnabled(d2) {
78442         return layerSupported(d2) && (d2.layer.enabled() || _savedLayers.includes(d2.id));
78443       }
78444       function layerRendered(d2) {
78445         var _a4, _b2, _c;
78446         return (_c = (_b2 = (_a4 = d2.layer).rendered) == null ? void 0 : _b2.call(_a4, context.map().zoom())) != null ? _c : true;
78447       }
78448       var ul = selection2.selectAll(".layer-list-photos").data([0]);
78449       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
78450       var li = ul.selectAll(".list-item-photos").data(data, (d2) => d2.id);
78451       li.exit().remove();
78452       var liEnter = li.enter().append("li").attr("class", function(d2) {
78453         var classes = "list-item-photos list-item-" + d2.id;
78454         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
78455           classes += " indented";
78456         }
78457         return classes;
78458       });
78459       var labelEnter = liEnter.append("label").each(function(d2) {
78460         var titleID;
78461         if (d2.id === "mapillary-signs") titleID = "mapillary.signs.tooltip";
78462         else if (d2.id === "mapillary") titleID = "mapillary_images.tooltip";
78463         else if (d2.id === "kartaview") titleID = "kartaview_images.tooltip";
78464         else titleID = d2.id.replace(/-/g, "_") + ".tooltip";
78465         select_default2(this).call(
78466           uiTooltip().title(() => {
78467             if (!layerRendered(d2)) {
78468               return _t.append("street_side.minzoom_tooltip");
78469             } else {
78470               return _t.append(titleID);
78471             }
78472           }).placement("top")
78473         );
78474       });
78475       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78476         toggleLayer(d2.id);
78477       });
78478       labelEnter.append("span").html(function(d2) {
78479         var id2 = d2.id;
78480         if (id2 === "mapillary-signs") id2 = "photo_overlays.traffic_signs";
78481         return _t.html(id2.replace(/-/g, "_") + ".title");
78482       });
78483       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
78484     }
78485     function drawPhotoTypeItems(selection2) {
78486       var data = context.photos().allPhotoTypes();
78487       function typeEnabled(d2) {
78488         return context.photos().showsPhotoType(d2);
78489       }
78490       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
78491       ul.exit().remove();
78492       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
78493       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
78494       li.exit().remove();
78495       var liEnter = li.enter().append("li").attr("class", function(d2) {
78496         return "list-item-photo-types list-item-" + d2;
78497       });
78498       var labelEnter = liEnter.append("label").each(function(d2) {
78499         select_default2(this).call(
78500           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
78501         );
78502       });
78503       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78504         context.photos().togglePhotoType(d2, true);
78505       });
78506       labelEnter.append("span").html(function(d2) {
78507         return _t.html("photo_overlays.photo_type." + d2 + ".title");
78508       });
78509       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
78510     }
78511     function drawDateSlider(selection2) {
78512       var ul = selection2.selectAll(".layer-list-date-slider").data([0]);
78513       ul.exit().remove();
78514       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-slider").merge(ul);
78515       var li = ul.selectAll(".list-item-date-slider").data(context.photos().shouldFilterDateBySlider() ? ["date-slider"] : []);
78516       li.exit().remove();
78517       var liEnter = li.enter().append("li").attr("class", "list-item-date-slider");
78518       var labelEnter = liEnter.append("label").each(function() {
78519         select_default2(this).call(
78520           uiTooltip().title(() => _t.append("photo_overlays.age_slider_filter.tooltip")).placement("top")
78521         );
78522       });
78523       labelEnter.append("span").attr("class", "dateSliderSpan").call(_t.append("photo_overlays.age_slider_filter.title"));
78524       let sliderWrap = labelEnter.append("div").attr("class", "slider-wrap");
78525       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() {
78526         let value = select_default2(this).property("value");
78527         setYearFilter(value, true, "from");
78528       });
78529       selection2.select("input.from-date").each(function() {
78530         this.value = dateSliderValue("from");
78531       });
78532       sliderWrap.append("div").attr("class", "date-slider-label");
78533       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() {
78534         let value = select_default2(this).property("value");
78535         setYearFilter(1 - value, true, "to");
78536       });
78537       selection2.select("input.to-date").each(function() {
78538         this.value = 1 - dateSliderValue("to");
78539       });
78540       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", {
78541         date: new Date(now3 - Math.pow(dateSliderValue("from"), 1.45) * 10 * 365.25 * 86400 * 1e3).toLocaleDateString(_mainLocalizer.localeCode())
78542       }));
78543       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range");
78544       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range-inverted");
78545       const dateTicks = /* @__PURE__ */ new Set();
78546       for (const dates of Object.values(photoDates)) {
78547         dates.forEach((date) => {
78548           dateTicks.add(Math.round(1e3 * Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45)) / 1e3);
78549         });
78550       }
78551       const ticks2 = selection2.select("datalist#photo-overlay-data-range").selectAll("option").data([...dateTicks].concat([1, 0]));
78552       ticks2.exit().remove();
78553       ticks2.enter().append("option").merge(ticks2).attr("value", (d2) => d2);
78554       const ticksInverted = selection2.select("datalist#photo-overlay-data-range-inverted").selectAll("option").data([...dateTicks].concat([1, 0]));
78555       ticksInverted.exit().remove();
78556       ticksInverted.enter().append("option").merge(ticksInverted).attr("value", (d2) => 1 - d2);
78557       li.merge(liEnter).classed("active", filterEnabled);
78558       function filterEnabled() {
78559         return !!context.photos().fromDate();
78560       }
78561     }
78562     function dateSliderValue(which) {
78563       const val = which === "from" ? context.photos().fromDate() : context.photos().toDate();
78564       if (val) {
78565         const date = +new Date(val);
78566         return Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45);
78567       } else return which === "from" ? 1 : 0;
78568     }
78569     function setYearFilter(value, updateUrl, which) {
78570       value = +value + (which === "from" ? 1e-3 : -1e-3);
78571       if (value < 1 && value > 0) {
78572         const date = new Date(now3 - Math.pow(value, 1.45) * 10 * 365.25 * 86400 * 1e3).toISOString().substring(0, 10);
78573         context.photos().setDateFilter(`${which}Date`, date, updateUrl);
78574       } else {
78575         context.photos().setDateFilter(`${which}Date`, null, updateUrl);
78576       }
78577     }
78578     ;
78579     function drawUsernameFilter(selection2) {
78580       function filterEnabled() {
78581         return context.photos().usernames();
78582       }
78583       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
78584       ul.exit().remove();
78585       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
78586       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
78587       li.exit().remove();
78588       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
78589       var labelEnter = liEnter.append("label").each(function() {
78590         select_default2(this).call(
78591           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
78592         );
78593       });
78594       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
78595       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
78596         var value = select_default2(this).property("value");
78597         context.photos().setUsernameFilter(value, true);
78598         select_default2(this).property("value", usernameValue);
78599       });
78600       li.merge(liEnter).classed("active", filterEnabled);
78601       function usernameValue() {
78602         var usernames = context.photos().usernames();
78603         if (usernames) return usernames.join("; ");
78604         return usernames;
78605       }
78606     }
78607     function toggleLayer(which) {
78608       setLayer(which, !showsLayer(which));
78609     }
78610     function showsLayer(which) {
78611       var layer = layers.layer(which);
78612       if (layer) {
78613         return layer.enabled();
78614       }
78615       return false;
78616     }
78617     function setLayer(which, enabled) {
78618       var layer = layers.layer(which);
78619       if (layer) {
78620         layer.enabled(enabled);
78621       }
78622     }
78623     function drawLocalPhotos(selection2) {
78624       var photoLayer = layers.layer("local-photos");
78625       var hasData = photoLayer && photoLayer.hasData();
78626       var showsData = hasData && photoLayer.enabled();
78627       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
78628       ul.exit().remove();
78629       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
78630       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
78631       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
78632       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
78633         toggleLayer("local-photos");
78634       });
78635       localPhotosLabelEnter.call(_t.append("local_photos.header"));
78636       localPhotosEnter.append("button").attr("class", "open-data-options").call(
78637         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78638       ).on("click", function(d3_event) {
78639         d3_event.preventDefault();
78640         editLocalPhotos();
78641       }).call(svgIcon("#iD-icon-more"));
78642       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
78643         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78644       ).on("click", function(d3_event) {
78645         if (select_default2(this).classed("disabled")) return;
78646         d3_event.preventDefault();
78647         d3_event.stopPropagation();
78648         photoLayer.fitZoom();
78649       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
78650       ul = ul.merge(ulEnter);
78651       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
78652       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
78653     }
78654     function editLocalPhotos() {
78655       context.container().call(settingsLocalPhotos);
78656     }
78657     function localPhotosChanged(d2) {
78658       var localPhotosLayer = layers.layer("local-photos");
78659       localPhotosLayer.fileList(d2);
78660     }
78661     function toggleStreetSide() {
78662       let layerContainer = select_default2(".photo-overlay-container");
78663       if (!_layersHidden) {
78664         layers.all().forEach((d2) => {
78665           if (_streetLayerIDs.includes(d2.id)) {
78666             if (showsLayer(d2.id)) _savedLayers.push(d2.id);
78667             setLayer(d2.id, false);
78668           }
78669         });
78670         layerContainer.classed("disabled-panel", true);
78671       } else {
78672         _savedLayers.forEach((d2) => {
78673           setLayer(d2, true);
78674         });
78675         _savedLayers = [];
78676         layerContainer.classed("disabled-panel", false);
78677       }
78678       _layersHidden = !_layersHidden;
78679     }
78680     ;
78681     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
78682     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
78683     context.layers().on("photoDatesChanged.uiSectionPhotoOverlays", function(service, dates) {
78684       photoDates[service] = dates.map((date) => +new Date(date));
78685       section.reRender();
78686     });
78687     context.keybinding().on("\u21E7P", toggleStreetSide);
78688     context.map().on(
78689       "move.photo_overlays",
78690       debounce_default(function() {
78691         window.requestIdleCallback(section.reRender);
78692       }, 1e3)
78693     );
78694     return section;
78695   }
78696   var init_photo_overlays = __esm({
78697     "modules/ui/sections/photo_overlays.js"() {
78698       "use strict";
78699       init_debounce();
78700       init_src5();
78701       init_localizer();
78702       init_tooltip();
78703       init_section();
78704       init_util();
78705       init_local_photos2();
78706       init_svg();
78707     }
78708   });
78709
78710   // modules/ui/panes/map_data.js
78711   var map_data_exports = {};
78712   __export(map_data_exports, {
78713     uiPaneMapData: () => uiPaneMapData
78714   });
78715   function uiPaneMapData(context) {
78716     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([
78717       uiSectionDataLayers(context),
78718       uiSectionPhotoOverlays(context),
78719       uiSectionMapStyleOptions(context),
78720       uiSectionMapFeatures(context)
78721     ]);
78722     return mapDataPane;
78723   }
78724   var init_map_data = __esm({
78725     "modules/ui/panes/map_data.js"() {
78726       "use strict";
78727       init_localizer();
78728       init_pane();
78729       init_data_layers();
78730       init_map_features();
78731       init_map_style_options();
78732       init_photo_overlays();
78733     }
78734   });
78735
78736   // modules/ui/panes/preferences.js
78737   var preferences_exports2 = {};
78738   __export(preferences_exports2, {
78739     uiPanePreferences: () => uiPanePreferences
78740   });
78741   function uiPanePreferences(context) {
78742     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
78743       uiSectionPrivacy(context)
78744     ]);
78745     return preferencesPane;
78746   }
78747   var init_preferences2 = __esm({
78748     "modules/ui/panes/preferences.js"() {
78749       "use strict";
78750       init_localizer();
78751       init_pane();
78752       init_privacy();
78753     }
78754   });
78755
78756   // modules/ui/init.js
78757   var init_exports = {};
78758   __export(init_exports, {
78759     uiInit: () => uiInit
78760   });
78761   function uiInit(context) {
78762     var _initCounter = 0;
78763     var _needWidth = {};
78764     var _lastPointerType;
78765     var overMap;
78766     function render(container) {
78767       container.on("click.ui", function(d3_event) {
78768         if (d3_event.button !== 0) return;
78769         if (!d3_event.composedPath) return;
78770         var isOkayTarget = d3_event.composedPath().some(function(node) {
78771           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
78772           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
78773           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
78774           node.nodeName === "A");
78775         });
78776         if (isOkayTarget) return;
78777         d3_event.preventDefault();
78778       });
78779       var detected = utilDetect();
78780       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
78781       // but we only need to do this on desktop Safari anyway. – #7694
78782       !detected.isMobileWebKit) {
78783         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
78784           d3_event.preventDefault();
78785         });
78786       }
78787       if ("PointerEvent" in window) {
78788         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
78789           var pointerType = d3_event.pointerType || "mouse";
78790           if (_lastPointerType !== pointerType) {
78791             _lastPointerType = pointerType;
78792             container.attr("pointer", pointerType);
78793           }
78794         }, true);
78795       } else {
78796         _lastPointerType = "mouse";
78797         container.attr("pointer", "mouse");
78798       }
78799       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
78800       container.call(uiFullScreen(context));
78801       var map2 = context.map();
78802       map2.redrawEnable(false);
78803       map2.on("hitMinZoom.ui", function() {
78804         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
78805       });
78806       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
78807       container.append("div").attr("class", "sidebar").call(ui.sidebar);
78808       var content = container.append("div").attr("class", "main-content active");
78809       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
78810       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
78811       overMap = content.append("div").attr("class", "over-map");
78812       overMap.append("div").attr("class", "select-trap").text("t");
78813       overMap.call(uiMapInMap(context)).call(uiNotice(context));
78814       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
78815       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
78816       var controls = controlsWrap.append("div").attr("class", "map-controls");
78817       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
78818       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
78819       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
78820       controlsWrap.on("wheel.mapControls", function(d3_event) {
78821         if (!d3_event.deltaX) {
78822           controlsWrap.node().scrollTop += d3_event.deltaY;
78823         }
78824       });
78825       var panes = overMap.append("div").attr("class", "map-panes");
78826       var uiPanes = [
78827         uiPaneBackground(context),
78828         uiPaneMapData(context),
78829         uiPaneIssues(context),
78830         uiPanePreferences(context),
78831         uiPaneHelp(context)
78832       ];
78833       uiPanes.forEach(function(pane) {
78834         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
78835         panes.call(pane.renderPane);
78836       });
78837       ui.info = uiInfo(context);
78838       overMap.call(ui.info);
78839       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
78840       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
78841       var about = content.append("div").attr("class", "map-footer");
78842       about.append("div").attr("class", "api-status").call(uiStatus(context));
78843       var footer = about.append("div").attr("class", "map-footer-bar fillD");
78844       footer.append("div").attr("class", "flash-wrap footer-hide");
78845       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
78846       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
78847       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
78848       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
78849       var apiConnections = context.connection().apiConnections();
78850       if (apiConnections && apiConnections.length > 1) {
78851         aboutList.append("li").attr("class", "source-switch").call(
78852           uiSourceSwitch(context).keys(apiConnections)
78853         );
78854       }
78855       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
78856       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
78857       var issueLinks = aboutList.append("li");
78858       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"));
78859       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"));
78860       aboutList.append("li").attr("class", "version").call(uiVersion(context));
78861       if (!context.embed()) {
78862         aboutList.call(uiAccount(context));
78863       }
78864       ui.onResize();
78865       map2.redrawEnable(true);
78866       ui.hash = behaviorHash(context);
78867       ui.hash();
78868       if (!ui.hash.hadLocation) {
78869         map2.centerZoom([0, 0], 2);
78870       }
78871       window.onbeforeunload = function() {
78872         return context.save();
78873       };
78874       window.onunload = function() {
78875         context.history().unlock();
78876       };
78877       select_default2(window).on("resize.editor", function() {
78878         ui.onResize();
78879       });
78880       var panPixels = 80;
78881       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) {
78882         if (d3_event) {
78883           d3_event.stopImmediatePropagation();
78884           d3_event.preventDefault();
78885         }
78886         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
78887         if (previousBackground) {
78888           var currentBackground = context.background().baseLayerSource();
78889           corePreferences("background-last-used-toggle", currentBackground.id);
78890           corePreferences("background-last-used", previousBackground.id);
78891           context.background().baseLayerSource(previousBackground);
78892         }
78893       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
78894         d3_event.preventDefault();
78895         d3_event.stopPropagation();
78896         context.map().toggleWireframe();
78897       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
78898         d3_event.preventDefault();
78899         d3_event.stopPropagation();
78900         var mode = context.mode();
78901         if (mode && /^draw/.test(mode.id)) return;
78902         var layer = context.layers().layer("osm");
78903         if (layer) {
78904           layer.enabled(!layer.enabled());
78905           if (!layer.enabled()) {
78906             context.enter(modeBrowse(context));
78907           }
78908         }
78909       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
78910         d3_event.preventDefault();
78911         context.map().toggleHighlightEdited();
78912       });
78913       context.on("enter.editor", function(entered) {
78914         container.classed("mode-" + entered.id, true);
78915       }).on("exit.editor", function(exited) {
78916         container.classed("mode-" + exited.id, false);
78917       });
78918       context.enter(modeBrowse(context));
78919       if (!_initCounter++) {
78920         if (!ui.hash.startWalkthrough) {
78921           context.container().call(uiSplash(context)).call(uiRestore(context));
78922         }
78923         context.container().call(ui.shortcuts);
78924       }
78925       var osm = context.connection();
78926       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
78927       if (osm && auth) {
78928         osm.on("authLoading.ui", function() {
78929           context.container().call(auth);
78930         }).on("authDone.ui", function() {
78931           auth.close();
78932         });
78933       }
78934       _initCounter++;
78935       if (ui.hash.startWalkthrough) {
78936         ui.hash.startWalkthrough = false;
78937         context.container().call(uiIntro(context));
78938       }
78939       function pan(d2) {
78940         return function(d3_event) {
78941           if (d3_event.shiftKey) return;
78942           if (context.container().select(".combobox").size()) return;
78943           d3_event.preventDefault();
78944           context.map().pan(d2, 100);
78945         };
78946       }
78947     }
78948     let ui = {};
78949     let _loadPromise;
78950     ui.ensureLoaded = () => {
78951       if (_loadPromise) return _loadPromise;
78952       return _loadPromise = Promise.all([
78953         // must have strings and presets before loading the UI
78954         _mainLocalizer.ensureLoaded(),
78955         _mainPresetIndex.ensureLoaded()
78956       ]).then(() => {
78957         if (!context.container().empty()) render(context.container());
78958       }).catch((err) => console.error(err));
78959     };
78960     ui.restart = function() {
78961       context.keybinding().clear();
78962       _loadPromise = null;
78963       context.container().selectAll("*").remove();
78964       ui.ensureLoaded();
78965     };
78966     ui.lastPointerType = function() {
78967       return _lastPointerType;
78968     };
78969     ui.svgDefs = svgDefs(context);
78970     ui.flash = uiFlash(context);
78971     ui.sidebar = uiSidebar(context);
78972     ui.photoviewer = uiPhotoviewer(context);
78973     ui.shortcuts = uiShortcuts(context);
78974     ui.onResize = function(withPan) {
78975       var map2 = context.map();
78976       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
78977       utilGetDimensions(context.container().select(".sidebar"), true);
78978       if (withPan !== void 0) {
78979         map2.redrawEnable(false);
78980         map2.pan(withPan);
78981         map2.redrawEnable(true);
78982       }
78983       map2.dimensions(mapDimensions);
78984       ui.photoviewer.onMapResize();
78985       ui.checkOverflow(".top-toolbar");
78986       ui.checkOverflow(".map-footer-bar");
78987       var resizeWindowEvent = document.createEvent("Event");
78988       resizeWindowEvent.initEvent("resizeWindow", true, true);
78989       document.dispatchEvent(resizeWindowEvent);
78990     };
78991     ui.checkOverflow = function(selector, reset) {
78992       if (reset) {
78993         delete _needWidth[selector];
78994       }
78995       var selection2 = context.container().select(selector);
78996       if (selection2.empty()) return;
78997       var scrollWidth = selection2.property("scrollWidth");
78998       var clientWidth = selection2.property("clientWidth");
78999       var needed = _needWidth[selector] || scrollWidth;
79000       if (scrollWidth > clientWidth) {
79001         selection2.classed("narrow", true);
79002         if (!_needWidth[selector]) {
79003           _needWidth[selector] = scrollWidth;
79004         }
79005       } else if (scrollWidth >= needed) {
79006         selection2.classed("narrow", false);
79007       }
79008     };
79009     ui.togglePanes = function(showPane) {
79010       var hidePanes = context.container().selectAll(".map-pane.shown");
79011       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
79012       hidePanes.classed("shown", false).classed("hide", true);
79013       context.container().selectAll(".map-pane-control button").classed("active", false);
79014       if (showPane) {
79015         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
79016         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
79017         showPane.classed("shown", true).classed("hide", false);
79018         if (hidePanes.empty()) {
79019           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
79020         } else {
79021           showPane.style(side, "0px");
79022         }
79023       } else {
79024         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
79025           select_default2(this).classed("shown", false).classed("hide", true);
79026         });
79027       }
79028     };
79029     var _editMenu = uiEditMenu(context);
79030     ui.editMenu = function() {
79031       return _editMenu;
79032     };
79033     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
79034       ui.closeEditMenu();
79035       if (!operations && context.mode().operations) operations = context.mode().operations();
79036       if (!operations || !operations.length) return;
79037       if (!context.map().editableDataEnabled()) return;
79038       var surfaceNode = context.surface().node();
79039       if (surfaceNode.focus) {
79040         surfaceNode.focus();
79041       }
79042       operations.forEach(function(operation2) {
79043         if (operation2.point) operation2.point(anchorPoint);
79044       });
79045       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
79046       overMap.call(_editMenu);
79047     };
79048     ui.closeEditMenu = function() {
79049       if (overMap !== void 0) {
79050         overMap.select(".edit-menu").remove();
79051       }
79052     };
79053     var _saveLoading = select_default2(null);
79054     context.uploader().on("saveStarted.ui", function() {
79055       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
79056       context.container().call(_saveLoading);
79057     }).on("saveEnded.ui", function() {
79058       _saveLoading.close();
79059       _saveLoading = select_default2(null);
79060     });
79061     k.use({
79062       mangle: false,
79063       headerIds: false
79064     });
79065     return ui;
79066   }
79067   var init_init2 = __esm({
79068     "modules/ui/init.js"() {
79069       "use strict";
79070       init_marked_esm();
79071       init_src5();
79072       init_preferences();
79073       init_localizer();
79074       init_presets();
79075       init_behavior();
79076       init_browse();
79077       init_svg();
79078       init_detect();
79079       init_dimensions();
79080       init_account();
79081       init_attribution();
79082       init_contributors();
79083       init_edit_menu();
79084       init_feature_info();
79085       init_flash();
79086       init_full_screen();
79087       init_geolocate2();
79088       init_info();
79089       init_intro2();
79090       init_issues_info();
79091       init_loading();
79092       init_map_in_map();
79093       init_notice();
79094       init_photoviewer();
79095       init_restore();
79096       init_scale2();
79097       init_shortcuts();
79098       init_sidebar();
79099       init_source_switch();
79100       init_spinner();
79101       init_splash();
79102       init_status();
79103       init_tooltip();
79104       init_top_toolbar();
79105       init_version();
79106       init_zoom3();
79107       init_zoom_to_selection();
79108       init_cmd();
79109       init_background3();
79110       init_help();
79111       init_issues();
79112       init_map_data();
79113       init_preferences2();
79114     }
79115   });
79116
79117   // modules/ui/commit_warnings.js
79118   var commit_warnings_exports = {};
79119   __export(commit_warnings_exports, {
79120     uiCommitWarnings: () => uiCommitWarnings
79121   });
79122   function uiCommitWarnings(context) {
79123     function commitWarnings(selection2) {
79124       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
79125       for (var severity in issuesBySeverity) {
79126         var issues = issuesBySeverity[severity];
79127         if (severity !== "error") {
79128           issues = issues.filter(function(issue) {
79129             return issue.type !== "help_request";
79130           });
79131         }
79132         var section = severity + "-section";
79133         var issueItem = severity + "-item";
79134         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
79135         container.exit().remove();
79136         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
79137         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
79138         containerEnter.append("ul").attr("class", "changeset-list");
79139         container = containerEnter.merge(container);
79140         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
79141           return d2.key;
79142         });
79143         items.exit().remove();
79144         var itemsEnter = items.enter().append("li").attr("class", issueItem);
79145         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
79146           if (d2.entityIds) {
79147             context.surface().selectAll(
79148               utilEntityOrMemberSelector(
79149                 d2.entityIds,
79150                 context.graph()
79151               )
79152             ).classed("hover", true);
79153           }
79154         }).on("mouseout", function() {
79155           context.surface().selectAll(".hover").classed("hover", false);
79156         }).on("click", function(d3_event, d2) {
79157           context.validator().focusIssue(d2);
79158         });
79159         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
79160         buttons.append("strong").attr("class", "issue-message");
79161         buttons.filter(function(d2) {
79162           return d2.tooltip;
79163         }).call(
79164           uiTooltip().title(function(d2) {
79165             return d2.tooltip;
79166           }).placement("top")
79167         );
79168         items = itemsEnter.merge(items);
79169         items.selectAll(".issue-message").text("").each(function(d2) {
79170           return d2.message(context)(select_default2(this));
79171         });
79172       }
79173     }
79174     return commitWarnings;
79175   }
79176   var init_commit_warnings = __esm({
79177     "modules/ui/commit_warnings.js"() {
79178       "use strict";
79179       init_src5();
79180       init_localizer();
79181       init_icon();
79182       init_tooltip();
79183       init_util();
79184     }
79185   });
79186
79187   // modules/ui/lasso.js
79188   var lasso_exports = {};
79189   __export(lasso_exports, {
79190     uiLasso: () => uiLasso
79191   });
79192   function uiLasso(context) {
79193     var group, polygon2;
79194     lasso.coordinates = [];
79195     function lasso(selection2) {
79196       context.container().classed("lasso", true);
79197       group = selection2.append("g").attr("class", "lasso hide");
79198       polygon2 = group.append("path").attr("class", "lasso-path");
79199       group.call(uiToggle(true));
79200     }
79201     function draw() {
79202       if (polygon2) {
79203         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
79204           return "M" + d2.join(" L") + " Z";
79205         });
79206       }
79207     }
79208     lasso.extent = function() {
79209       return lasso.coordinates.reduce(function(extent, point) {
79210         return extent.extend(geoExtent(point));
79211       }, geoExtent());
79212     };
79213     lasso.p = function(_3) {
79214       if (!arguments.length) return lasso;
79215       lasso.coordinates.push(_3);
79216       draw();
79217       return lasso;
79218     };
79219     lasso.close = function() {
79220       if (group) {
79221         group.call(uiToggle(false, function() {
79222           select_default2(this).remove();
79223         }));
79224       }
79225       context.container().classed("lasso", false);
79226     };
79227     return lasso;
79228   }
79229   var init_lasso = __esm({
79230     "modules/ui/lasso.js"() {
79231       "use strict";
79232       init_src5();
79233       init_geo2();
79234       init_toggle();
79235     }
79236   });
79237
79238   // node_modules/osm-community-index/lib/simplify.js
79239   function simplify2(str) {
79240     if (typeof str !== "string") return "";
79241     return import_diacritics2.default.remove(
79242       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()
79243     );
79244   }
79245   var import_diacritics2;
79246   var init_simplify2 = __esm({
79247     "node_modules/osm-community-index/lib/simplify.js"() {
79248       import_diacritics2 = __toESM(require_diacritics(), 1);
79249     }
79250   });
79251
79252   // node_modules/osm-community-index/lib/resolve_strings.js
79253   function resolveStrings(item, defaults, localizerFn) {
79254     let itemStrings = Object.assign({}, item.strings);
79255     let defaultStrings = Object.assign({}, defaults[item.type]);
79256     const anyToken = new RegExp(/(\{\w+\})/, "gi");
79257     if (localizerFn) {
79258       if (itemStrings.community) {
79259         const communityID = simplify2(itemStrings.community);
79260         itemStrings.community = localizerFn(`_communities.${communityID}`);
79261       }
79262       ["name", "description", "extendedDescription"].forEach((prop) => {
79263         if (defaultStrings[prop]) defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
79264         if (itemStrings[prop]) itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
79265       });
79266     }
79267     let replacements = {
79268       account: item.account,
79269       community: itemStrings.community,
79270       signupUrl: itemStrings.signupUrl,
79271       url: itemStrings.url
79272     };
79273     if (!replacements.signupUrl) {
79274       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
79275     }
79276     if (!replacements.url) {
79277       replacements.url = resolve(itemStrings.url || defaultStrings.url);
79278     }
79279     let resolved = {
79280       name: resolve(itemStrings.name || defaultStrings.name),
79281       url: resolve(itemStrings.url || defaultStrings.url),
79282       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
79283       description: resolve(itemStrings.description || defaultStrings.description),
79284       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
79285     };
79286     resolved.nameHTML = linkify(resolved.url, resolved.name);
79287     resolved.urlHTML = linkify(resolved.url);
79288     resolved.signupUrlHTML = linkify(resolved.signupUrl);
79289     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
79290     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
79291     return resolved;
79292     function resolve(s2, addLinks) {
79293       if (!s2) return void 0;
79294       let result = s2;
79295       for (let key in replacements) {
79296         const token = `{${key}}`;
79297         const regex = new RegExp(token, "g");
79298         if (regex.test(result)) {
79299           let replacement = replacements[key];
79300           if (!replacement) {
79301             throw new Error(`Cannot resolve token: ${token}`);
79302           } else {
79303             if (addLinks && (key === "signupUrl" || key === "url")) {
79304               replacement = linkify(replacement);
79305             }
79306             result = result.replace(regex, replacement);
79307           }
79308         }
79309       }
79310       const leftovers = result.match(anyToken);
79311       if (leftovers) {
79312         throw new Error(`Cannot resolve tokens: ${leftovers}`);
79313       }
79314       if (addLinks && item.type === "reddit") {
79315         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
79316       }
79317       return result;
79318     }
79319     function linkify(url, text) {
79320       if (!url) return void 0;
79321       text = text || url;
79322       return `<a target="_blank" href="${url}">${text}</a>`;
79323     }
79324   }
79325   var init_resolve_strings = __esm({
79326     "node_modules/osm-community-index/lib/resolve_strings.js"() {
79327       init_simplify2();
79328     }
79329   });
79330
79331   // node_modules/osm-community-index/index.mjs
79332   var init_osm_community_index = __esm({
79333     "node_modules/osm-community-index/index.mjs"() {
79334       init_resolve_strings();
79335       init_simplify2();
79336     }
79337   });
79338
79339   // modules/ui/success.js
79340   var success_exports = {};
79341   __export(success_exports, {
79342     uiSuccess: () => uiSuccess
79343   });
79344   function uiSuccess(context) {
79345     const MAXEVENTS = 2;
79346     const dispatch14 = dispatch_default("cancel");
79347     let _changeset2;
79348     let _location;
79349     ensureOSMCommunityIndex();
79350     function ensureOSMCommunityIndex() {
79351       const data = _mainFileFetcher;
79352       return Promise.all([
79353         data.get("oci_features"),
79354         data.get("oci_resources"),
79355         data.get("oci_defaults")
79356       ]).then((vals) => {
79357         if (_oci) return _oci;
79358         if (vals[0] && Array.isArray(vals[0].features)) {
79359           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
79360         }
79361         let ociResources = Object.values(vals[1].resources);
79362         if (ociResources.length) {
79363           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
79364             _oci = {
79365               resources: ociResources,
79366               defaults: vals[2].defaults
79367             };
79368             return _oci;
79369           });
79370         } else {
79371           _oci = {
79372             resources: [],
79373             // no resources?
79374             defaults: vals[2].defaults
79375           };
79376           return _oci;
79377         }
79378       });
79379     }
79380     function parseEventDate(when) {
79381       if (!when) return;
79382       let raw = when.trim();
79383       if (!raw) return;
79384       if (!/Z$/.test(raw)) {
79385         raw += "Z";
79386       }
79387       const parsed = new Date(raw);
79388       return new Date(parsed.toUTCString().slice(0, 25));
79389     }
79390     function success(selection2) {
79391       let header = selection2.append("div").attr("class", "header fillL");
79392       header.append("h2").call(_t.append("success.just_edited"));
79393       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
79394       let body = selection2.append("div").attr("class", "body save-success fillL");
79395       let summary = body.append("div").attr("class", "save-summary");
79396       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
79397       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"));
79398       let osm = context.connection();
79399       if (!osm) return;
79400       let changesetURL = osm.changesetURL(_changeset2.id);
79401       let table = summary.append("table").attr("class", "summary-table");
79402       let row = table.append("tr").attr("class", "summary-row");
79403       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");
79404       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
79405       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
79406       summaryDetail.append("div").html(_t.html("success.changeset_id", {
79407         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
79408       }));
79409       if (showDonationMessage !== false) {
79410         const donationUrl = "https://supporting.openstreetmap.org/";
79411         let supporting = body.append("div").attr("class", "save-supporting");
79412         supporting.append("h3").call(_t.append("success.supporting.title"));
79413         supporting.append("p").call(_t.append("success.supporting.details"));
79414         table = supporting.append("table").attr("class", "supporting-table");
79415         row = table.append("tr").attr("class", "supporting-row");
79416         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");
79417         let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
79418         supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
79419         supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
79420       }
79421       ensureOSMCommunityIndex().then((oci) => {
79422         const loc = context.map().center();
79423         const validHere = _sharedLocationManager.locationSetsAt(loc);
79424         let communities = [];
79425         oci.resources.forEach((resource) => {
79426           let area = validHere[resource.locationSetID];
79427           if (!area) return;
79428           const localizer = (stringID) => _t.html(`community.${stringID}`);
79429           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
79430           communities.push({
79431             area,
79432             order: resource.order || 0,
79433             resource
79434           });
79435         });
79436         communities.sort((a4, b3) => a4.area - b3.area || b3.order - a4.order);
79437         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
79438       });
79439     }
79440     function showCommunityLinks(selection2, resources) {
79441       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
79442       communityLinks.append("h3").call(_t.append("success.like_osm"));
79443       let table = communityLinks.append("table").attr("class", "community-table");
79444       let row = table.selectAll(".community-row").data(resources);
79445       let rowEnter = row.enter().append("tr").attr("class", "community-row");
79446       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}`);
79447       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
79448       communityDetail.each(showCommunityDetails);
79449       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"));
79450     }
79451     function showCommunityDetails(d2) {
79452       let selection2 = select_default2(this);
79453       let communityID = d2.id;
79454       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
79455       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
79456       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
79457         selection2.append("div").call(
79458           uiDisclosure(context, `community-more-${d2.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
79459         );
79460       }
79461       let nextEvents = (d2.events || []).map((event) => {
79462         event.date = parseEventDate(event.when);
79463         return event;
79464       }).filter((event) => {
79465         const t2 = event.date.getTime();
79466         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
79467         return !isNaN(t2) && t2 >= now3;
79468       }).sort((a4, b3) => {
79469         return a4.date < b3.date ? -1 : a4.date > b3.date ? 1 : 0;
79470       }).slice(0, MAXEVENTS);
79471       if (nextEvents.length) {
79472         selection2.append("div").call(
79473           uiDisclosure(context, `community-events-${d2.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
79474         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
79475       }
79476       function showMore(selection3) {
79477         let more = selection3.selectAll(".community-more").data([0]);
79478         let moreEnter = more.enter().append("div").attr("class", "community-more");
79479         if (d2.resolved.extendedDescriptionHTML) {
79480           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
79481         }
79482         if (d2.languageCodes && d2.languageCodes.length) {
79483           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
79484           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
79485         }
79486       }
79487       function showNextEvents(selection3) {
79488         let events = selection3.append("div").attr("class", "community-events");
79489         let item = events.selectAll(".community-event").data(nextEvents);
79490         let itemEnter = item.enter().append("div").attr("class", "community-event");
79491         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
79492           let name = d4.name;
79493           if (d4.i18n && d4.id) {
79494             name = _t(`community.${communityID}.events.${d4.id}.name`, { default: name });
79495           }
79496           return name;
79497         });
79498         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
79499           let options = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
79500           if (d4.date.getHours() || d4.date.getMinutes()) {
79501             options.hour = "numeric";
79502             options.minute = "numeric";
79503           }
79504           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options);
79505         });
79506         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
79507           let where = d4.where;
79508           if (d4.i18n && d4.id) {
79509             where = _t(`community.${communityID}.events.${d4.id}.where`, { default: where });
79510           }
79511           return where;
79512         });
79513         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
79514           let description = d4.description;
79515           if (d4.i18n && d4.id) {
79516             description = _t(`community.${communityID}.events.${d4.id}.description`, { default: description });
79517           }
79518           return description;
79519         });
79520       }
79521     }
79522     success.changeset = function(val) {
79523       if (!arguments.length) return _changeset2;
79524       _changeset2 = val;
79525       return success;
79526     };
79527     success.location = function(val) {
79528       if (!arguments.length) return _location;
79529       _location = val;
79530       return success;
79531     };
79532     return utilRebind(success, dispatch14, "on");
79533   }
79534   var _oci;
79535   var init_success = __esm({
79536     "modules/ui/success.js"() {
79537       "use strict";
79538       init_src4();
79539       init_src5();
79540       init_osm_community_index();
79541       init_id();
79542       init_file_fetcher();
79543       init_LocationManager();
79544       init_localizer();
79545       init_icon();
79546       init_disclosure();
79547       init_rebind();
79548       _oci = null;
79549     }
79550   });
79551
79552   // modules/ui/index.js
79553   var ui_exports = {};
79554   __export(ui_exports, {
79555     uiAccount: () => uiAccount,
79556     uiAttribution: () => uiAttribution,
79557     uiChangesetEditor: () => uiChangesetEditor,
79558     uiCmd: () => uiCmd,
79559     uiCombobox: () => uiCombobox,
79560     uiCommit: () => uiCommit,
79561     uiCommitWarnings: () => uiCommitWarnings,
79562     uiConfirm: () => uiConfirm,
79563     uiConflicts: () => uiConflicts,
79564     uiContributors: () => uiContributors,
79565     uiCurtain: () => uiCurtain,
79566     uiDataEditor: () => uiDataEditor,
79567     uiDataHeader: () => uiDataHeader,
79568     uiDisclosure: () => uiDisclosure,
79569     uiEditMenu: () => uiEditMenu,
79570     uiEntityEditor: () => uiEntityEditor,
79571     uiFeatureInfo: () => uiFeatureInfo,
79572     uiFeatureList: () => uiFeatureList,
79573     uiField: () => uiField,
79574     uiFieldHelp: () => uiFieldHelp,
79575     uiFlash: () => uiFlash,
79576     uiFormFields: () => uiFormFields,
79577     uiFullScreen: () => uiFullScreen,
79578     uiGeolocate: () => uiGeolocate,
79579     uiInfo: () => uiInfo,
79580     uiInit: () => uiInit,
79581     uiInspector: () => uiInspector,
79582     uiIssuesInfo: () => uiIssuesInfo,
79583     uiKeepRightDetails: () => uiKeepRightDetails,
79584     uiKeepRightEditor: () => uiKeepRightEditor,
79585     uiKeepRightHeader: () => uiKeepRightHeader,
79586     uiLasso: () => uiLasso,
79587     uiLengthIndicator: () => uiLengthIndicator,
79588     uiLoading: () => uiLoading,
79589     uiMapInMap: () => uiMapInMap,
79590     uiModal: () => uiModal,
79591     uiNoteComments: () => uiNoteComments,
79592     uiNoteEditor: () => uiNoteEditor,
79593     uiNoteHeader: () => uiNoteHeader,
79594     uiNoteReport: () => uiNoteReport,
79595     uiNotice: () => uiNotice,
79596     uiPopover: () => uiPopover,
79597     uiPresetIcon: () => uiPresetIcon,
79598     uiPresetList: () => uiPresetList,
79599     uiRestore: () => uiRestore,
79600     uiScale: () => uiScale,
79601     uiSidebar: () => uiSidebar,
79602     uiSourceSwitch: () => uiSourceSwitch,
79603     uiSpinner: () => uiSpinner,
79604     uiSplash: () => uiSplash,
79605     uiStatus: () => uiStatus,
79606     uiSuccess: () => uiSuccess,
79607     uiTagReference: () => uiTagReference,
79608     uiToggle: () => uiToggle,
79609     uiTooltip: () => uiTooltip,
79610     uiVersion: () => uiVersion,
79611     uiViewOnKeepRight: () => uiViewOnKeepRight,
79612     uiViewOnOSM: () => uiViewOnOSM,
79613     uiZoom: () => uiZoom
79614   });
79615   var init_ui = __esm({
79616     "modules/ui/index.js"() {
79617       "use strict";
79618       init_init2();
79619       init_account();
79620       init_attribution();
79621       init_changeset_editor();
79622       init_cmd();
79623       init_combobox();
79624       init_commit();
79625       init_commit_warnings();
79626       init_confirm();
79627       init_conflicts();
79628       init_contributors();
79629       init_curtain();
79630       init_data_editor();
79631       init_data_header();
79632       init_disclosure();
79633       init_edit_menu();
79634       init_entity_editor();
79635       init_feature_info();
79636       init_feature_list();
79637       init_field2();
79638       init_field_help();
79639       init_flash();
79640       init_form_fields();
79641       init_full_screen();
79642       init_geolocate2();
79643       init_info();
79644       init_inspector();
79645       init_issues_info();
79646       init_keepRight_details();
79647       init_keepRight_editor();
79648       init_keepRight_header();
79649       init_length_indicator();
79650       init_lasso();
79651       init_loading();
79652       init_map_in_map();
79653       init_modal();
79654       init_notice();
79655       init_note_comments();
79656       init_note_editor();
79657       init_note_header();
79658       init_note_report();
79659       init_popover();
79660       init_preset_icon();
79661       init_preset_list();
79662       init_restore();
79663       init_scale2();
79664       init_sidebar();
79665       init_source_switch();
79666       init_spinner();
79667       init_splash();
79668       init_status();
79669       init_success();
79670       init_tag_reference();
79671       init_toggle();
79672       init_tooltip();
79673       init_version();
79674       init_view_on_osm();
79675       init_view_on_keepRight();
79676       init_zoom3();
79677     }
79678   });
79679
79680   // modules/ui/fields/input.js
79681   var input_exports = {};
79682   __export(input_exports, {
79683     likelyRawNumberFormat: () => likelyRawNumberFormat,
79684     uiFieldColour: () => uiFieldText,
79685     uiFieldEmail: () => uiFieldText,
79686     uiFieldIdentifier: () => uiFieldText,
79687     uiFieldNumber: () => uiFieldText,
79688     uiFieldTel: () => uiFieldText,
79689     uiFieldText: () => uiFieldText,
79690     uiFieldUrl: () => uiFieldText
79691   });
79692   function uiFieldText(field, context) {
79693     var dispatch14 = dispatch_default("change");
79694     var input = select_default2(null);
79695     var outlinkButton = select_default2(null);
79696     var wrap2 = select_default2(null);
79697     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
79698     var _entityIDs = [];
79699     var _tags;
79700     var _phoneFormats = {};
79701     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
79702     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
79703     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
79704     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
79705     if (field.type === "tel") {
79706       _mainFileFetcher.get("phone_formats").then(function(d2) {
79707         _phoneFormats = d2;
79708         updatePhonePlaceholder();
79709       }).catch(function() {
79710       });
79711     }
79712     function calcLocked() {
79713       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
79714         var entity = context.graph().hasEntity(entityID);
79715         if (!entity) return false;
79716         if (entity.tags.wikidata) return true;
79717         var preset = _mainPresetIndex.match(entity, context.graph());
79718         var isSuggestion = preset && preset.suggestion;
79719         var which = field.id;
79720         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
79721       });
79722       field.locked(isLocked);
79723     }
79724     function i3(selection2) {
79725       calcLocked();
79726       var isLocked = field.locked();
79727       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
79728       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
79729       input = wrap2.selectAll("input").data([0]);
79730       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);
79731       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
79732       wrap2.call(_lengthIndicator);
79733       if (field.type === "tel") {
79734         updatePhonePlaceholder();
79735       } else if (field.type === "number") {
79736         var rtl = _mainLocalizer.textDirection() === "rtl";
79737         input.attr("type", "text");
79738         var inc = field.increment;
79739         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
79740         buttons.enter().append("button").attr("class", function(d2) {
79741           var which = d2 > 0 ? "increment" : "decrement";
79742           return "form-field-button " + which;
79743         }).attr("title", function(d2) {
79744           var which = d2 > 0 ? "increment" : "decrement";
79745           return _t(`inspector.${which}`);
79746         }).merge(buttons).on("click", function(d3_event, d2) {
79747           d3_event.preventDefault();
79748           var isMixed = Array.isArray(_tags[field.key]);
79749           if (isMixed) return;
79750           var raw_vals = input.node().value || "0";
79751           var vals = raw_vals.split(";");
79752           vals = vals.map(function(v3) {
79753             v3 = v3.trim();
79754             const isRawNumber = likelyRawNumberFormat.test(v3);
79755             var num = isRawNumber ? parseFloat(v3) : parseLocaleFloat(v3);
79756             if (isDirectionField) {
79757               const compassDir = cardinal[v3.toLowerCase()];
79758               if (compassDir !== void 0) {
79759                 num = compassDir;
79760               }
79761             }
79762             if (!isFinite(num)) return v3;
79763             num = parseFloat(num);
79764             if (!isFinite(num)) return v3;
79765             num += d2;
79766             if (isDirectionField) {
79767               num = (num % 360 + 360) % 360;
79768             }
79769             return formatFloat(clamped(num), isRawNumber ? v3.includes(".") ? v3.split(".")[1].length : 0 : countDecimalPlaces(v3));
79770           });
79771           input.node().value = vals.join(";");
79772           change()();
79773         });
79774       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
79775         input.attr("type", "text");
79776         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
79777         outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
79778           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
79779           if (domainResults.length >= 2 && domainResults[1]) {
79780             var domain = domainResults[1];
79781             return _t("icons.view_on", { domain });
79782           }
79783           return "";
79784         }).merge(outlinkButton);
79785         outlinkButton.on("click", function(d3_event) {
79786           d3_event.preventDefault();
79787           var value = validIdentifierValueForLink();
79788           if (value) {
79789             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
79790             window.open(url, "_blank");
79791           }
79792         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
79793       } else if (field.type === "url") {
79794         input.attr("type", "text");
79795         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
79796         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) {
79797           d3_event.preventDefault();
79798           const value = validIdentifierValueForLink();
79799           if (value) window.open(value, "_blank");
79800         }).merge(outlinkButton);
79801       } else if (field.type === "colour") {
79802         input.attr("type", "text");
79803         updateColourPreview();
79804       } else if (field.type === "date") {
79805         input.attr("type", "text");
79806         updateDateField();
79807       }
79808     }
79809     function updateColourPreview() {
79810       wrap2.selectAll(".colour-preview").remove();
79811       const colour = utilGetSetValue(input);
79812       if (!isColourValid(colour) && colour !== "") {
79813         wrap2.selectAll("input.colour-selector").remove();
79814         wrap2.selectAll(".form-field-button").remove();
79815         return;
79816       }
79817       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
79818       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
79819         d3_event.preventDefault();
79820         var colour2 = this.value;
79821         if (!isColourValid(colour2)) return;
79822         utilGetSetValue(input, this.value);
79823         change()();
79824         updateColourPreview();
79825       }, 100));
79826       wrap2.selectAll("input.colour-selector").attr("value", colour);
79827       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
79828       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
79829       if (colour === "") {
79830         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
79831       }
79832       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
79833     }
79834     function updateDateField() {
79835       function isDateValid(date2) {
79836         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
79837       }
79838       const date = utilGetSetValue(input);
79839       const now3 = /* @__PURE__ */ new Date();
79840       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
79841       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
79842         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", () => {
79843           utilGetSetValue(input, today);
79844           change()();
79845           updateDateField();
79846         });
79847       } else {
79848         wrap2.selectAll(".date-set-today").remove();
79849       }
79850       if (!isDateValid(date) && date !== "") {
79851         wrap2.selectAll("input.date-selector").remove();
79852         wrap2.selectAll(".date-calendar").remove();
79853         return;
79854       }
79855       if (utilDetect().browser !== "Safari") {
79856         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
79857         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
79858           d3_event.preventDefault();
79859           var date2 = this.value;
79860           if (!isDateValid(date2)) return;
79861           utilGetSetValue(input, this.value);
79862           change()();
79863           updateDateField();
79864         }, 100));
79865         wrap2.selectAll("input.date-selector").attr("value", date);
79866         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
79867         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
79868         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
79869       }
79870     }
79871     function updatePhonePlaceholder() {
79872       if (input.empty() || !Object.keys(_phoneFormats).length) return;
79873       var extent = combinedEntityExtent();
79874       var countryCode = extent && iso1A2Code(extent.center());
79875       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
79876       if (format2) input.attr("placeholder", format2);
79877     }
79878     function validIdentifierValueForLink() {
79879       var _a4;
79880       const value = utilGetSetValue(input).trim();
79881       if (field.type === "url" && value) {
79882         try {
79883           return new URL(value).href;
79884         } catch {
79885           return null;
79886         }
79887       }
79888       if (field.type === "identifier" && field.pattern) {
79889         return value && ((_a4 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a4[0]);
79890       }
79891       return null;
79892     }
79893     function clamped(num) {
79894       if (field.minValue !== void 0) {
79895         num = Math.max(num, field.minValue);
79896       }
79897       if (field.maxValue !== void 0) {
79898         num = Math.min(num, field.maxValue);
79899       }
79900       return num;
79901     }
79902     function getVals(tags) {
79903       if (field.keys) {
79904         const multiSelection = context.selectedIDs();
79905         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
79906         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((a4, b3) => /* @__PURE__ */ new Set([...a4, ...b3]));
79907       } else {
79908         return new Set([].concat(tags[field.key]));
79909       }
79910     }
79911     function change(onInput) {
79912       return function() {
79913         var t2 = {};
79914         var val = utilGetSetValue(input);
79915         if (!onInput) val = context.cleanTagValue(val);
79916         if (!val && getVals(_tags).size > 1) return;
79917         let displayVal = val;
79918         if (field.type === "number" && val) {
79919           const numbers2 = val.split(";").map((v3) => {
79920             if (likelyRawNumberFormat.test(v3)) {
79921               return {
79922                 v: v3,
79923                 num: parseFloat(v3),
79924                 fractionDigits: v3.includes(".") ? v3.split(".")[1].length : 0
79925               };
79926             } else {
79927               return {
79928                 v: v3,
79929                 num: parseLocaleFloat(v3),
79930                 fractionDigits: countDecimalPlaces(v3)
79931               };
79932             }
79933           });
79934           val = numbers2.map(({ num, v: v3, fractionDigits }) => {
79935             if (!isFinite(num)) return v3;
79936             return clamped(num).toFixed(fractionDigits);
79937           }).join(";");
79938           displayVal = numbers2.map(({ num, v: v3, fractionDigits }) => {
79939             if (!isFinite(num)) return v3;
79940             return formatFloat(clamped(num), fractionDigits);
79941           }).join(";");
79942         }
79943         if (!onInput) utilGetSetValue(input, displayVal);
79944         t2[field.key] = val || void 0;
79945         if (field.keys) {
79946           dispatch14.call("change", this, (tags) => {
79947             if (field.keys.some((key) => tags[key])) {
79948               field.keys.filter((key) => tags[key]).forEach((key) => {
79949                 tags[key] = val || void 0;
79950               });
79951             } else {
79952               tags[field.key] = val || void 0;
79953             }
79954             return tags;
79955           }, onInput);
79956         } else {
79957           dispatch14.call("change", this, t2, onInput);
79958         }
79959       };
79960     }
79961     i3.entityIDs = function(val) {
79962       if (!arguments.length) return _entityIDs;
79963       _entityIDs = val;
79964       return i3;
79965     };
79966     i3.tags = function(tags) {
79967       var _a4;
79968       _tags = tags;
79969       const vals = getVals(tags);
79970       const isMixed = vals.size > 1;
79971       var val = vals.size === 1 ? (_a4 = [...vals][0]) != null ? _a4 : "" : "";
79972       var shouldUpdate;
79973       if (field.type === "number" && val) {
79974         var numbers2 = val.split(";");
79975         var oriNumbers = utilGetSetValue(input).split(";");
79976         if (numbers2.length !== oriNumbers.length) shouldUpdate = true;
79977         numbers2 = numbers2.map(function(v3) {
79978           v3 = v3.trim();
79979           var num = Number(v3);
79980           if (!isFinite(num) || v3 === "") return v3;
79981           const fractionDigits = v3.includes(".") ? v3.split(".")[1].length : 0;
79982           return formatFloat(num, fractionDigits);
79983         });
79984         val = numbers2.join(";");
79985         shouldUpdate = (inputValue, setValue) => {
79986           const inputNums = inputValue.split(";").map((val2) => {
79987             const parsedNum = likelyRawNumberFormat.test(val2) ? parseFloat(val2) : parseLocaleFloat(val2);
79988             if (!isFinite(parsedNum)) return val2;
79989             return parsedNum;
79990           });
79991           const setNums = setValue.split(";").map((val2) => {
79992             const parsedNum = parseLocaleFloat(val2);
79993             if (!isFinite(parsedNum)) return val2;
79994             return parsedNum;
79995           });
79996           return !isEqual_default(inputNums, setNums);
79997         };
79998       }
79999       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);
80000       if (field.type === "number") {
80001         const buttons = wrap2.selectAll(".increment, .decrement");
80002         if (isMixed) {
80003           buttons.attr("disabled", "disabled").classed("disabled", true);
80004         } else {
80005           var raw_vals = tags[field.key] || "0";
80006           const canIncDec = raw_vals.split(";").some(
80007             (val2) => isFinite(Number(val2)) || isDirectionField && val2.trim().toLowerCase() in cardinal
80008           );
80009           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
80010         }
80011       }
80012       if (field.type === "tel") updatePhonePlaceholder();
80013       if (field.type === "colour") updateColourPreview();
80014       if (field.type === "date") updateDateField();
80015       if (outlinkButton && !outlinkButton.empty()) {
80016         var disabled = !validIdentifierValueForLink();
80017         outlinkButton.classed("disabled", disabled);
80018       }
80019       if (!isMixed) {
80020         _lengthIndicator.update(tags[field.key]);
80021       }
80022     };
80023     i3.focus = function() {
80024       var node = input.node();
80025       if (node) node.focus();
80026     };
80027     function combinedEntityExtent() {
80028       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
80029     }
80030     return utilRebind(i3, dispatch14, "on");
80031   }
80032   var likelyRawNumberFormat;
80033   var init_input = __esm({
80034     "modules/ui/fields/input.js"() {
80035       "use strict";
80036       init_src4();
80037       init_src5();
80038       init_debounce();
80039       init_country_coder();
80040       init_presets();
80041       init_file_fetcher();
80042       init_localizer();
80043       init_util();
80044       init_icon();
80045       init_node2();
80046       init_tags();
80047       init_ui();
80048       init_tooltip();
80049       init_lodash();
80050       likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
80051     }
80052   });
80053
80054   // modules/ui/fields/access.js
80055   var access_exports = {};
80056   __export(access_exports, {
80057     uiFieldAccess: () => uiFieldAccess
80058   });
80059   function uiFieldAccess(field, context) {
80060     var dispatch14 = dispatch_default("change");
80061     var items = select_default2(null);
80062     var _tags;
80063     function access(selection2) {
80064       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80065       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80066       var list = wrap2.selectAll("ul").data([0]);
80067       list = list.enter().append("ul").attr("class", "rows").merge(list);
80068       items = list.selectAll("li").data(field.keys);
80069       var enter = items.enter().append("li").attr("class", function(d2) {
80070         return "labeled-input preset-access-" + d2;
80071       });
80072       enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
80073         return "preset-input-access-" + d2;
80074       }).html(function(d2) {
80075         return field.t.html("types." + d2);
80076       });
80077       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
80078         return "preset-input-access preset-input-access-" + d2;
80079       }).call(utilNoAuto).each(function(d2) {
80080         select_default2(this).call(
80081           uiCombobox(context, "access-" + d2).data(access.options(d2))
80082         );
80083       });
80084       items = items.merge(enter);
80085       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
80086     }
80087     function change(d3_event, d2) {
80088       var tag = {};
80089       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
80090       if (!value && typeof _tags[d2] !== "string") return;
80091       tag[d2] = value || void 0;
80092       dispatch14.call("change", this, tag);
80093     }
80094     access.options = function(type2) {
80095       var options = [
80096         "yes",
80097         "no",
80098         "designated",
80099         "permissive",
80100         "destination",
80101         "customers",
80102         "private",
80103         "permit",
80104         "unknown"
80105       ];
80106       if (type2 === "access") {
80107         options = options.filter((v3) => v3 !== "yes" && v3 !== "designated");
80108       }
80109       if (type2 === "bicycle") {
80110         options.splice(options.length - 4, 0, "dismount");
80111       }
80112       var stringsField = field.resolveReference("stringsCrossReference");
80113       return options.map(function(option) {
80114         return {
80115           title: stringsField.t("options." + option + ".description"),
80116           value: option
80117         };
80118       });
80119     };
80120     const placeholdersByTag = {
80121       highway: {
80122         footway: {
80123           foot: "designated",
80124           motor_vehicle: "no"
80125         },
80126         steps: {
80127           foot: "yes",
80128           motor_vehicle: "no",
80129           bicycle: "no",
80130           horse: "no"
80131         },
80132         ladder: {
80133           foot: "yes",
80134           motor_vehicle: "no",
80135           bicycle: "no",
80136           horse: "no"
80137         },
80138         pedestrian: {
80139           foot: "yes",
80140           motor_vehicle: "no"
80141         },
80142         cycleway: {
80143           motor_vehicle: "no",
80144           bicycle: "designated"
80145         },
80146         bridleway: {
80147           motor_vehicle: "no",
80148           horse: "designated"
80149         },
80150         path: {
80151           foot: "yes",
80152           motor_vehicle: "no",
80153           bicycle: "yes",
80154           horse: "yes"
80155         },
80156         motorway: {
80157           foot: "no",
80158           motor_vehicle: "yes",
80159           bicycle: "no",
80160           horse: "no"
80161         },
80162         trunk: {
80163           motor_vehicle: "yes"
80164         },
80165         primary: {
80166           foot: "yes",
80167           motor_vehicle: "yes",
80168           bicycle: "yes",
80169           horse: "yes"
80170         },
80171         secondary: {
80172           foot: "yes",
80173           motor_vehicle: "yes",
80174           bicycle: "yes",
80175           horse: "yes"
80176         },
80177         tertiary: {
80178           foot: "yes",
80179           motor_vehicle: "yes",
80180           bicycle: "yes",
80181           horse: "yes"
80182         },
80183         residential: {
80184           foot: "yes",
80185           motor_vehicle: "yes",
80186           bicycle: "yes",
80187           horse: "yes"
80188         },
80189         unclassified: {
80190           foot: "yes",
80191           motor_vehicle: "yes",
80192           bicycle: "yes",
80193           horse: "yes"
80194         },
80195         service: {
80196           foot: "yes",
80197           motor_vehicle: "yes",
80198           bicycle: "yes",
80199           horse: "yes"
80200         },
80201         motorway_link: {
80202           foot: "no",
80203           motor_vehicle: "yes",
80204           bicycle: "no",
80205           horse: "no"
80206         },
80207         trunk_link: {
80208           motor_vehicle: "yes"
80209         },
80210         primary_link: {
80211           foot: "yes",
80212           motor_vehicle: "yes",
80213           bicycle: "yes",
80214           horse: "yes"
80215         },
80216         secondary_link: {
80217           foot: "yes",
80218           motor_vehicle: "yes",
80219           bicycle: "yes",
80220           horse: "yes"
80221         },
80222         tertiary_link: {
80223           foot: "yes",
80224           motor_vehicle: "yes",
80225           bicycle: "yes",
80226           horse: "yes"
80227         },
80228         construction: {
80229           access: "no"
80230         },
80231         busway: {
80232           access: "no",
80233           bus: "designated",
80234           emergency: "yes"
80235         }
80236       },
80237       barrier: {
80238         bollard: {
80239           access: "no",
80240           bicycle: "yes",
80241           foot: "yes"
80242         },
80243         bus_trap: {
80244           motor_vehicle: "no",
80245           psv: "yes",
80246           foot: "yes",
80247           bicycle: "yes"
80248         },
80249         city_wall: {
80250           access: "no"
80251         },
80252         coupure: {
80253           access: "yes"
80254         },
80255         cycle_barrier: {
80256           motor_vehicle: "no"
80257         },
80258         ditch: {
80259           access: "no"
80260         },
80261         entrance: {
80262           access: "yes"
80263         },
80264         fence: {
80265           access: "no"
80266         },
80267         hedge: {
80268           access: "no"
80269         },
80270         jersey_barrier: {
80271           access: "no"
80272         },
80273         motorcycle_barrier: {
80274           motor_vehicle: "no"
80275         },
80276         rail_guard: {
80277           access: "no"
80278         }
80279       }
80280     };
80281     access.tags = function(tags) {
80282       _tags = tags;
80283       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
80284         return typeof tags[d2] === "string" ? tags[d2] : "";
80285       }).classed("mixed", function(accessField) {
80286         return tags[accessField] && Array.isArray(tags[accessField]) || new Set(getAllPlaceholders(tags, accessField)).size > 1;
80287       }).attr("title", function(accessField) {
80288         return tags[accessField] && Array.isArray(tags[accessField]) && tags[accessField].filter(Boolean).join("\n");
80289       }).attr("placeholder", function(accessField) {
80290         let placeholders = getAllPlaceholders(tags, accessField);
80291         if (new Set(placeholders).size === 1) {
80292           return placeholders[0];
80293         } else {
80294           return _t("inspector.multiple_values");
80295         }
80296       });
80297       function getAllPlaceholders(tags2, accessField) {
80298         let allTags = tags2[Symbol.for("allTags")];
80299         if (allTags && allTags.length > 1) {
80300           const placeholders = [];
80301           allTags.forEach((tags3) => {
80302             placeholders.push(getPlaceholder(tags3, accessField));
80303           });
80304           return placeholders;
80305         } else {
80306           return [getPlaceholder(tags2, accessField)];
80307         }
80308       }
80309       function getPlaceholder(tags2, accessField) {
80310         if (tags2[accessField]) {
80311           return tags2[accessField];
80312         }
80313         if (tags2.motorroad === "yes" && (accessField === "foot" || accessField === "bicycle" || accessField === "horse")) {
80314           return "no";
80315         }
80316         if (tags2.vehicle && (accessField === "bicycle" || accessField === "motor_vehicle")) {
80317           return tags2.vehicle;
80318         }
80319         if (tags2.access) {
80320           return tags2.access;
80321         }
80322         for (const key in placeholdersByTag) {
80323           if (tags2[key]) {
80324             if (placeholdersByTag[key][tags2[key]] && placeholdersByTag[key][tags2[key]][accessField]) {
80325               return placeholdersByTag[key][tags2[key]][accessField];
80326             }
80327           }
80328         }
80329         if (accessField === "access" && !tags2.barrier) {
80330           return "yes";
80331         }
80332         return field.placeholder();
80333       }
80334     };
80335     access.focus = function() {
80336       items.selectAll(".preset-input-access").node().focus();
80337     };
80338     return utilRebind(access, dispatch14, "on");
80339   }
80340   var init_access = __esm({
80341     "modules/ui/fields/access.js"() {
80342       "use strict";
80343       init_src4();
80344       init_src5();
80345       init_combobox();
80346       init_util();
80347       init_localizer();
80348     }
80349   });
80350
80351   // modules/ui/fields/address.js
80352   var address_exports = {};
80353   __export(address_exports, {
80354     uiFieldAddress: () => uiFieldAddress
80355   });
80356   function uiFieldAddress(field, context) {
80357     var dispatch14 = dispatch_default("change");
80358     var _selection = select_default2(null);
80359     var _wrap = select_default2(null);
80360     var addrField = _mainPresetIndex.field("address");
80361     var _entityIDs = [];
80362     var _tags;
80363     var _countryCode;
80364     var _addressFormats = [{
80365       format: [
80366         ["housenumber", "street"],
80367         ["city", "postcode"]
80368       ]
80369     }];
80370     _mainFileFetcher.get("address_formats").then(function(d2) {
80371       _addressFormats = d2;
80372       if (!_selection.empty()) {
80373         _selection.call(address);
80374       }
80375     }).catch(function() {
80376     });
80377     function getNear(isAddressable, type2, searchRadius, resultProp) {
80378       var extent = combinedEntityExtent();
80379       var l2 = extent.center();
80380       var box = extent.padByMeters(searchRadius);
80381       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
80382         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
80383         if (d2.geometry(context.graph()) === "line") {
80384           var loc = context.projection([
80385             (extent[0][0] + extent[1][0]) / 2,
80386             (extent[0][1] + extent[1][1]) / 2
80387           ]);
80388           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
80389           dist = geoSphericalDistance(choice.loc, l2);
80390         }
80391         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
80392         let title = value;
80393         if (type2 === "street") {
80394           title = `${addrField.t("placeholders.street")}: ${title}`;
80395         } else if (type2 === "place") {
80396           title = `${addrField.t("placeholders.place")}: ${title}`;
80397         }
80398         return {
80399           title,
80400           value,
80401           dist,
80402           type: type2,
80403           klass: `address-${type2}`
80404         };
80405       }).sort(function(a4, b3) {
80406         return a4.dist - b3.dist;
80407       });
80408       return utilArrayUniqBy(features, "value");
80409     }
80410     function getEnclosing(isAddressable, type2, resultProp) {
80411       var extent = combinedEntityExtent();
80412       var features = context.history().intersects(extent).filter(isAddressable).map((d2) => {
80413         if (d2.geometry(context.graph()) !== "area") {
80414           return false;
80415         }
80416         const geom = d2.asGeoJSON(context.graph()).coordinates[0];
80417         if (!geoPolygonContainsPolygon(geom, extent.polygon())) {
80418           return false;
80419         }
80420         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
80421         return {
80422           title: value,
80423           value,
80424           dist: 0,
80425           geom,
80426           type: type2,
80427           klass: `address-${type2}`
80428         };
80429       }).filter(Boolean);
80430       return utilArrayUniqBy(features, "value");
80431     }
80432     function getNearStreets() {
80433       function isAddressable(d2) {
80434         return d2.tags.highway && d2.tags.name && d2.type === "way";
80435       }
80436       return getNear(isAddressable, "street", 200);
80437     }
80438     function getNearPlaces() {
80439       function isAddressable(d2) {
80440         if (d2.tags.name) {
80441           if (d2.tags.place) return true;
80442           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8) return true;
80443         }
80444         return false;
80445       }
80446       return getNear(isAddressable, "place", 200);
80447     }
80448     function getNearCities() {
80449       function isAddressable(d2) {
80450         if (d2.tags.name) {
80451           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8") return true;
80452           if (d2.tags.border_type === "city") return true;
80453           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village") return true;
80454         }
80455         if (d2.tags[`${field.key}:city`]) return true;
80456         return false;
80457       }
80458       return getNear(isAddressable, "city", 200, `${field.key}:city`);
80459     }
80460     function getNearPostcodes() {
80461       const postcodes = [].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code"));
80462       return utilArrayUniqBy(postcodes, (item) => item.value);
80463     }
80464     function getNearValues(key) {
80465       const tagKey = `${field.key}:${key}`;
80466       function hasTag(d2) {
80467         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
80468       }
80469       return getNear(hasTag, key, 200, tagKey);
80470     }
80471     function getEnclosingValues(key) {
80472       const tagKey = `${field.key}:${key}`;
80473       function hasTag(d2) {
80474         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
80475       }
80476       const enclosingAddresses = getEnclosing(hasTag, key, tagKey);
80477       function isBuilding(d2) {
80478         return _entityIDs.indexOf(d2.id) === -1 && d2.tags.building && d2.tags.building !== "no";
80479       }
80480       const enclosingBuildings = getEnclosing(isBuilding, "building", "building").map((d2) => d2.geom);
80481       function isInNearbyBuilding(d2) {
80482         return hasTag(d2) && d2.type === "node" && enclosingBuildings.some(
80483           (geom) => geoPointInPolygon(d2.loc, geom) || geom.indexOf(d2.loc) !== -1
80484         );
80485       }
80486       const nearPointAddresses = getNear(isInNearbyBuilding, key, 100, tagKey);
80487       return utilArrayUniqBy([
80488         ...enclosingAddresses,
80489         ...nearPointAddresses
80490       ], "value").sort((a4, b3) => a4.value > b3.value ? 1 : -1);
80491     }
80492     function updateForCountryCode() {
80493       if (!_countryCode) return;
80494       var addressFormat;
80495       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
80496         var format2 = _addressFormats[i3];
80497         if (!format2.countryCodes) {
80498           addressFormat = format2;
80499         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
80500           addressFormat = format2;
80501           break;
80502         }
80503       }
80504       const maybeDropdowns = /* @__PURE__ */ new Set([
80505         "housenumber",
80506         "housename"
80507       ]);
80508       const dropdowns = /* @__PURE__ */ new Set([
80509         "block_number",
80510         "city",
80511         "country",
80512         "county",
80513         "district",
80514         "floor",
80515         "hamlet",
80516         "neighbourhood",
80517         "place",
80518         "postcode",
80519         "province",
80520         "quarter",
80521         "state",
80522         "street",
80523         "street+place",
80524         "subdistrict",
80525         "suburb",
80526         "town",
80527         ...maybeDropdowns
80528       ]);
80529       var widths = addressFormat.widths || {
80530         housenumber: 1 / 5,
80531         unit: 1 / 5,
80532         street: 1 / 2,
80533         place: 1 / 2,
80534         city: 2 / 3,
80535         state: 1 / 4,
80536         postcode: 1 / 3
80537       };
80538       function row(r2) {
80539         var total = r2.reduce(function(sum, key) {
80540           return sum + (widths[key] || 0.5);
80541         }, 0);
80542         return r2.map(function(key) {
80543           return {
80544             id: key,
80545             width: (widths[key] || 0.5) / total
80546           };
80547         });
80548       }
80549       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
80550         return d2.toString();
80551       });
80552       rows.exit().remove();
80553       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) {
80554         return "addr-" + d2.id;
80555       }).call(utilNoAuto).each(addDropdown).call(updatePlaceholder).style("width", function(d2) {
80556         return d2.width * 100 + "%";
80557       });
80558       function addDropdown(d2) {
80559         if (!dropdowns.has(d2.id)) {
80560           return false;
80561         }
80562         var nearValues;
80563         switch (d2.id) {
80564           case "street":
80565             nearValues = getNearStreets;
80566             break;
80567           case "place":
80568             nearValues = getNearPlaces;
80569             break;
80570           case "street+place":
80571             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
80572             d2.isAutoStreetPlace = true;
80573             d2.id = _tags[`${field.key}:place`] ? "place" : "street";
80574             break;
80575           case "city":
80576             nearValues = getNearCities;
80577             break;
80578           case "postcode":
80579             nearValues = getNearPostcodes;
80580             break;
80581           case "housenumber":
80582           case "housename":
80583             nearValues = getEnclosingValues;
80584             break;
80585           default:
80586             nearValues = getNearValues;
80587         }
80588         if (maybeDropdowns.has(d2.id)) {
80589           const candidates = nearValues(d2.id);
80590           if (candidates.length === 0) return false;
80591         }
80592         select_default2(this).call(
80593           uiCombobox(context, `address-${d2.isAutoStreetPlace ? "street-place" : d2.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
80594             typedValue = typedValue.toLowerCase();
80595             callback(nearValues(d2.id).filter((v3) => v3.value.toLowerCase().indexOf(typedValue) !== -1));
80596           }).on("accept", function(selected) {
80597             if (d2.isAutoStreetPlace) {
80598               d2.id = selected ? selected.type : "street";
80599               utilTriggerEvent(select_default2(this), "change");
80600             }
80601           })
80602         );
80603       }
80604       _wrap.selectAll("input").on("input", change(true)).on("blur", change()).on("change", change());
80605       if (_tags) updateTags(_tags);
80606     }
80607     function address(selection2) {
80608       _selection = selection2;
80609       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
80610       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
80611       var extent = combinedEntityExtent();
80612       if (extent) {
80613         var countryCode;
80614         if (context.inIntro()) {
80615           countryCode = _t("intro.graph.countrycode");
80616         } else {
80617           var center = extent.center();
80618           countryCode = iso1A2Code(center);
80619         }
80620         if (countryCode) {
80621           _countryCode = countryCode.toLowerCase();
80622           updateForCountryCode();
80623         }
80624       }
80625     }
80626     function change(onInput) {
80627       return function() {
80628         var tags = {};
80629         _wrap.selectAll("input").each(function(subfield) {
80630           var key = field.key + ":" + subfield.id;
80631           var value = this.value;
80632           if (!onInput) value = context.cleanTagValue(value);
80633           if (Array.isArray(_tags[key]) && !value) return;
80634           if (subfield.isAutoStreetPlace) {
80635             if (subfield.id === "street") {
80636               tags[`${field.key}:place`] = void 0;
80637             } else if (subfield.id === "place") {
80638               tags[`${field.key}:street`] = void 0;
80639             }
80640           }
80641           tags[key] = value || void 0;
80642         });
80643         Object.keys(tags).filter((k3) => tags[k3]).forEach((k3) => _tags[k3] = tags[k3]);
80644         dispatch14.call("change", this, tags, onInput);
80645       };
80646     }
80647     function updatePlaceholder(inputSelection) {
80648       return inputSelection.attr("placeholder", function(subfield) {
80649         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
80650           return _t("inspector.multiple_values");
80651         }
80652         if (subfield.isAutoStreetPlace) {
80653           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
80654         }
80655         return getLocalPlaceholder(subfield.id);
80656       });
80657     }
80658     function getLocalPlaceholder(key) {
80659       if (_countryCode) {
80660         var localkey = key + "!" + _countryCode;
80661         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
80662         return addrField.t("placeholders." + tkey);
80663       }
80664     }
80665     function updateTags(tags) {
80666       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
80667         var val;
80668         if (subfield.isAutoStreetPlace) {
80669           const streetKey = `${field.key}:street`;
80670           const placeKey = `${field.key}:place`;
80671           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
80672             val = tags[streetKey];
80673             subfield.id = "street";
80674           } else {
80675             val = tags[placeKey];
80676             subfield.id = "place";
80677           }
80678         } else {
80679           val = tags[`${field.key}:${subfield.id}`];
80680         }
80681         return typeof val === "string" ? val : "";
80682       }).attr("title", function(subfield) {
80683         var val = tags[field.key + ":" + subfield.id];
80684         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
80685       }).classed("mixed", function(subfield) {
80686         return Array.isArray(tags[field.key + ":" + subfield.id]);
80687       }).call(updatePlaceholder);
80688     }
80689     function combinedEntityExtent() {
80690       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
80691     }
80692     address.entityIDs = function(val) {
80693       if (!arguments.length) return _entityIDs;
80694       _entityIDs = val;
80695       return address;
80696     };
80697     address.tags = function(tags) {
80698       _tags = tags;
80699       updateTags(tags);
80700     };
80701     address.focus = function() {
80702       var node = _wrap.selectAll("input").node();
80703       if (node) node.focus();
80704     };
80705     return utilRebind(address, dispatch14, "on");
80706   }
80707   var init_address = __esm({
80708     "modules/ui/fields/address.js"() {
80709       "use strict";
80710       init_src4();
80711       init_src5();
80712       init_country_coder();
80713       init_presets();
80714       init_file_fetcher();
80715       init_geo2();
80716       init_combobox();
80717       init_util();
80718       init_localizer();
80719     }
80720   });
80721
80722   // modules/ui/fields/directional_combo.js
80723   var directional_combo_exports = {};
80724   __export(directional_combo_exports, {
80725     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo
80726   });
80727   function uiFieldDirectionalCombo(field, context) {
80728     var dispatch14 = dispatch_default("change");
80729     var items = select_default2(null);
80730     var wrap2 = select_default2(null);
80731     var _tags;
80732     var _combos = {};
80733     if (field.type === "cycleway") {
80734       field = {
80735         ...field,
80736         key: field.keys[0],
80737         keys: field.keys.slice(1)
80738       };
80739     }
80740     function directionalCombo(selection2) {
80741       function stripcolon(s2) {
80742         return s2.replace(":", "");
80743       }
80744       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80745       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80746       var div = wrap2.selectAll("ul").data([0]);
80747       div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
80748       items = div.selectAll("li").data(field.keys);
80749       var enter = items.enter().append("li").attr("class", function(d2) {
80750         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
80751       });
80752       enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
80753         return "preset-input-directionalcombo-" + stripcolon(d2);
80754       }).html(function(d2) {
80755         return field.t.html("types." + d2);
80756       });
80757       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
80758         const subField = {
80759           ...field,
80760           type: "combo",
80761           key
80762         };
80763         const combo = uiFieldCombo(subField, context);
80764         combo.on("change", (t2) => change(key, t2[key]));
80765         _combos[key] = combo;
80766         select_default2(this).call(combo);
80767       });
80768       items = items.merge(enter);
80769       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
80770     }
80771     function change(key, newValue) {
80772       const commonKey = field.key;
80773       const otherCommonKey = field.key.endsWith(":both") ? field.key.replace(/:both$/, "") : `${field.key}:both`;
80774       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
80775       dispatch14.call("change", this, (tags) => {
80776         const otherValue = tags[otherKey] || tags[commonKey] || tags[otherCommonKey];
80777         if (newValue === otherValue) {
80778           tags[commonKey] = newValue;
80779           delete tags[key];
80780           delete tags[otherKey];
80781           delete tags[otherCommonKey];
80782         } else {
80783           tags[key] = newValue;
80784           delete tags[commonKey];
80785           delete tags[otherCommonKey];
80786           tags[otherKey] = otherValue;
80787         }
80788         return tags;
80789       });
80790     }
80791     directionalCombo.tags = function(tags) {
80792       _tags = tags;
80793       const commonKey = field.key.replace(/:both$/, "");
80794       for (let key in _combos) {
80795         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[`${commonKey}:both`]).concat(_tags[key]).filter(Boolean))];
80796         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
80797       }
80798     };
80799     directionalCombo.focus = function() {
80800       var node = wrap2.selectAll("input").node();
80801       if (node) node.focus();
80802     };
80803     return utilRebind(directionalCombo, dispatch14, "on");
80804   }
80805   var init_directional_combo = __esm({
80806     "modules/ui/fields/directional_combo.js"() {
80807       "use strict";
80808       init_src4();
80809       init_src5();
80810       init_util();
80811       init_combo();
80812     }
80813   });
80814
80815   // modules/ui/fields/lanes.js
80816   var lanes_exports2 = {};
80817   __export(lanes_exports2, {
80818     uiFieldLanes: () => uiFieldLanes
80819   });
80820   function uiFieldLanes(field, context) {
80821     var dispatch14 = dispatch_default("change");
80822     var LANE_WIDTH = 40;
80823     var LANE_HEIGHT = 200;
80824     var _entityIDs = [];
80825     function lanes(selection2) {
80826       var lanesData = context.entity(_entityIDs[0]).lanes();
80827       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
80828         selection2.call(lanes.off);
80829         return;
80830       }
80831       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80832       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80833       var surface = wrap2.selectAll(".surface").data([0]);
80834       var d2 = utilGetDimensions(wrap2);
80835       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
80836       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
80837       var lanesSelection = surface.selectAll(".lanes").data([0]);
80838       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
80839       lanesSelection.attr("transform", function() {
80840         return "translate(" + freeSpace / 2 + ", 0)";
80841       });
80842       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
80843       lane.exit().remove();
80844       var enter = lane.enter().append("g").attr("class", "lane");
80845       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
80846       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
80847       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
80848       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
80849       lane = lane.merge(enter);
80850       lane.attr("transform", function(d4) {
80851         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
80852       });
80853       lane.select(".forward").style("visibility", function(d4) {
80854         return d4.direction === "forward" ? "visible" : "hidden";
80855       });
80856       lane.select(".bothways").style("visibility", function(d4) {
80857         return d4.direction === "bothways" ? "visible" : "hidden";
80858       });
80859       lane.select(".backward").style("visibility", function(d4) {
80860         return d4.direction === "backward" ? "visible" : "hidden";
80861       });
80862     }
80863     lanes.entityIDs = function(val) {
80864       _entityIDs = val;
80865     };
80866     lanes.tags = function() {
80867     };
80868     lanes.focus = function() {
80869     };
80870     lanes.off = function() {
80871     };
80872     return utilRebind(lanes, dispatch14, "on");
80873   }
80874   var init_lanes2 = __esm({
80875     "modules/ui/fields/lanes.js"() {
80876       "use strict";
80877       init_src4();
80878       init_rebind();
80879       init_dimensions();
80880       uiFieldLanes.supportsMultiselection = false;
80881     }
80882   });
80883
80884   // modules/ui/fields/localized.js
80885   var localized_exports = {};
80886   __export(localized_exports, {
80887     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
80888     uiFieldLocalized: () => uiFieldLocalized
80889   });
80890   function uiFieldLocalized(field, context) {
80891     var dispatch14 = dispatch_default("change", "input");
80892     var wikipedia = services.wikipedia;
80893     var input = select_default2(null);
80894     var localizedInputs = select_default2(null);
80895     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
80896     var _countryCode;
80897     var _tags;
80898     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
80899     });
80900     var _territoryLanguages = {};
80901     _mainFileFetcher.get("territory_languages").then(function(d2) {
80902       _territoryLanguages = d2;
80903     }).catch(function() {
80904     });
80905     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
80906     var _selection = select_default2(null);
80907     var _multilingual = [];
80908     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
80909     var _wikiTitles;
80910     var _entityIDs = [];
80911     function loadLanguagesArray(dataLanguages) {
80912       if (_languagesArray.length !== 0) return;
80913       var replacements = {
80914         sr: "sr-Cyrl",
80915         // in OSM, `sr` implies Cyrillic
80916         "sr-Cyrl": false
80917         // `sr-Cyrl` isn't used in OSM
80918       };
80919       for (var code in dataLanguages) {
80920         if (replacements[code] === false) continue;
80921         var metaCode = code;
80922         if (replacements[code]) metaCode = replacements[code];
80923         _languagesArray.push({
80924           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
80925           nativeName: dataLanguages[metaCode].nativeName,
80926           code,
80927           label: _mainLocalizer.languageName(metaCode)
80928         });
80929       }
80930     }
80931     function calcLocked() {
80932       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
80933         var entity = context.graph().hasEntity(entityID);
80934         if (!entity) return false;
80935         if (entity.tags.wikidata) return true;
80936         if (entity.tags["name:etymology:wikidata"]) return true;
80937         var preset = _mainPresetIndex.match(entity, context.graph());
80938         if (preset) {
80939           var isSuggestion = preset.suggestion;
80940           var fields = preset.fields(entity.extent(context.graph()).center());
80941           var showsBrandField = fields.some(function(d2) {
80942             return d2.id === "brand";
80943           });
80944           var showsOperatorField = fields.some(function(d2) {
80945             return d2.id === "operator";
80946           });
80947           var setsName = preset.addTags.name;
80948           var setsBrandWikidata = preset.addTags["brand:wikidata"];
80949           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
80950           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
80951         }
80952         return false;
80953       });
80954       field.locked(isLocked);
80955     }
80956     function calcMultilingual(tags) {
80957       var existingLangsOrdered = _multilingual.map(function(item2) {
80958         return item2.lang;
80959       });
80960       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
80961       for (var k3 in tags) {
80962         var m3 = k3.match(LANGUAGE_SUFFIX_REGEX);
80963         if (m3 && m3[1] === field.key && m3[2]) {
80964           var item = { lang: m3[2], value: tags[k3] };
80965           if (existingLangs.has(item.lang)) {
80966             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
80967             existingLangs.delete(item.lang);
80968           } else {
80969             _multilingual.push(item);
80970           }
80971         }
80972       }
80973       _multilingual.forEach(function(item2) {
80974         if (item2.lang && existingLangs.has(item2.lang)) {
80975           item2.value = "";
80976         }
80977       });
80978     }
80979     function localized(selection2) {
80980       _selection = selection2;
80981       calcLocked();
80982       var isLocked = field.locked();
80983       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80984       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80985       input = wrap2.selectAll(".localized-main").data([0]);
80986       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
80987       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
80988       wrap2.call(_lengthIndicator);
80989       var translateButton = wrap2.selectAll(".localized-add").data([0]);
80990       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);
80991       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
80992       if (_tags && !_multilingual.length) {
80993         calcMultilingual(_tags);
80994       }
80995       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
80996       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
80997       localizedInputs.call(renderMultilingual);
80998       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
80999       selection2.selectAll(".combobox-caret").classed("nope", true);
81000       function addNew(d3_event) {
81001         d3_event.preventDefault();
81002         if (field.locked()) return;
81003         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
81004         var langExists = _multilingual.find(function(datum2) {
81005           return datum2.lang === defaultLang;
81006         });
81007         var isLangEn = defaultLang.indexOf("en") > -1;
81008         if (isLangEn || langExists) {
81009           defaultLang = "";
81010           langExists = _multilingual.find(function(datum2) {
81011             return datum2.lang === defaultLang;
81012           });
81013         }
81014         if (!langExists) {
81015           _multilingual.unshift({ lang: defaultLang, value: "" });
81016           localizedInputs.call(renderMultilingual);
81017         }
81018       }
81019       function change(onInput) {
81020         return function(d3_event) {
81021           if (field.locked()) {
81022             d3_event.preventDefault();
81023             return;
81024           }
81025           var val = utilGetSetValue(select_default2(this));
81026           if (!onInput) val = context.cleanTagValue(val);
81027           if (!val && Array.isArray(_tags[field.key])) return;
81028           var t2 = {};
81029           t2[field.key] = val || void 0;
81030           dispatch14.call("change", this, t2, onInput);
81031         };
81032       }
81033     }
81034     function key(lang) {
81035       return field.key + ":" + lang;
81036     }
81037     function changeLang(d3_event, d2) {
81038       var tags = {};
81039       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
81040       var language = _languagesArray.find(function(d4) {
81041         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
81042       });
81043       if (language) lang = language.code;
81044       if (d2.lang && d2.lang !== lang) {
81045         tags[key(d2.lang)] = void 0;
81046       }
81047       var newKey = lang && context.cleanTagKey(key(lang));
81048       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
81049       if (newKey && value) {
81050         tags[newKey] = value;
81051       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
81052         tags[newKey] = _wikiTitles[d2.lang];
81053       }
81054       d2.lang = lang;
81055       dispatch14.call("change", this, tags);
81056     }
81057     function changeValue(d3_event, d2) {
81058       if (!d2.lang) return;
81059       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
81060       if (!value && Array.isArray(d2.value)) return;
81061       var t2 = {};
81062       t2[key(d2.lang)] = value;
81063       d2.value = value;
81064       dispatch14.call("change", this, t2);
81065     }
81066     function fetchLanguages(value, cb) {
81067       var v3 = value.toLowerCase();
81068       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
81069       if (_countryCode && _territoryLanguages[_countryCode]) {
81070         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
81071       }
81072       var langItems = [];
81073       langCodes.forEach(function(code) {
81074         var langItem = _languagesArray.find(function(item) {
81075           return item.code === code;
81076         });
81077         if (langItem) langItems.push(langItem);
81078       });
81079       langItems = utilArrayUniq(langItems.concat(_languagesArray));
81080       cb(langItems.filter(function(d2) {
81081         return d2.label.toLowerCase().indexOf(v3) >= 0 || d2.localName && d2.localName.toLowerCase().indexOf(v3) >= 0 || d2.nativeName && d2.nativeName.toLowerCase().indexOf(v3) >= 0 || d2.code.toLowerCase().indexOf(v3) >= 0;
81082       }).map(function(d2) {
81083         return { value: d2.label };
81084       }));
81085     }
81086     function renderMultilingual(selection2) {
81087       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
81088         return d2.lang;
81089       });
81090       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
81091       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_3, index) {
81092         var wrap2 = select_default2(this);
81093         var domId = utilUniqueDomId(index);
81094         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
81095         var text = label.append("span").attr("class", "label-text");
81096         text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
81097         text.append("span").attr("class", "label-textannotation");
81098         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
81099           if (field.locked()) return;
81100           d3_event.preventDefault();
81101           _multilingual.splice(_multilingual.indexOf(d2), 1);
81102           var langKey = d2.lang && key(d2.lang);
81103           if (langKey && langKey in _tags) {
81104             delete _tags[langKey];
81105             var t2 = {};
81106             t2[langKey] = void 0;
81107             dispatch14.call("change", this, t2);
81108             return;
81109           }
81110           renderMultilingual(selection2);
81111         }).call(svgIcon("#iD-operation-delete"));
81112         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);
81113         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
81114       });
81115       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() {
81116         select_default2(this).style("max-height", "").style("overflow", "visible");
81117       });
81118       entries = entries.merge(entriesEnter);
81119       entries.order();
81120       entries.classed("present", true);
81121       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
81122         var langItem = _languagesArray.find(function(item) {
81123           return item.code === d2.lang;
81124         });
81125         if (langItem) return langItem.label;
81126         return d2.lang;
81127       });
81128       utilGetSetValue(entries.select(".localized-value"), function(d2) {
81129         return typeof d2.value === "string" ? d2.value : "";
81130       }).attr("title", function(d2) {
81131         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
81132       }).attr("placeholder", function(d2) {
81133         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
81134       }).attr("lang", function(d2) {
81135         return d2.lang;
81136       }).classed("mixed", function(d2) {
81137         return Array.isArray(d2.value);
81138       });
81139     }
81140     localized.tags = function(tags) {
81141       _tags = tags;
81142       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
81143         _wikiTitles = {};
81144         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
81145         if (wm && wm[0] && wm[1]) {
81146           wikipedia.translations(wm[1], wm[2], function(err, d2) {
81147             if (err || !d2) return;
81148             _wikiTitles = d2;
81149           });
81150         }
81151       }
81152       var isMixed = Array.isArray(tags[field.key]);
81153       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);
81154       calcMultilingual(tags);
81155       _selection.call(localized);
81156       if (!isMixed) {
81157         _lengthIndicator.update(tags[field.key]);
81158       }
81159     };
81160     localized.focus = function() {
81161       input.node().focus();
81162     };
81163     localized.entityIDs = function(val) {
81164       if (!arguments.length) return _entityIDs;
81165       _entityIDs = val;
81166       _multilingual = [];
81167       loadCountryCode();
81168       return localized;
81169     };
81170     function loadCountryCode() {
81171       var extent = combinedEntityExtent();
81172       var countryCode = extent && iso1A2Code(extent.center());
81173       _countryCode = countryCode && countryCode.toLowerCase();
81174     }
81175     function combinedEntityExtent() {
81176       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81177     }
81178     return utilRebind(localized, dispatch14, "on");
81179   }
81180   var _languagesArray, LANGUAGE_SUFFIX_REGEX;
81181   var init_localized = __esm({
81182     "modules/ui/fields/localized.js"() {
81183       "use strict";
81184       init_src4();
81185       init_src5();
81186       init_country_coder();
81187       init_presets();
81188       init_file_fetcher();
81189       init_localizer();
81190       init_services();
81191       init_svg();
81192       init_tooltip();
81193       init_combobox();
81194       init_util();
81195       init_length_indicator();
81196       _languagesArray = [];
81197       LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
81198     }
81199   });
81200
81201   // modules/ui/fields/roadheight.js
81202   var roadheight_exports = {};
81203   __export(roadheight_exports, {
81204     uiFieldRoadheight: () => uiFieldRoadheight
81205   });
81206   function uiFieldRoadheight(field, context) {
81207     var dispatch14 = dispatch_default("change");
81208     var primaryUnitInput = select_default2(null);
81209     var primaryInput = select_default2(null);
81210     var secondaryInput = select_default2(null);
81211     var secondaryUnitInput = select_default2(null);
81212     var _entityIDs = [];
81213     var _tags;
81214     var _isImperial;
81215     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
81216     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
81217     var primaryUnits = [
81218       {
81219         value: "m",
81220         title: _t("inspector.roadheight.meter")
81221       },
81222       {
81223         value: "ft",
81224         title: _t("inspector.roadheight.foot")
81225       }
81226     ];
81227     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
81228     function roadheight(selection2) {
81229       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81230       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81231       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
81232       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
81233       primaryInput.on("change", change).on("blur", change);
81234       var loc = combinedEntityExtent().center();
81235       _isImperial = roadHeightUnit(loc) === "ft";
81236       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
81237       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
81238       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
81239       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
81240       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
81241       secondaryInput.on("change", change).on("blur", change);
81242       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
81243       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
81244       function changeUnits() {
81245         var primaryUnit = utilGetSetValue(primaryUnitInput);
81246         if (primaryUnit === "m") {
81247           _isImperial = false;
81248         } else if (primaryUnit === "ft") {
81249           _isImperial = true;
81250         }
81251         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
81252         setUnitSuggestions();
81253         change();
81254       }
81255     }
81256     function setUnitSuggestions() {
81257       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
81258     }
81259     function change() {
81260       var tag = {};
81261       var primaryValue = utilGetSetValue(primaryInput).trim();
81262       var secondaryValue = utilGetSetValue(secondaryInput).trim();
81263       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key])) return;
81264       if (!primaryValue && !secondaryValue) {
81265         tag[field.key] = void 0;
81266       } else {
81267         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
81268         if (isNaN(rawPrimaryValue)) rawPrimaryValue = primaryValue;
81269         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
81270         if (isNaN(rawSecondaryValue)) rawSecondaryValue = secondaryValue;
81271         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
81272           tag[field.key] = context.cleanTagValue(rawPrimaryValue);
81273         } else {
81274           if (rawPrimaryValue !== "") {
81275             rawPrimaryValue = rawPrimaryValue + "'";
81276           }
81277           if (rawSecondaryValue !== "") {
81278             rawSecondaryValue = rawSecondaryValue + '"';
81279           }
81280           tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
81281         }
81282       }
81283       dispatch14.call("change", this, tag);
81284     }
81285     roadheight.tags = function(tags) {
81286       _tags = tags;
81287       var primaryValue = tags[field.key];
81288       var secondaryValue;
81289       var isMixed = Array.isArray(primaryValue);
81290       if (!isMixed) {
81291         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
81292           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
81293           if (secondaryValue !== null) {
81294             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
81295           }
81296           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
81297           if (primaryValue !== null) {
81298             primaryValue = formatFloat(parseFloat(primaryValue[1]));
81299           }
81300           _isImperial = true;
81301         } else if (primaryValue) {
81302           var rawValue = primaryValue;
81303           primaryValue = parseFloat(rawValue);
81304           if (isNaN(primaryValue)) {
81305             primaryValue = rawValue;
81306           } else {
81307             primaryValue = formatFloat(primaryValue);
81308           }
81309           _isImperial = false;
81310         }
81311       }
81312       setUnitSuggestions();
81313       var inchesPlaceholder = formatFloat(0);
81314       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);
81315       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");
81316       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
81317     };
81318     roadheight.focus = function() {
81319       primaryInput.node().focus();
81320     };
81321     roadheight.entityIDs = function(val) {
81322       _entityIDs = val;
81323     };
81324     function combinedEntityExtent() {
81325       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81326     }
81327     return utilRebind(roadheight, dispatch14, "on");
81328   }
81329   var init_roadheight = __esm({
81330     "modules/ui/fields/roadheight.js"() {
81331       "use strict";
81332       init_src4();
81333       init_src5();
81334       init_country_coder();
81335       init_combobox();
81336       init_localizer();
81337       init_util();
81338       init_input();
81339     }
81340   });
81341
81342   // modules/ui/fields/roadspeed.js
81343   var roadspeed_exports = {};
81344   __export(roadspeed_exports, {
81345     uiFieldRoadspeed: () => uiFieldRoadspeed
81346   });
81347   function uiFieldRoadspeed(field, context) {
81348     var dispatch14 = dispatch_default("change");
81349     var unitInput = select_default2(null);
81350     var input = select_default2(null);
81351     var _entityIDs = [];
81352     var _tags;
81353     var _isImperial;
81354     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
81355     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
81356     var speedCombo = uiCombobox(context, "roadspeed");
81357     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
81358     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
81359     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
81360     function roadspeed(selection2) {
81361       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81362       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81363       input = wrap2.selectAll("input.roadspeed-number").data([0]);
81364       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
81365       input.on("change", change).on("blur", change);
81366       var loc = combinedEntityExtent().center();
81367       _isImperial = roadSpeedUnit(loc) === "mph";
81368       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
81369       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
81370       unitInput.on("blur", changeUnits).on("change", changeUnits);
81371       function changeUnits() {
81372         var unit2 = utilGetSetValue(unitInput);
81373         if (unit2 === "km/h") {
81374           _isImperial = false;
81375         } else if (unit2 === "mph") {
81376           _isImperial = true;
81377         }
81378         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
81379         setUnitSuggestions();
81380         change();
81381       }
81382     }
81383     function setUnitSuggestions() {
81384       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
81385       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
81386     }
81387     function comboValues(d2) {
81388       return {
81389         value: formatFloat(d2),
81390         title: formatFloat(d2)
81391       };
81392     }
81393     function change() {
81394       var tag = {};
81395       var value = utilGetSetValue(input).trim();
81396       if (!value && Array.isArray(_tags[field.key])) return;
81397       if (!value) {
81398         tag[field.key] = void 0;
81399       } else {
81400         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
81401         if (isNaN(rawValue)) rawValue = value;
81402         if (isNaN(rawValue) || !_isImperial) {
81403           tag[field.key] = context.cleanTagValue(rawValue);
81404         } else {
81405           tag[field.key] = context.cleanTagValue(rawValue + " mph");
81406         }
81407       }
81408       dispatch14.call("change", this, tag);
81409     }
81410     roadspeed.tags = function(tags) {
81411       _tags = tags;
81412       var rawValue = tags[field.key];
81413       var value = rawValue;
81414       var isMixed = Array.isArray(value);
81415       if (!isMixed) {
81416         if (rawValue && rawValue.indexOf("mph") >= 0) {
81417           _isImperial = true;
81418         } else if (rawValue) {
81419           _isImperial = false;
81420         }
81421         value = parseInt(value, 10);
81422         if (isNaN(value)) {
81423           value = rawValue;
81424         } else {
81425           value = formatFloat(value);
81426         }
81427       }
81428       setUnitSuggestions();
81429       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);
81430     };
81431     roadspeed.focus = function() {
81432       input.node().focus();
81433     };
81434     roadspeed.entityIDs = function(val) {
81435       _entityIDs = val;
81436     };
81437     function combinedEntityExtent() {
81438       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81439     }
81440     return utilRebind(roadspeed, dispatch14, "on");
81441   }
81442   var init_roadspeed = __esm({
81443     "modules/ui/fields/roadspeed.js"() {
81444       "use strict";
81445       init_src4();
81446       init_src5();
81447       init_country_coder();
81448       init_combobox();
81449       init_localizer();
81450       init_util();
81451       init_input();
81452     }
81453   });
81454
81455   // modules/ui/fields/radio.js
81456   var radio_exports = {};
81457   __export(radio_exports, {
81458     uiFieldRadio: () => uiFieldRadio,
81459     uiFieldStructureRadio: () => uiFieldRadio
81460   });
81461   function uiFieldRadio(field, context) {
81462     var dispatch14 = dispatch_default("change");
81463     var placeholder = select_default2(null);
81464     var wrap2 = select_default2(null);
81465     var labels = select_default2(null);
81466     var radios = select_default2(null);
81467     var strings = field.resolveReference("stringsCrossReference");
81468     var radioData = (field.options || strings.options || field.keys).slice();
81469     var typeField;
81470     var layerField;
81471     var _oldType = {};
81472     var _entityIDs = [];
81473     function selectedKey() {
81474       var node = wrap2.selectAll(".form-field-input-radio label.active input");
81475       return !node.empty() && node.datum();
81476     }
81477     function radio(selection2) {
81478       selection2.classed("preset-radio", true);
81479       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81480       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
81481       enter.append("span").attr("class", "placeholder");
81482       wrap2 = wrap2.merge(enter);
81483       placeholder = wrap2.selectAll(".placeholder");
81484       labels = wrap2.selectAll("label").data(radioData);
81485       enter = labels.enter().append("label");
81486       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
81487         return strings.t("options." + d2, { "default": d2 });
81488       }).attr("checked", false);
81489       enter.append("span").each(function(d2) {
81490         strings.t.append("options." + d2, { "default": d2 })(select_default2(this));
81491       });
81492       labels = labels.merge(enter);
81493       radios = labels.selectAll("input").on("change", changeRadio);
81494     }
81495     function structureExtras(selection2, tags) {
81496       var selected = selectedKey() || tags.layer !== void 0;
81497       var type2 = _mainPresetIndex.field(selected);
81498       var layer = _mainPresetIndex.field("layer");
81499       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
81500       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
81501       extrasWrap.exit().remove();
81502       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
81503       var list = extrasWrap.selectAll("ul").data([0]);
81504       list = list.enter().append("ul").attr("class", "rows").merge(list);
81505       if (type2) {
81506         if (!typeField || typeField.id !== selected) {
81507           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
81508         }
81509         typeField.tags(tags);
81510       } else {
81511         typeField = null;
81512       }
81513       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
81514         return d2.id;
81515       });
81516       typeItem.exit().remove();
81517       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
81518       typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
81519       typeEnter.append("div").attr("class", "structure-input-type-wrap");
81520       typeItem = typeItem.merge(typeEnter);
81521       if (typeField) {
81522         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
81523       }
81524       if (layer && showLayer) {
81525         if (!layerField) {
81526           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
81527         }
81528         layerField.tags(tags);
81529         field.keys = utilArrayUnion(field.keys, ["layer"]);
81530       } else {
81531         layerField = null;
81532         field.keys = field.keys.filter(function(k3) {
81533           return k3 !== "layer";
81534         });
81535       }
81536       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
81537       layerItem.exit().remove();
81538       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
81539       layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
81540       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
81541       layerItem = layerItem.merge(layerEnter);
81542       if (layerField) {
81543         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
81544       }
81545     }
81546     function changeType(t2, onInput) {
81547       var key = selectedKey();
81548       if (!key) return;
81549       var val = t2[key];
81550       if (val !== "no") {
81551         _oldType[key] = val;
81552       }
81553       if (field.type === "structureRadio") {
81554         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
81555           t2.layer = void 0;
81556         }
81557         if (t2.layer === void 0) {
81558           if (key === "bridge" && val !== "no") {
81559             t2.layer = "1";
81560           }
81561           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
81562             t2.layer = "-1";
81563           }
81564         }
81565       }
81566       dispatch14.call("change", this, t2, onInput);
81567     }
81568     function changeLayer(t2, onInput) {
81569       if (t2.layer === "0") {
81570         t2.layer = void 0;
81571       }
81572       dispatch14.call("change", this, t2, onInput);
81573     }
81574     function changeRadio() {
81575       var t2 = {};
81576       var activeKey;
81577       if (field.key) {
81578         t2[field.key] = void 0;
81579       }
81580       radios.each(function(d2) {
81581         var active = select_default2(this).property("checked");
81582         if (active) activeKey = d2;
81583         if (field.key) {
81584           if (active) t2[field.key] = d2;
81585         } else {
81586           var val = _oldType[activeKey] || "yes";
81587           t2[d2] = active ? val : void 0;
81588         }
81589       });
81590       if (field.type === "structureRadio") {
81591         if (activeKey === "bridge") {
81592           t2.layer = "1";
81593         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
81594           t2.layer = "-1";
81595         } else {
81596           t2.layer = void 0;
81597         }
81598       }
81599       dispatch14.call("change", this, t2);
81600     }
81601     radio.tags = function(tags) {
81602       function isOptionChecked(d2) {
81603         if (field.key) {
81604           return tags[field.key] === d2;
81605         }
81606         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
81607       }
81608       function isMixed(d2) {
81609         if (field.key) {
81610           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
81611         }
81612         return Array.isArray(tags[d2]);
81613       }
81614       radios.property("checked", function(d2) {
81615         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
81616       });
81617       labels.classed("active", function(d2) {
81618         if (field.key) {
81619           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
81620         }
81621         return Array.isArray(tags[d2]) && tags[d2].some((v3) => typeof v3 === "string" && v3.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
81622       }).classed("mixed", isMixed).attr("title", function(d2) {
81623         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
81624       });
81625       var selection2 = radios.filter(function() {
81626         return this.checked;
81627       });
81628       if (selection2.empty()) {
81629         placeholder.text("");
81630         placeholder.call(_t.append("inspector.none"));
81631       } else {
81632         placeholder.text(selection2.attr("value"));
81633         _oldType[selection2.datum()] = tags[selection2.datum()];
81634       }
81635       if (field.type === "structureRadio") {
81636         if (!!tags.waterway && !_oldType.tunnel) {
81637           _oldType.tunnel = "culvert";
81638         }
81639         if (!!tags.waterway && !_oldType.bridge) {
81640           _oldType.bridge = "aqueduct";
81641         }
81642         wrap2.call(structureExtras, tags);
81643       }
81644     };
81645     radio.focus = function() {
81646       radios.node().focus();
81647     };
81648     radio.entityIDs = function(val) {
81649       if (!arguments.length) return _entityIDs;
81650       _entityIDs = val;
81651       _oldType = {};
81652       return radio;
81653     };
81654     radio.isAllowed = function() {
81655       return _entityIDs.length === 1;
81656     };
81657     return utilRebind(radio, dispatch14, "on");
81658   }
81659   var init_radio = __esm({
81660     "modules/ui/fields/radio.js"() {
81661       "use strict";
81662       init_src4();
81663       init_src5();
81664       init_presets();
81665       init_localizer();
81666       init_field2();
81667       init_util();
81668     }
81669   });
81670
81671   // modules/ui/fields/restrictions.js
81672   var restrictions_exports = {};
81673   __export(restrictions_exports, {
81674     uiFieldRestrictions: () => uiFieldRestrictions
81675   });
81676   function uiFieldRestrictions(field, context) {
81677     var dispatch14 = dispatch_default("change");
81678     var breathe = behaviorBreathe(context);
81679     corePreferences("turn-restriction-via-way", null);
81680     var storedViaWay = corePreferences("turn-restriction-via-way0");
81681     var storedDistance = corePreferences("turn-restriction-distance");
81682     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
81683     var _maxDistance = storedDistance ? +storedDistance : 30;
81684     var _initialized3 = false;
81685     var _parent = select_default2(null);
81686     var _container = select_default2(null);
81687     var _oldTurns;
81688     var _graph;
81689     var _vertexID;
81690     var _intersection;
81691     var _fromWayID;
81692     var _lastXPos;
81693     function restrictions(selection2) {
81694       _parent = selection2;
81695       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
81696         _graph = context.graph();
81697         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
81698       }
81699       var isOK = _intersection && _intersection.vertices.length && // has vertices
81700       _intersection.vertices.filter(function(vertex) {
81701         return vertex.id === _vertexID;
81702       }).length && _intersection.ways.length > 2;
81703       select_default2(selection2.node().parentNode).classed("hide", !isOK);
81704       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
81705         selection2.call(restrictions.off);
81706         return;
81707       }
81708       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81709       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81710       var container = wrap2.selectAll(".restriction-container").data([0]);
81711       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
81712       containerEnter.append("div").attr("class", "restriction-help");
81713       _container = containerEnter.merge(container).call(renderViewer);
81714       var controls = wrap2.selectAll(".restriction-controls").data([0]);
81715       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
81716     }
81717     function renderControls(selection2) {
81718       var distControl = selection2.selectAll(".restriction-distance").data([0]);
81719       distControl.exit().remove();
81720       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
81721       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
81722       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
81723       distControlEnter.append("span").attr("class", "restriction-distance-text");
81724       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
81725         var val = select_default2(this).property("value");
81726         _maxDistance = +val;
81727         _intersection = null;
81728         _container.selectAll(".layer-osm .layer-turns *").remove();
81729         corePreferences("turn-restriction-distance", _maxDistance);
81730         _parent.call(restrictions);
81731       });
81732       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
81733       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
81734       viaControl.exit().remove();
81735       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
81736       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
81737       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
81738       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
81739       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
81740         var val = select_default2(this).property("value");
81741         _maxViaWay = +val;
81742         _container.selectAll(".layer-osm .layer-turns *").remove();
81743         corePreferences("turn-restriction-via-way0", _maxViaWay);
81744         _parent.call(restrictions);
81745       });
81746       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
81747     }
81748     function renderViewer(selection2) {
81749       if (!_intersection) return;
81750       var vgraph = _intersection.graph;
81751       var filter2 = utilFunctor(true);
81752       var projection2 = geoRawMercator();
81753       var sdims = utilGetDimensions(context.container().select(".sidebar"));
81754       var d2 = [sdims[0] - 50, 370];
81755       var c2 = geoVecScale(d2, 0.5);
81756       var z3 = 22;
81757       projection2.scale(geoZoomToScale(z3));
81758       var extent = geoExtent();
81759       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
81760         extent._extend(_intersection.vertices[i3].extent());
81761       }
81762       var padTop = 35;
81763       if (_intersection.vertices.length > 1) {
81764         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
81765         var vPadding = 160;
81766         var tl = projection2([extent[0][0], extent[1][1]]);
81767         var br = projection2([extent[1][0], extent[0][1]]);
81768         var hFactor = (br[0] - tl[0]) / (d2[0] - hPadding);
81769         var vFactor = (br[1] - tl[1]) / (d2[1] - vPadding - padTop);
81770         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
81771         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
81772         z3 = z3 - Math.max(hZoomDiff, vZoomDiff);
81773         projection2.scale(geoZoomToScale(z3));
81774       }
81775       var extentCenter = projection2(extent.center());
81776       extentCenter[1] = extentCenter[1] - padTop / 2;
81777       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
81778       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
81779       var drawVertices = svgVertices(projection2, context);
81780       var drawLines = svgLines(projection2, context);
81781       var drawTurns = svgTurns(projection2, context);
81782       var firstTime = selection2.selectAll(".surface").empty();
81783       selection2.call(drawLayers);
81784       var surface = selection2.selectAll(".surface").classed("tr", true);
81785       if (firstTime) {
81786         _initialized3 = true;
81787         surface.call(breathe);
81788       }
81789       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
81790         _fromWayID = null;
81791         _oldTurns = null;
81792       }
81793       surface.call(utilSetDimensions, d2).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z3).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
81794       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
81795       surface.selectAll(".selected").classed("selected", false);
81796       surface.selectAll(".related").classed("related", false);
81797       var way;
81798       if (_fromWayID) {
81799         way = vgraph.entity(_fromWayID);
81800         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
81801       }
81802       document.addEventListener("resizeWindow", function() {
81803         utilSetDimensions(_container, null);
81804         redraw(1);
81805       }, false);
81806       updateHints(null);
81807       function click(d3_event) {
81808         surface.call(breathe.off).call(breathe);
81809         var datum2 = d3_event.target.__data__;
81810         var entity = datum2 && datum2.properties && datum2.properties.entity;
81811         if (entity) {
81812           datum2 = entity;
81813         }
81814         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
81815           _fromWayID = datum2.id;
81816           _oldTurns = null;
81817           redraw();
81818         } else if (datum2 instanceof osmTurn) {
81819           var actions, extraActions, turns, i4;
81820           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
81821           if (datum2.restrictionID && !datum2.direct) {
81822             return;
81823           } else if (datum2.restrictionID && !datum2.only) {
81824             var seen = {};
81825             var datumOnly = JSON.parse(JSON.stringify(datum2));
81826             datumOnly.only = true;
81827             restrictionType = restrictionType.replace(/^no/, "only");
81828             turns = _intersection.turns(_fromWayID, 2);
81829             extraActions = [];
81830             _oldTurns = [];
81831             for (i4 = 0; i4 < turns.length; i4++) {
81832               var turn = turns[i4];
81833               if (seen[turn.restrictionID]) continue;
81834               if (turn.direct && turn.path[1] === datum2.path[1]) {
81835                 seen[turns[i4].restrictionID] = true;
81836                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
81837                 _oldTurns.push(turn);
81838                 extraActions.push(actionUnrestrictTurn(turn));
81839               }
81840             }
81841             actions = _intersection.actions.concat(extraActions, [
81842               actionRestrictTurn(datumOnly, restrictionType),
81843               _t("operations.restriction.annotation.create")
81844             ]);
81845           } else if (datum2.restrictionID) {
81846             turns = _oldTurns || [];
81847             extraActions = [];
81848             for (i4 = 0; i4 < turns.length; i4++) {
81849               if (turns[i4].key !== datum2.key) {
81850                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
81851               }
81852             }
81853             _oldTurns = null;
81854             actions = _intersection.actions.concat(extraActions, [
81855               actionUnrestrictTurn(datum2),
81856               _t("operations.restriction.annotation.delete")
81857             ]);
81858           } else {
81859             actions = _intersection.actions.concat([
81860               actionRestrictTurn(datum2, restrictionType),
81861               _t("operations.restriction.annotation.create")
81862             ]);
81863           }
81864           context.perform.apply(context, actions);
81865           var s2 = surface.selectAll("." + datum2.key);
81866           datum2 = s2.empty() ? null : s2.datum();
81867           updateHints(datum2);
81868         } else {
81869           _fromWayID = null;
81870           _oldTurns = null;
81871           redraw();
81872         }
81873       }
81874       function mouseover(d3_event) {
81875         var datum2 = d3_event.target.__data__;
81876         updateHints(datum2);
81877       }
81878       _lastXPos = _lastXPos || sdims[0];
81879       function redraw(minChange) {
81880         var xPos = -1;
81881         if (minChange) {
81882           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
81883         }
81884         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
81885           if (context.hasEntity(_vertexID)) {
81886             _lastXPos = xPos;
81887             _container.call(renderViewer);
81888           }
81889         }
81890       }
81891       function highlightPathsFrom(wayID) {
81892         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
81893         surface.selectAll("." + wayID).classed("related", true);
81894         if (wayID) {
81895           var turns = _intersection.turns(wayID, _maxViaWay);
81896           for (var i4 = 0; i4 < turns.length; i4++) {
81897             var turn = turns[i4];
81898             var ids = [turn.to.way];
81899             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
81900             if (turn.only || turns.length === 1) {
81901               if (turn.via.ways) {
81902                 ids = ids.concat(turn.via.ways);
81903               }
81904             } else if (turn.to.way === wayID) {
81905               continue;
81906             }
81907             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
81908           }
81909         }
81910       }
81911       function updateHints(datum2) {
81912         var help = _container.selectAll(".restriction-help").html("");
81913         var placeholders = {};
81914         ["from", "via", "to"].forEach(function(k3) {
81915           placeholders[k3] = { html: '<span class="qualifier">' + _t("restriction.help." + k3) + "</span>" };
81916         });
81917         var entity = datum2 && datum2.properties && datum2.properties.entity;
81918         if (entity) {
81919           datum2 = entity;
81920         }
81921         if (_fromWayID) {
81922           way = vgraph.entity(_fromWayID);
81923           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
81924         }
81925         if (datum2 instanceof osmWay && datum2.__from) {
81926           way = datum2;
81927           highlightPathsFrom(_fromWayID ? null : way.id);
81928           surface.selectAll("." + way.id).classed("related", true);
81929           var clickSelect = !_fromWayID || _fromWayID !== way.id;
81930           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
81931             from: placeholders.from,
81932             fromName: displayName(way.id, vgraph)
81933           }));
81934         } else if (datum2 instanceof osmTurn) {
81935           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
81936           var turnType = restrictionType.replace(/^(only|no)\_/, "");
81937           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
81938           var klass, turnText, nextText;
81939           if (datum2.no) {
81940             klass = "restrict";
81941             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
81942             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
81943           } else if (datum2.only) {
81944             klass = "only";
81945             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
81946             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
81947           } else {
81948             klass = "allow";
81949             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
81950             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
81951           }
81952           help.append("div").attr("class", "qualifier " + klass).html(turnText);
81953           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
81954             from: placeholders.from,
81955             fromName: displayName(datum2.from.way, vgraph),
81956             to: placeholders.to,
81957             toName: displayName(datum2.to.way, vgraph)
81958           }));
81959           if (datum2.via.ways && datum2.via.ways.length) {
81960             var names = [];
81961             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
81962               var prev = names[names.length - 1];
81963               var curr = displayName(datum2.via.ways[i4], vgraph);
81964               if (!prev || curr !== prev) {
81965                 names.push(curr);
81966               }
81967             }
81968             help.append("div").html(_t.html("restriction.help.via_names", {
81969               via: placeholders.via,
81970               viaNames: names.join(", ")
81971             }));
81972           }
81973           if (!indirect) {
81974             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
81975           }
81976           highlightPathsFrom(null);
81977           var alongIDs = datum2.path.slice();
81978           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
81979         } else {
81980           highlightPathsFrom(null);
81981           if (_fromWayID) {
81982             help.append("div").html(_t.html("restriction.help.from_name", {
81983               from: placeholders.from,
81984               fromName: displayName(_fromWayID, vgraph)
81985             }));
81986           } else {
81987             help.append("div").html(_t.html("restriction.help.select_from", {
81988               from: placeholders.from
81989             }));
81990           }
81991         }
81992       }
81993     }
81994     function displayMaxDistance(maxDist) {
81995       return (selection2) => {
81996         var isImperial = !_mainLocalizer.usesMetric();
81997         var opts;
81998         if (isImperial) {
81999           var distToFeet = {
82000             // imprecise conversion for prettier display
82001             20: 70,
82002             25: 85,
82003             30: 100,
82004             35: 115,
82005             40: 130,
82006             45: 145,
82007             50: 160
82008           }[maxDist];
82009           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
82010         } else {
82011           opts = { distance: _t("units.meters", { quantity: maxDist }) };
82012         }
82013         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
82014       };
82015     }
82016     function displayMaxVia(maxVia) {
82017       return (selection2) => {
82018         selection2 = selection2.html("");
82019         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"));
82020       };
82021     }
82022     function displayName(entityID, graph) {
82023       var entity = graph.entity(entityID);
82024       var name = utilDisplayName(entity) || "";
82025       var matched = _mainPresetIndex.match(entity, graph);
82026       var type2 = matched && matched.name() || utilDisplayType(entity.id);
82027       return name || type2;
82028     }
82029     restrictions.entityIDs = function(val) {
82030       _intersection = null;
82031       _fromWayID = null;
82032       _oldTurns = null;
82033       _vertexID = val[0];
82034     };
82035     restrictions.tags = function() {
82036     };
82037     restrictions.focus = function() {
82038     };
82039     restrictions.off = function(selection2) {
82040       if (!_initialized3) return;
82041       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
82042       select_default2(window).on("resize.restrictions", null);
82043     };
82044     return utilRebind(restrictions, dispatch14, "on");
82045   }
82046   var init_restrictions = __esm({
82047     "modules/ui/fields/restrictions.js"() {
82048       "use strict";
82049       init_src4();
82050       init_src5();
82051       init_presets();
82052       init_preferences();
82053       init_localizer();
82054       init_restrict_turn();
82055       init_unrestrict_turn();
82056       init_breathe();
82057       init_geo2();
82058       init_osm();
82059       init_svg();
82060       init_util();
82061       init_dimensions();
82062       uiFieldRestrictions.supportsMultiselection = false;
82063     }
82064   });
82065
82066   // modules/ui/fields/textarea.js
82067   var textarea_exports = {};
82068   __export(textarea_exports, {
82069     uiFieldTextarea: () => uiFieldTextarea
82070   });
82071   function uiFieldTextarea(field, context) {
82072     var dispatch14 = dispatch_default("change");
82073     var input = select_default2(null);
82074     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
82075     var _tags;
82076     function textarea(selection2) {
82077       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82078       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
82079       input = wrap2.selectAll("textarea").data([0]);
82080       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
82081       wrap2.call(_lengthIndicator);
82082       function change(onInput) {
82083         return function() {
82084           var val = utilGetSetValue(input);
82085           if (!onInput) val = context.cleanTagValue(val);
82086           if (!val && Array.isArray(_tags[field.key])) return;
82087           var t2 = {};
82088           t2[field.key] = val || void 0;
82089           dispatch14.call("change", this, t2, onInput);
82090         };
82091       }
82092     }
82093     textarea.tags = function(tags) {
82094       _tags = tags;
82095       var isMixed = Array.isArray(tags[field.key]);
82096       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);
82097       if (!isMixed) {
82098         _lengthIndicator.update(tags[field.key]);
82099       }
82100     };
82101     textarea.focus = function() {
82102       input.node().focus();
82103     };
82104     return utilRebind(textarea, dispatch14, "on");
82105   }
82106   var init_textarea = __esm({
82107     "modules/ui/fields/textarea.js"() {
82108       "use strict";
82109       init_src4();
82110       init_src5();
82111       init_localizer();
82112       init_util();
82113       init_ui();
82114     }
82115   });
82116
82117   // modules/ui/fields/wikidata.js
82118   var wikidata_exports2 = {};
82119   __export(wikidata_exports2, {
82120     uiFieldWikidata: () => uiFieldWikidata
82121   });
82122   function uiFieldWikidata(field, context) {
82123     var wikidata = services.wikidata;
82124     var dispatch14 = dispatch_default("change");
82125     var _selection = select_default2(null);
82126     var _searchInput = select_default2(null);
82127     var _qid = null;
82128     var _wikidataEntity = null;
82129     var _wikiURL = "";
82130     var _entityIDs = [];
82131     var _wikipediaKey = field.keys && field.keys.find(function(key) {
82132       return key.includes("wikipedia");
82133     });
82134     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
82135     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
82136     function wiki(selection2) {
82137       _selection = selection2;
82138       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82139       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
82140       var list = wrap2.selectAll("ul").data([0]);
82141       list = list.enter().append("ul").attr("class", "rows").merge(list);
82142       var searchRow = list.selectAll("li.wikidata-search").data([0]);
82143       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
82144       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
82145         var node = select_default2(this).node();
82146         node.setSelectionRange(0, node.value.length);
82147       }).on("blur", function() {
82148         setLabelForEntity();
82149       }).call(combobox.fetcher(fetchWikidataItems));
82150       combobox.on("accept", function(d2) {
82151         if (d2) {
82152           _qid = d2.id;
82153           change();
82154         }
82155       }).on("cancel", function() {
82156         setLabelForEntity();
82157       });
82158       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) {
82159         d3_event.preventDefault();
82160         if (_wikiURL) window.open(_wikiURL, "_blank");
82161       });
82162       searchRow = searchRow.merge(searchRowEnter);
82163       _searchInput = searchRow.select("input");
82164       var wikidataProperties = ["description", "identifier"];
82165       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
82166       var enter = items.enter().append("li").attr("class", function(d2) {
82167         return "labeled-input preset-wikidata-" + d2;
82168       });
82169       enter.append("div").attr("class", "label").html(function(d2) {
82170         return _t.html("wikidata." + d2);
82171       });
82172       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
82173       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
82174         d3_event.preventDefault();
82175         select_default2(this.parentNode).select("input").node().select();
82176         document.execCommand("copy");
82177       });
82178     }
82179     function fetchWikidataItems(q3, callback) {
82180       if (!q3 && _hintKey) {
82181         for (var i3 in _entityIDs) {
82182           var entity = context.hasEntity(_entityIDs[i3]);
82183           if (entity.tags[_hintKey]) {
82184             q3 = entity.tags[_hintKey];
82185             break;
82186           }
82187         }
82188       }
82189       wikidata.itemsForSearchQuery(q3, function(err, data) {
82190         if (err) {
82191           if (err !== "No query") console.error(err);
82192           return;
82193         }
82194         var result = data.map(function(item) {
82195           return {
82196             id: item.id,
82197             value: item.display.label.value + " (" + item.id + ")",
82198             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
82199             title: item.display.description && item.display.description.value,
82200             terms: item.aliases
82201           };
82202         });
82203         if (callback) callback(result);
82204       });
82205     }
82206     function change() {
82207       var syncTags = {};
82208       syncTags[field.key] = _qid;
82209       dispatch14.call("change", this, syncTags);
82210       var initGraph = context.graph();
82211       var initEntityIDs = _entityIDs;
82212       wikidata.entityByQID(_qid, function(err, entity) {
82213         if (err) return;
82214         if (context.graph() !== initGraph) return;
82215         if (!entity.sitelinks) return;
82216         var langs = wikidata.languagesToQuery();
82217         ["labels", "descriptions"].forEach(function(key) {
82218           if (!entity[key]) return;
82219           var valueLangs = Object.keys(entity[key]);
82220           if (valueLangs.length === 0) return;
82221           var valueLang = valueLangs[0];
82222           if (langs.indexOf(valueLang) === -1) {
82223             langs.push(valueLang);
82224           }
82225         });
82226         var newWikipediaValue;
82227         if (_wikipediaKey) {
82228           var foundPreferred;
82229           for (var i3 in langs) {
82230             var lang = langs[i3];
82231             var siteID = lang.replace("-", "_") + "wiki";
82232             if (entity.sitelinks[siteID]) {
82233               foundPreferred = true;
82234               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
82235               break;
82236             }
82237           }
82238           if (!foundPreferred) {
82239             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
82240               return site.endsWith("wiki");
82241             });
82242             if (wikiSiteKeys.length === 0) {
82243               newWikipediaValue = null;
82244             } else {
82245               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
82246               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
82247               newWikipediaValue = wikiLang + ":" + wikiTitle;
82248             }
82249           }
82250         }
82251         if (newWikipediaValue) {
82252           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
82253         }
82254         if (typeof newWikipediaValue === "undefined") return;
82255         var actions = initEntityIDs.map(function(entityID) {
82256           var entity2 = context.hasEntity(entityID);
82257           if (!entity2) return null;
82258           var currTags = Object.assign({}, entity2.tags);
82259           if (newWikipediaValue === null) {
82260             if (!currTags[_wikipediaKey]) return null;
82261             delete currTags[_wikipediaKey];
82262           } else {
82263             currTags[_wikipediaKey] = newWikipediaValue;
82264           }
82265           return actionChangeTags(entityID, currTags);
82266         }).filter(Boolean);
82267         if (!actions.length) return;
82268         context.overwrite(
82269           function actionUpdateWikipediaTags(graph) {
82270             actions.forEach(function(action) {
82271               graph = action(graph);
82272             });
82273             return graph;
82274           },
82275           context.history().undoAnnotation()
82276         );
82277       });
82278     }
82279     function setLabelForEntity() {
82280       var label = {
82281         value: ""
82282       };
82283       if (_wikidataEntity) {
82284         label = entityPropertyForDisplay(_wikidataEntity, "labels");
82285         if (label.value.length === 0) {
82286           label.value = _wikidataEntity.id.toString();
82287         }
82288       }
82289       utilGetSetValue(_searchInput, label.value).attr("lang", label.language);
82290     }
82291     wiki.tags = function(tags) {
82292       var isMixed = Array.isArray(tags[field.key]);
82293       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
82294       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
82295       if (!/^Q[0-9]*$/.test(_qid)) {
82296         unrecognized();
82297         return;
82298       }
82299       _wikiURL = "https://wikidata.org/wiki/" + _qid;
82300       wikidata.entityByQID(_qid, function(err, entity) {
82301         if (err) {
82302           unrecognized();
82303           return;
82304         }
82305         _wikidataEntity = entity;
82306         setLabelForEntity();
82307         var description = entityPropertyForDisplay(entity, "descriptions");
82308         _selection.select("button.wiki-link").classed("disabled", false);
82309         _selection.select(".preset-wikidata-description").style("display", function() {
82310           return description.value.length > 0 ? "flex" : "none";
82311         }).select("input").attr("value", description.value).attr("lang", description.language);
82312         _selection.select(".preset-wikidata-identifier").style("display", function() {
82313           return entity.id ? "flex" : "none";
82314         }).select("input").attr("value", entity.id);
82315       });
82316       function unrecognized() {
82317         _wikidataEntity = null;
82318         setLabelForEntity();
82319         _selection.select(".preset-wikidata-description").style("display", "none");
82320         _selection.select(".preset-wikidata-identifier").style("display", "none");
82321         _selection.select("button.wiki-link").classed("disabled", true);
82322         if (_qid && _qid !== "") {
82323           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
82324         } else {
82325           _wikiURL = "";
82326         }
82327       }
82328     };
82329     function entityPropertyForDisplay(wikidataEntity, propKey) {
82330       var blankResponse = { value: "" };
82331       if (!wikidataEntity[propKey]) return blankResponse;
82332       var propObj = wikidataEntity[propKey];
82333       var langKeys = Object.keys(propObj);
82334       if (langKeys.length === 0) return blankResponse;
82335       var langs = wikidata.languagesToQuery();
82336       for (var i3 in langs) {
82337         var lang = langs[i3];
82338         var valueObj = propObj[lang];
82339         if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj;
82340       }
82341       return propObj[langKeys[0]];
82342     }
82343     wiki.entityIDs = function(val) {
82344       if (!arguments.length) return _entityIDs;
82345       _entityIDs = val;
82346       return wiki;
82347     };
82348     wiki.focus = function() {
82349       _searchInput.node().focus();
82350     };
82351     return utilRebind(wiki, dispatch14, "on");
82352   }
82353   var init_wikidata2 = __esm({
82354     "modules/ui/fields/wikidata.js"() {
82355       "use strict";
82356       init_src4();
82357       init_src5();
82358       init_change_tags();
82359       init_services();
82360       init_icon();
82361       init_util();
82362       init_combobox();
82363       init_localizer();
82364     }
82365   });
82366
82367   // modules/ui/fields/wikipedia.js
82368   var wikipedia_exports2 = {};
82369   __export(wikipedia_exports2, {
82370     uiFieldWikipedia: () => uiFieldWikipedia
82371   });
82372   function uiFieldWikipedia(field, context) {
82373     const scheme = "https://";
82374     const domain = "wikipedia.org";
82375     const dispatch14 = dispatch_default("change");
82376     const wikipedia = services.wikipedia;
82377     const wikidata = services.wikidata;
82378     let _langInput = select_default2(null);
82379     let _titleInput = select_default2(null);
82380     let _wikiURL = "";
82381     let _entityIDs;
82382     let _tags;
82383     let _dataWikipedia = [];
82384     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
82385       _dataWikipedia = d2;
82386       if (_tags) updateForTags(_tags);
82387     }).catch(() => {
82388     });
82389     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
82390       const v3 = value.toLowerCase();
82391       callback(
82392         _dataWikipedia.filter((d2) => {
82393           return d2[0].toLowerCase().indexOf(v3) >= 0 || d2[1].toLowerCase().indexOf(v3) >= 0 || d2[2].toLowerCase().indexOf(v3) >= 0;
82394         }).map((d2) => ({ value: d2[1] }))
82395       );
82396     });
82397     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
82398       if (!value) {
82399         value = "";
82400         for (let i3 in _entityIDs) {
82401           let entity = context.hasEntity(_entityIDs[i3]);
82402           if (entity.tags.name) {
82403             value = entity.tags.name;
82404             break;
82405           }
82406         }
82407       }
82408       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
82409       searchfn(language()[2], value, (query, data) => {
82410         callback(data.map((d2) => ({ value: d2 })));
82411       });
82412     });
82413     function wiki(selection2) {
82414       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82415       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
82416       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
82417       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
82418       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
82419       _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);
82420       _langInput.on("blur", changeLang).on("change", changeLang);
82421       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
82422       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
82423       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
82424       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
82425       _titleInput.on("blur", function() {
82426         change(true);
82427       }).on("change", function() {
82428         change(false);
82429       });
82430       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
82431       link2 = link2.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain })).call(svgIcon("#iD-icon-out-link")).merge(link2);
82432       link2.on("click", (d3_event) => {
82433         d3_event.preventDefault();
82434         if (_wikiURL) window.open(_wikiURL, "_blank");
82435       });
82436     }
82437     function defaultLanguageInfo(skipEnglishFallback) {
82438       const langCode = _mainLocalizer.languageCode().toLowerCase();
82439       for (let i3 in _dataWikipedia) {
82440         let d2 = _dataWikipedia[i3];
82441         if (d2[2] === langCode) return d2;
82442       }
82443       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
82444     }
82445     function language(skipEnglishFallback) {
82446       const value = utilGetSetValue(_langInput).toLowerCase();
82447       for (let i3 in _dataWikipedia) {
82448         let d2 = _dataWikipedia[i3];
82449         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value) return d2;
82450       }
82451       return defaultLanguageInfo(skipEnglishFallback);
82452     }
82453     function changeLang() {
82454       utilGetSetValue(_langInput, language()[1]);
82455       change(true);
82456     }
82457     function change(skipWikidata) {
82458       let value = utilGetSetValue(_titleInput);
82459       const m3 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
82460       const langInfo = m3 && _dataWikipedia.find((d2) => m3[1] === d2[2]);
82461       let syncTags = {};
82462       if (langInfo) {
82463         const nativeLangName = langInfo[1];
82464         value = decodeURIComponent(m3[2]).replace(/_/g, " ");
82465         if (m3[3]) {
82466           let anchor;
82467           anchor = decodeURIComponent(m3[3]);
82468           value += "#" + anchor.replace(/_/g, " ");
82469         }
82470         value = value.slice(0, 1).toUpperCase() + value.slice(1);
82471         utilGetSetValue(_langInput, nativeLangName).attr("lang", langInfo[2]);
82472         utilGetSetValue(_titleInput, value);
82473       }
82474       if (value) {
82475         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
82476       } else {
82477         syncTags.wikipedia = void 0;
82478       }
82479       dispatch14.call("change", this, syncTags);
82480       if (skipWikidata || !value || !language()[2]) return;
82481       const initGraph = context.graph();
82482       const initEntityIDs = _entityIDs;
82483       wikidata.itemsByTitle(language()[2], value, (err, data) => {
82484         if (err || !data || !Object.keys(data).length) return;
82485         if (context.graph() !== initGraph) return;
82486         const qids = Object.keys(data);
82487         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
82488         let actions = initEntityIDs.map((entityID) => {
82489           let entity = context.entity(entityID).tags;
82490           let currTags = Object.assign({}, entity);
82491           if (currTags.wikidata !== value2) {
82492             currTags.wikidata = value2;
82493             return actionChangeTags(entityID, currTags);
82494           }
82495           return null;
82496         }).filter(Boolean);
82497         if (!actions.length) return;
82498         context.overwrite(
82499           function actionUpdateWikidataTags(graph) {
82500             actions.forEach(function(action) {
82501               graph = action(graph);
82502             });
82503             return graph;
82504           },
82505           context.history().undoAnnotation()
82506         );
82507       });
82508     }
82509     wiki.tags = (tags) => {
82510       _tags = tags;
82511       updateForTags(tags);
82512     };
82513     function updateForTags(tags) {
82514       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
82515       const m3 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
82516       const tagLang = m3 && m3[1];
82517       const tagArticleTitle = m3 && m3[2];
82518       let anchor = m3 && m3[3];
82519       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
82520       if (tagLangInfo) {
82521         const nativeLangName = tagLangInfo[1];
82522         utilGetSetValue(_langInput, nativeLangName);
82523         _titleInput.attr("lang", tagLangInfo[2]);
82524         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
82525         _wikiURL = `${scheme}${tagLang}.${domain}/wiki/${wiki.encodePath(tagArticleTitle, anchor)}`;
82526       } else {
82527         utilGetSetValue(_titleInput, value);
82528         if (value && value !== "") {
82529           utilGetSetValue(_langInput, "");
82530           const defaultLangInfo = defaultLanguageInfo();
82531           _wikiURL = `${scheme}${defaultLangInfo[2]}.${domain}/w/index.php?fulltext=1&search=${value}`;
82532         } else {
82533           const shownOrDefaultLangInfo = language(
82534             true
82535             /* skipEnglishFallback */
82536           );
82537           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
82538           _wikiURL = "";
82539         }
82540       }
82541     }
82542     wiki.encodePath = (tagArticleTitle, anchor) => {
82543       const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
82544       const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
82545       const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
82546       return `${uriEncodedUnderscoredTitle}${uriEncodedAnchorFragment}`;
82547     };
82548     wiki.encodeURIAnchorFragment = (anchor) => {
82549       if (!anchor) return "";
82550       const underscoredAnchor = anchor.replace(/ /g, "_");
82551       return "#" + encodeURIComponent(underscoredAnchor);
82552     };
82553     wiki.entityIDs = (val) => {
82554       if (!arguments.length) return _entityIDs;
82555       _entityIDs = val;
82556       return wiki;
82557     };
82558     wiki.focus = () => {
82559       _titleInput.node().focus();
82560     };
82561     return utilRebind(wiki, dispatch14, "on");
82562   }
82563   var init_wikipedia2 = __esm({
82564     "modules/ui/fields/wikipedia.js"() {
82565       "use strict";
82566       init_src4();
82567       init_src5();
82568       init_file_fetcher();
82569       init_localizer();
82570       init_change_tags();
82571       init_services();
82572       init_icon();
82573       init_combobox();
82574       init_util();
82575       uiFieldWikipedia.supportsMultiselection = false;
82576     }
82577   });
82578
82579   // modules/ui/fields/index.js
82580   var fields_exports = {};
82581   __export(fields_exports, {
82582     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
82583     likelyRawNumberFormat: () => likelyRawNumberFormat,
82584     uiFieldAccess: () => uiFieldAccess,
82585     uiFieldAddress: () => uiFieldAddress,
82586     uiFieldCheck: () => uiFieldCheck,
82587     uiFieldColour: () => uiFieldText,
82588     uiFieldCombo: () => uiFieldCombo,
82589     uiFieldDefaultCheck: () => uiFieldCheck,
82590     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
82591     uiFieldEmail: () => uiFieldText,
82592     uiFieldIdentifier: () => uiFieldText,
82593     uiFieldLanes: () => uiFieldLanes,
82594     uiFieldLocalized: () => uiFieldLocalized,
82595     uiFieldManyCombo: () => uiFieldCombo,
82596     uiFieldMultiCombo: () => uiFieldCombo,
82597     uiFieldNetworkCombo: () => uiFieldCombo,
82598     uiFieldNumber: () => uiFieldText,
82599     uiFieldOnewayCheck: () => uiFieldCheck,
82600     uiFieldRadio: () => uiFieldRadio,
82601     uiFieldRestrictions: () => uiFieldRestrictions,
82602     uiFieldRoadheight: () => uiFieldRoadheight,
82603     uiFieldRoadspeed: () => uiFieldRoadspeed,
82604     uiFieldSemiCombo: () => uiFieldCombo,
82605     uiFieldStructureRadio: () => uiFieldRadio,
82606     uiFieldTel: () => uiFieldText,
82607     uiFieldText: () => uiFieldText,
82608     uiFieldTextarea: () => uiFieldTextarea,
82609     uiFieldTypeCombo: () => uiFieldCombo,
82610     uiFieldUrl: () => uiFieldText,
82611     uiFieldWikidata: () => uiFieldWikidata,
82612     uiFieldWikipedia: () => uiFieldWikipedia,
82613     uiFields: () => uiFields
82614   });
82615   var uiFields;
82616   var init_fields = __esm({
82617     "modules/ui/fields/index.js"() {
82618       "use strict";
82619       init_check();
82620       init_combo();
82621       init_input();
82622       init_access();
82623       init_address();
82624       init_directional_combo();
82625       init_lanes2();
82626       init_localized();
82627       init_roadheight();
82628       init_roadspeed();
82629       init_radio();
82630       init_restrictions();
82631       init_textarea();
82632       init_wikidata2();
82633       init_wikipedia2();
82634       init_check();
82635       init_combo();
82636       init_input();
82637       init_radio();
82638       init_access();
82639       init_address();
82640       init_directional_combo();
82641       init_lanes2();
82642       init_localized();
82643       init_roadheight();
82644       init_roadspeed();
82645       init_restrictions();
82646       init_textarea();
82647       init_wikidata2();
82648       init_wikipedia2();
82649       uiFields = {
82650         access: uiFieldAccess,
82651         address: uiFieldAddress,
82652         check: uiFieldCheck,
82653         colour: uiFieldText,
82654         combo: uiFieldCombo,
82655         cycleway: uiFieldDirectionalCombo,
82656         date: uiFieldText,
82657         defaultCheck: uiFieldCheck,
82658         directionalCombo: uiFieldDirectionalCombo,
82659         email: uiFieldText,
82660         identifier: uiFieldText,
82661         lanes: uiFieldLanes,
82662         localized: uiFieldLocalized,
82663         roadheight: uiFieldRoadheight,
82664         roadspeed: uiFieldRoadspeed,
82665         manyCombo: uiFieldCombo,
82666         multiCombo: uiFieldCombo,
82667         networkCombo: uiFieldCombo,
82668         number: uiFieldText,
82669         onewayCheck: uiFieldCheck,
82670         radio: uiFieldRadio,
82671         restrictions: uiFieldRestrictions,
82672         semiCombo: uiFieldCombo,
82673         structureRadio: uiFieldRadio,
82674         tel: uiFieldText,
82675         text: uiFieldText,
82676         textarea: uiFieldTextarea,
82677         typeCombo: uiFieldCombo,
82678         url: uiFieldText,
82679         wikidata: uiFieldWikidata,
82680         wikipedia: uiFieldWikipedia
82681       };
82682     }
82683   });
82684
82685   // modules/ui/field.js
82686   var field_exports2 = {};
82687   __export(field_exports2, {
82688     uiField: () => uiField
82689   });
82690   function uiField(context, presetField2, entityIDs, options) {
82691     options = Object.assign({
82692       show: true,
82693       wrap: true,
82694       remove: true,
82695       revert: true,
82696       info: true
82697     }, options);
82698     var dispatch14 = dispatch_default("change", "revert");
82699     var field = Object.assign({}, presetField2);
82700     field.domId = utilUniqueDomId("form-field-" + field.safeid);
82701     var _show = options.show;
82702     var _state = "";
82703     var _tags = {};
82704     var _entityExtent;
82705     if (entityIDs && entityIDs.length) {
82706       _entityExtent = entityIDs.reduce(function(extent, entityID) {
82707         var entity = context.graph().entity(entityID);
82708         return extent.extend(entity.extent(context.graph()));
82709       }, geoExtent());
82710     }
82711     var _locked = false;
82712     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
82713     if (_show && !field.impl) {
82714       createField();
82715     }
82716     function createField() {
82717       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
82718         dispatch14.call("change", field, t2, onInput);
82719       });
82720       if (entityIDs) {
82721         field.entityIDs = entityIDs;
82722         if (field.impl.entityIDs) {
82723           field.impl.entityIDs(entityIDs);
82724         }
82725       }
82726     }
82727     function allKeys() {
82728       let keys2 = field.keys || [field.key];
82729       if (field.type === "directionalCombo" && field.key) {
82730         const baseKey = field.key.replace(/:both$/, "");
82731         keys2 = keys2.concat(baseKey, `${baseKey}:both`);
82732       }
82733       return keys2;
82734     }
82735     function isModified() {
82736       if (!entityIDs || !entityIDs.length) return false;
82737       return entityIDs.some(function(entityID) {
82738         var original = context.graph().base().entities[entityID];
82739         var latest = context.graph().entity(entityID);
82740         return allKeys().some(function(key) {
82741           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
82742         });
82743       });
82744     }
82745     function tagsContainFieldKey() {
82746       return allKeys().some(function(key) {
82747         if (field.type === "multiCombo") {
82748           for (var tagKey in _tags) {
82749             if (tagKey.indexOf(key) === 0) {
82750               return true;
82751             }
82752           }
82753           return false;
82754         }
82755         if (field.type === "localized") {
82756           for (let tagKey2 in _tags) {
82757             let match = tagKey2.match(LANGUAGE_SUFFIX_REGEX);
82758             if (match && match[1] === field.key && match[2]) {
82759               return true;
82760             }
82761           }
82762         }
82763         return _tags[key] !== void 0;
82764       });
82765     }
82766     function revert(d3_event, d2) {
82767       d3_event.stopPropagation();
82768       d3_event.preventDefault();
82769       if (!entityIDs || _locked) return;
82770       dispatch14.call("revert", d2, allKeys());
82771     }
82772     function remove2(d3_event, d2) {
82773       d3_event.stopPropagation();
82774       d3_event.preventDefault();
82775       if (_locked) return;
82776       var t2 = {};
82777       allKeys().forEach(function(key) {
82778         t2[key] = void 0;
82779       });
82780       dispatch14.call("change", d2, t2);
82781     }
82782     field.render = function(selection2) {
82783       var container = selection2.selectAll(".form-field").data([field]);
82784       var enter = container.enter().append("div").attr("class", function(d2) {
82785         return "form-field form-field-" + d2.safeid;
82786       }).classed("nowrap", !options.wrap);
82787       if (options.wrap) {
82788         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
82789           return d2.domId;
82790         });
82791         var textEnter = labelEnter.append("span").attr("class", "label-text");
82792         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
82793           d2.label()(select_default2(this));
82794         });
82795         textEnter.append("span").attr("class", "label-textannotation");
82796         if (options.remove) {
82797           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
82798         }
82799         if (options.revert) {
82800           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
82801         }
82802       }
82803       container = container.merge(enter);
82804       container.select(".field-label > .remove-icon").on("click", remove2);
82805       container.select(".field-label > .modified-icon").on("click", revert);
82806       container.each(function(d2) {
82807         var selection3 = select_default2(this);
82808         if (!d2.impl) {
82809           createField();
82810         }
82811         var reference, help;
82812         if (options.wrap && field.type === "restrictions") {
82813           help = uiFieldHelp(context, "restrictions");
82814         }
82815         if (options.wrap && options.info) {
82816           var referenceKey = d2.key || "";
82817           if (d2.type === "multiCombo") {
82818             referenceKey = referenceKey.replace(/:$/, "");
82819           }
82820           var referenceOptions = d2.reference || {
82821             key: referenceKey,
82822             value: _tags[referenceKey]
82823           };
82824           reference = uiTagReference(referenceOptions, context);
82825           if (_state === "hover") {
82826             reference.showing(false);
82827           }
82828         }
82829         selection3.call(d2.impl);
82830         if (help) {
82831           selection3.call(help.body).select(".field-label").call(help.button);
82832         }
82833         if (reference) {
82834           selection3.call(reference.body).select(".field-label").call(reference.button);
82835         }
82836         d2.impl.tags(_tags);
82837       });
82838       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
82839       var annotation = container.selectAll(".field-label .label-textannotation");
82840       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
82841       icon2.exit().remove();
82842       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
82843       container.call(_locked ? _lockedTip : _lockedTip.destroy);
82844     };
82845     field.state = function(val) {
82846       if (!arguments.length) return _state;
82847       _state = val;
82848       return field;
82849     };
82850     field.tags = function(val) {
82851       if (!arguments.length) return _tags;
82852       _tags = val;
82853       if (tagsContainFieldKey() && !_show) {
82854         _show = true;
82855         if (!field.impl) {
82856           createField();
82857         }
82858       }
82859       return field;
82860     };
82861     field.locked = function(val) {
82862       if (!arguments.length) return _locked;
82863       _locked = val;
82864       return field;
82865     };
82866     field.show = function() {
82867       _show = true;
82868       if (!field.impl) {
82869         createField();
82870       }
82871       if (field.default && field.key && _tags[field.key] !== field.default) {
82872         var t2 = {};
82873         t2[field.key] = field.default;
82874         dispatch14.call("change", this, t2);
82875       }
82876     };
82877     field.isShown = function() {
82878       return _show;
82879     };
82880     field.isAllowed = function() {
82881       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false) return false;
82882       if (field.geometry && !entityIDs.every(function(entityID) {
82883         return field.matchGeometry(context.graph().geometry(entityID));
82884       })) return false;
82885       if (entityIDs && _entityExtent && field.locationSetID) {
82886         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
82887         if (!validHere[field.locationSetID]) return false;
82888       }
82889       var prerequisiteTag = field.prerequisiteTag;
82890       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
82891       prerequisiteTag) {
82892         if (!entityIDs.every(function(entityID) {
82893           var entity = context.graph().entity(entityID);
82894           if (prerequisiteTag.key) {
82895             var value = entity.tags[prerequisiteTag.key];
82896             if (!value) return false;
82897             if (prerequisiteTag.valueNot) {
82898               return prerequisiteTag.valueNot !== value;
82899             }
82900             if (prerequisiteTag.value) {
82901               return prerequisiteTag.value === value;
82902             }
82903           } else if (prerequisiteTag.keyNot) {
82904             if (entity.tags[prerequisiteTag.keyNot]) return false;
82905           }
82906           return true;
82907         })) return false;
82908       }
82909       return true;
82910     };
82911     field.focus = function() {
82912       if (field.impl) {
82913         field.impl.focus();
82914       }
82915     };
82916     return utilRebind(field, dispatch14, "on");
82917   }
82918   var init_field2 = __esm({
82919     "modules/ui/field.js"() {
82920       "use strict";
82921       init_src4();
82922       init_src5();
82923       init_localizer();
82924       init_LocationManager();
82925       init_icon();
82926       init_tooltip();
82927       init_extent();
82928       init_field_help();
82929       init_fields();
82930       init_localized();
82931       init_tag_reference();
82932       init_util();
82933     }
82934   });
82935
82936   // modules/ui/changeset_editor.js
82937   var changeset_editor_exports = {};
82938   __export(changeset_editor_exports, {
82939     uiChangesetEditor: () => uiChangesetEditor
82940   });
82941   function uiChangesetEditor(context) {
82942     var dispatch14 = dispatch_default("change");
82943     var formFields = uiFormFields(context);
82944     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
82945     var _fieldsArr;
82946     var _tags;
82947     var _changesetID;
82948     function changesetEditor(selection2) {
82949       render(selection2);
82950     }
82951     function render(selection2) {
82952       var _a4;
82953       var initial = false;
82954       if (!_fieldsArr) {
82955         initial = true;
82956         var presets = _mainPresetIndex;
82957         _fieldsArr = [
82958           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
82959           uiField(context, presets.field("source"), null, { show: true, revert: false }),
82960           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
82961         ];
82962         _fieldsArr.forEach(function(field) {
82963           field.on("change", function(t2, onInput) {
82964             dispatch14.call("change", field, void 0, t2, onInput);
82965           });
82966         });
82967       }
82968       _fieldsArr.forEach(function(field) {
82969         field.tags(_tags);
82970       });
82971       selection2.call(formFields.fieldsArr(_fieldsArr));
82972       if (initial) {
82973         var commentField = selection2.select(".form-field-comment textarea");
82974         const sourceField = _fieldsArr.find((field) => field.id === "source");
82975         var commentNode = commentField.node();
82976         if (commentNode) {
82977           commentNode.focus();
82978           commentNode.select();
82979         }
82980         utilTriggerEvent(commentField, "blur");
82981         var osm = context.connection();
82982         if (osm) {
82983           osm.userChangesets(function(err, changesets) {
82984             if (err) return;
82985             var comments = changesets.map(function(changeset) {
82986               var comment = changeset.tags.comment;
82987               return comment ? { title: comment, value: comment } : null;
82988             }).filter(Boolean);
82989             commentField.call(
82990               commentCombo.data(utilArrayUniqBy(comments, "title"))
82991             );
82992             const recentSources = changesets.flatMap((changeset) => {
82993               var _a5;
82994               return (_a5 = changeset.tags.source) == null ? void 0 : _a5.split(";");
82995             }).filter((value) => !sourceField.options.includes(value)).filter(Boolean).map((title) => ({ title, value: title, klass: "raw-option" }));
82996             sourceField.impl.setCustomOptions(utilArrayUniqBy(recentSources, "title"));
82997           });
82998         }
82999       }
83000       const warnings = [];
83001       if ((_a4 = _tags.comment) == null ? void 0 : _a4.match(/google/i)) {
83002         warnings.push({
83003           id: 'contains "google"',
83004           msg: _t.append("commit.google_warning"),
83005           link: _t("commit.google_warning_link")
83006         });
83007       }
83008       const maxChars = context.maxCharsForTagValue();
83009       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
83010       if (strLen > maxChars || false) {
83011         warnings.push({
83012           id: "message too long",
83013           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
83014         });
83015       }
83016       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
83017       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
83018       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
83019       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
83020       commentEnter.transition().duration(200).style("opacity", 1);
83021       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
83022         let selection3 = select_default2(this);
83023         if (d2.link) {
83024           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
83025         }
83026         selection3.call(d2.msg);
83027       });
83028     }
83029     changesetEditor.tags = function(_3) {
83030       if (!arguments.length) return _tags;
83031       _tags = _3;
83032       return changesetEditor;
83033     };
83034     changesetEditor.changesetID = function(_3) {
83035       if (!arguments.length) return _changesetID;
83036       if (_changesetID === _3) return changesetEditor;
83037       _changesetID = _3;
83038       _fieldsArr = null;
83039       return changesetEditor;
83040     };
83041     return utilRebind(changesetEditor, dispatch14, "on");
83042   }
83043   var init_changeset_editor = __esm({
83044     "modules/ui/changeset_editor.js"() {
83045       "use strict";
83046       init_src4();
83047       init_src5();
83048       init_presets();
83049       init_localizer();
83050       init_icon();
83051       init_combobox();
83052       init_field2();
83053       init_form_fields();
83054       init_util();
83055     }
83056   });
83057
83058   // modules/ui/sections/changes.js
83059   var changes_exports = {};
83060   __export(changes_exports, {
83061     uiSectionChanges: () => uiSectionChanges
83062   });
83063   function uiSectionChanges(context) {
83064     var _discardTags = {};
83065     _mainFileFetcher.get("discarded").then(function(d2) {
83066       _discardTags = d2;
83067     }).catch(function() {
83068     });
83069     var section = uiSection("changes-list", context).label(function() {
83070       var history = context.history();
83071       var summary = history.difference().summary();
83072       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
83073     }).disclosureContent(renderDisclosureContent);
83074     function renderDisclosureContent(selection2) {
83075       var history = context.history();
83076       var summary = history.difference().summary();
83077       var container = selection2.selectAll(".commit-section").data([0]);
83078       var containerEnter = container.enter().append("div").attr("class", "commit-section");
83079       containerEnter.append("ul").attr("class", "changeset-list");
83080       container = containerEnter.merge(container);
83081       var items = container.select("ul").selectAll("li").data(summary);
83082       var itemsEnter = items.enter().append("li").attr("class", "change-item");
83083       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
83084       buttons.each(function(d2) {
83085         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
83086       });
83087       buttons.append("span").attr("class", "change-type").html(function(d2) {
83088         return _t.html("commit." + d2.changeType) + " ";
83089       });
83090       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
83091         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
83092         return matched && matched.name() || utilDisplayType(d2.entity.id);
83093       });
83094       buttons.append("span").attr("class", "entity-name").text(function(d2) {
83095         var name = utilDisplayName(d2.entity) || "", string = "";
83096         if (name !== "") {
83097           string += ":";
83098         }
83099         return string += " " + name;
83100       });
83101       items = itemsEnter.merge(items);
83102       var changeset = new osmChangeset().update({ id: void 0 });
83103       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
83104       delete changeset.id;
83105       var data = JXON.stringify(changeset.osmChangeJXON(changes));
83106       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
83107       var fileName = "changes.osc";
83108       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
83109       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
83110       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
83111       function mouseover(d3_event, d2) {
83112         if (d2.entity) {
83113           context.surface().selectAll(
83114             utilEntityOrMemberSelector([d2.entity.id], context.graph())
83115           ).classed("hover", true);
83116         }
83117       }
83118       function mouseout() {
83119         context.surface().selectAll(".hover").classed("hover", false);
83120       }
83121       function click(d3_event, change) {
83122         if (change.changeType !== "deleted") {
83123           var entity = change.entity;
83124           context.map().zoomToEase(entity);
83125           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
83126         }
83127       }
83128     }
83129     return section;
83130   }
83131   var init_changes = __esm({
83132     "modules/ui/sections/changes.js"() {
83133       "use strict";
83134       init_src5();
83135       init_presets();
83136       init_file_fetcher();
83137       init_localizer();
83138       init_jxon();
83139       init_discard_tags();
83140       init_osm();
83141       init_icon();
83142       init_section();
83143       init_util();
83144     }
83145   });
83146
83147   // modules/ui/commit.js
83148   var commit_exports = {};
83149   __export(commit_exports, {
83150     uiCommit: () => uiCommit
83151   });
83152   function uiCommit(context) {
83153     var dispatch14 = dispatch_default("cancel");
83154     var _userDetails2;
83155     var _selection;
83156     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
83157     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
83158     var commitChanges = uiSectionChanges(context);
83159     var commitWarnings = uiCommitWarnings(context);
83160     function commit(selection2) {
83161       _selection = selection2;
83162       if (!context.changeset) initChangeset();
83163       loadDerivedChangesetTags();
83164       selection2.call(render);
83165     }
83166     function initChangeset() {
83167       var commentDate = +corePreferences("commentDate") || 0;
83168       var currDate = Date.now();
83169       var cutoff = 2 * 86400 * 1e3;
83170       if (commentDate > currDate || currDate - commentDate > cutoff) {
83171         corePreferences("comment", null);
83172         corePreferences("hashtags", null);
83173         corePreferences("source", null);
83174       }
83175       if (context.defaultChangesetComment()) {
83176         corePreferences("comment", context.defaultChangesetComment());
83177         corePreferences("commentDate", Date.now());
83178       }
83179       if (context.defaultChangesetSource()) {
83180         corePreferences("source", context.defaultChangesetSource());
83181         corePreferences("commentDate", Date.now());
83182       }
83183       if (context.defaultChangesetHashtags()) {
83184         corePreferences("hashtags", context.defaultChangesetHashtags());
83185         corePreferences("commentDate", Date.now());
83186       }
83187       var detected = utilDetect();
83188       var tags = {
83189         comment: corePreferences("comment") || "",
83190         created_by: context.cleanTagValue("iD " + context.version),
83191         host: context.cleanTagValue(detected.host),
83192         locale: context.cleanTagValue(_mainLocalizer.localeCode())
83193       };
83194       findHashtags(tags, true);
83195       var hashtags = corePreferences("hashtags");
83196       if (hashtags) {
83197         tags.hashtags = hashtags;
83198       }
83199       var source = corePreferences("source");
83200       if (source) {
83201         tags.source = source;
83202       }
83203       var photoOverlaysUsed = context.history().photoOverlaysUsed();
83204       if (photoOverlaysUsed.length) {
83205         var sources = (tags.source || "").split(";");
83206         if (sources.indexOf("streetlevel imagery") === -1) {
83207           sources.push("streetlevel imagery");
83208         }
83209         photoOverlaysUsed.forEach(function(photoOverlay) {
83210           if (sources.indexOf(photoOverlay) === -1) {
83211             sources.push(photoOverlay);
83212           }
83213         });
83214         tags.source = context.cleanTagValue(sources.filter(Boolean).join(";"));
83215       }
83216       context.changeset = new osmChangeset({ tags });
83217     }
83218     function loadDerivedChangesetTags() {
83219       var osm = context.connection();
83220       if (!osm) return;
83221       var tags = Object.assign({}, context.changeset.tags);
83222       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
83223       tags.imagery_used = imageryUsed || "None";
83224       var osmClosed = osm.getClosedIDs();
83225       var itemType;
83226       if (osmClosed.length) {
83227         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
83228       }
83229       if (services.keepRight) {
83230         var krClosed = services.keepRight.getClosedIDs();
83231         if (krClosed.length) {
83232           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
83233         }
83234       }
83235       if (services.osmose) {
83236         var osmoseClosed = services.osmose.getClosedCounts();
83237         for (itemType in osmoseClosed) {
83238           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
83239         }
83240       }
83241       for (var key in tags) {
83242         if (key.match(/(^warnings:)|(^resolved:)/)) {
83243           delete tags[key];
83244         }
83245       }
83246       function addIssueCounts(issues, prefix) {
83247         var issuesByType = utilArrayGroupBy(issues, "type");
83248         for (var issueType in issuesByType) {
83249           var issuesOfType = issuesByType[issueType];
83250           if (issuesOfType[0].subtype) {
83251             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
83252             for (var issueSubtype in issuesBySubtype) {
83253               var issuesOfSubtype = issuesBySubtype[issueSubtype];
83254               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
83255             }
83256           } else {
83257             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
83258           }
83259         }
83260       }
83261       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
83262         return issue.type !== "help_request";
83263       });
83264       addIssueCounts(warnings, "warnings");
83265       var resolvedIssues = context.validator().getResolvedIssues();
83266       addIssueCounts(resolvedIssues, "resolved");
83267       context.changeset = context.changeset.update({ tags });
83268     }
83269     function render(selection2) {
83270       var osm = context.connection();
83271       if (!osm) return;
83272       var header = selection2.selectAll(".header").data([0]);
83273       var headerTitle = header.enter().append("div").attr("class", "header fillL");
83274       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
83275       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
83276         dispatch14.call("cancel", this);
83277       }).call(svgIcon("#iD-icon-close"));
83278       var body = selection2.selectAll(".body").data([0]);
83279       body = body.enter().append("div").attr("class", "body").merge(body);
83280       var changesetSection = body.selectAll(".changeset-editor").data([0]);
83281       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
83282       changesetSection.call(
83283         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
83284       );
83285       body.call(commitWarnings);
83286       var saveSection = body.selectAll(".save-section").data([0]);
83287       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
83288       var prose = saveSection.selectAll(".commit-info").data([0]);
83289       if (prose.enter().size()) {
83290         _userDetails2 = null;
83291       }
83292       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
83293       osm.userDetails(function(err, user) {
83294         if (err) return;
83295         if (_userDetails2 === user) return;
83296         _userDetails2 = user;
83297         var userLink = select_default2(document.createElement("div"));
83298         if (user.image_url) {
83299           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
83300         }
83301         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
83302         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
83303       });
83304       var requestReview = saveSection.selectAll(".request-review").data([0]);
83305       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
83306       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
83307       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
83308       if (!labelEnter.empty()) {
83309         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
83310       }
83311       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
83312       labelEnter.append("span").call(_t.append("commit.request_review"));
83313       requestReview = requestReview.merge(requestReviewEnter);
83314       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
83315       var buttonSection = saveSection.selectAll(".buttons").data([0]);
83316       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
83317       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
83318       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
83319       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
83320       var uploadBlockerTooltipText = getUploadBlockerMessage();
83321       buttonSection = buttonSection.merge(buttonEnter);
83322       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
83323         dispatch14.call("cancel", this);
83324       });
83325       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
83326         if (!select_default2(this).classed("disabled")) {
83327           this.blur();
83328           for (var key in context.changeset.tags) {
83329             if (!key) delete context.changeset.tags[key];
83330           }
83331           context.uploader().save(context.changeset);
83332         }
83333       });
83334       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
83335       if (uploadBlockerTooltipText) {
83336         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
83337       }
83338       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
83339       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
83340       tagSection.call(
83341         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
83342       );
83343       var changesSection = body.selectAll(".commit-changes-section").data([0]);
83344       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
83345       changesSection.call(commitChanges.render);
83346       function toggleRequestReview() {
83347         var rr = requestReviewInput.property("checked");
83348         updateChangeset({ review_requested: rr ? "yes" : void 0 });
83349         tagSection.call(
83350           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
83351         );
83352       }
83353     }
83354     function getUploadBlockerMessage() {
83355       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
83356       if (errors.length) {
83357         return _t.append("commit.outstanding_errors_message", { count: errors.length });
83358       } else {
83359         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
83360         if (!hasChangesetComment) {
83361           return _t.append("commit.comment_needed_message");
83362         }
83363       }
83364       return null;
83365     }
83366     function changeTags(_3, changed, onInput) {
83367       if (changed.hasOwnProperty("comment")) {
83368         if (!onInput) {
83369           corePreferences("comment", changed.comment);
83370           corePreferences("commentDate", Date.now());
83371         }
83372       }
83373       if (changed.hasOwnProperty("source")) {
83374         if (changed.source === void 0) {
83375           corePreferences("source", null);
83376         } else if (!onInput) {
83377           corePreferences("source", changed.source);
83378           corePreferences("commentDate", Date.now());
83379         }
83380       }
83381       updateChangeset(changed, onInput);
83382       if (_selection) {
83383         _selection.call(render);
83384       }
83385     }
83386     function findHashtags(tags, commentOnly) {
83387       var detectedHashtags = commentHashtags();
83388       if (detectedHashtags.length) {
83389         corePreferences("hashtags", null);
83390       }
83391       if (!detectedHashtags.length || !commentOnly) {
83392         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
83393       }
83394       var allLowerCase = /* @__PURE__ */ new Set();
83395       return detectedHashtags.filter(function(hashtag) {
83396         var lowerCase = hashtag.toLowerCase();
83397         if (!allLowerCase.has(lowerCase)) {
83398           allLowerCase.add(lowerCase);
83399           return true;
83400         }
83401         return false;
83402       });
83403       function commentHashtags() {
83404         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
83405         return matches || [];
83406       }
83407       function hashtagHashtags() {
83408         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
83409           if (s2[0] !== "#") {
83410             s2 = "#" + s2;
83411           }
83412           var matched = s2.match(hashtagRegex);
83413           return matched && matched[0];
83414         }).filter(Boolean);
83415         return matches || [];
83416       }
83417     }
83418     function isReviewRequested(tags) {
83419       var rr = tags.review_requested;
83420       if (rr === void 0) return false;
83421       rr = rr.trim().toLowerCase();
83422       return !(rr === "" || rr === "no");
83423     }
83424     function updateChangeset(changed, onInput) {
83425       var tags = Object.assign({}, context.changeset.tags);
83426       Object.keys(changed).forEach(function(k3) {
83427         var v3 = changed[k3];
83428         k3 = context.cleanTagKey(k3);
83429         if (readOnlyTags.indexOf(k3) !== -1) return;
83430         if (v3 === void 0) {
83431           delete tags[k3];
83432         } else if (onInput) {
83433           tags[k3] = v3;
83434         } else {
83435           tags[k3] = context.cleanTagValue(v3);
83436         }
83437       });
83438       if (!onInput) {
83439         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
83440         var arr = findHashtags(tags, commentOnly);
83441         if (arr.length) {
83442           tags.hashtags = context.cleanTagValue(arr.join(";"));
83443           corePreferences("hashtags", tags.hashtags);
83444         } else {
83445           delete tags.hashtags;
83446           corePreferences("hashtags", null);
83447         }
83448       }
83449       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
83450         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
83451         tags.changesets_count = String(changesetsCount);
83452         if (changesetsCount <= 100) {
83453           var s2;
83454           s2 = corePreferences("walkthrough_completed");
83455           if (s2) {
83456             tags["ideditor:walkthrough_completed"] = s2;
83457           }
83458           s2 = corePreferences("walkthrough_progress");
83459           if (s2) {
83460             tags["ideditor:walkthrough_progress"] = s2;
83461           }
83462           s2 = corePreferences("walkthrough_started");
83463           if (s2) {
83464             tags["ideditor:walkthrough_started"] = s2;
83465           }
83466         }
83467       } else {
83468         delete tags.changesets_count;
83469       }
83470       if (!(0, import_fast_deep_equal11.default)(context.changeset.tags, tags)) {
83471         context.changeset = context.changeset.update({ tags });
83472       }
83473     }
83474     commit.reset = function() {
83475       context.changeset = null;
83476     };
83477     return utilRebind(commit, dispatch14, "on");
83478   }
83479   var import_fast_deep_equal11, readOnlyTags, hashtagRegex;
83480   var init_commit = __esm({
83481     "modules/ui/commit.js"() {
83482       "use strict";
83483       init_src4();
83484       init_src5();
83485       import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
83486       init_preferences();
83487       init_localizer();
83488       init_osm();
83489       init_icon();
83490       init_services();
83491       init_tooltip();
83492       init_changeset_editor();
83493       init_changes();
83494       init_commit_warnings();
83495       init_raw_tag_editor();
83496       init_util();
83497       init_detect();
83498       readOnlyTags = [
83499         /^changesets_count$/,
83500         /^created_by$/,
83501         /^ideditor:/,
83502         /^imagery_used$/,
83503         /^host$/,
83504         /^locale$/,
83505         /^warnings:/,
83506         /^resolved:/,
83507         /^closed:note$/,
83508         /^closed:keepright$/,
83509         /^closed:osmose:/
83510       ];
83511       hashtagRegex = /([##][^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
83512     }
83513   });
83514
83515   // modules/modes/save.js
83516   var save_exports2 = {};
83517   __export(save_exports2, {
83518     modeSave: () => modeSave
83519   });
83520   function modeSave(context) {
83521     var mode = { id: "save" };
83522     var keybinding = utilKeybinding("modeSave");
83523     var commit = uiCommit(context).on("cancel", cancel);
83524     var _conflictsUi;
83525     var _location;
83526     var _success;
83527     var uploader = context.uploader().on("saveStarted.modeSave", function() {
83528       keybindingOff();
83529     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
83530       cancel();
83531     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
83532     function cancel() {
83533       context.enter(modeBrowse(context));
83534     }
83535     function showProgress(num, total) {
83536       var modal = context.container().select(".loading-modal .modal-section");
83537       var progress = modal.selectAll(".progress").data([0]);
83538       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
83539     }
83540     function showConflicts(changeset, conflicts, origChanges) {
83541       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
83542       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
83543       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
83544         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83545         selection2.remove();
83546         keybindingOn();
83547         uploader.cancelConflictResolution();
83548       }).on("save", function() {
83549         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83550         selection2.remove();
83551         uploader.processResolvedConflicts(changeset);
83552       });
83553       selection2.call(_conflictsUi);
83554     }
83555     function showErrors(errors) {
83556       keybindingOn();
83557       var selection2 = uiConfirm(context.container());
83558       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
83559       addErrors(selection2, errors);
83560       selection2.okButton();
83561     }
83562     function addErrors(selection2, data) {
83563       var message = selection2.select(".modal-section.message-text");
83564       var items = message.selectAll(".error-container").data(data);
83565       var enter = items.enter().append("div").attr("class", "error-container");
83566       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
83567         return d2.msg || _t("save.unknown_error_details");
83568       }).on("click", function(d3_event) {
83569         d3_event.preventDefault();
83570         var error = select_default2(this);
83571         var detail = select_default2(this.nextElementSibling);
83572         var exp2 = error.classed("expanded");
83573         detail.style("display", exp2 ? "none" : "block");
83574         error.classed("expanded", !exp2);
83575       });
83576       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
83577       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
83578         return d2.details || [];
83579       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
83580         return d2;
83581       });
83582       items.exit().remove();
83583     }
83584     function showSuccess(changeset) {
83585       commit.reset();
83586       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
83587         context.ui().sidebar.hide();
83588       });
83589       context.enter(modeBrowse(context).sidebar(ui));
83590     }
83591     function keybindingOn() {
83592       select_default2(document).call(keybinding.on("\u238B", cancel, true));
83593     }
83594     function keybindingOff() {
83595       select_default2(document).call(keybinding.unbind);
83596     }
83597     function prepareForSuccess() {
83598       _success = uiSuccess(context);
83599       _location = null;
83600       if (!services.geocoder) return;
83601       services.geocoder.reverse(context.map().center(), function(err, result) {
83602         if (err || !result || !result.address) return;
83603         var addr = result.address;
83604         var place = addr && (addr.town || addr.city || addr.county) || "";
83605         var region = addr && (addr.state || addr.country) || "";
83606         var separator = place && region ? _t("success.thank_you_where.separator") : "";
83607         _location = _t(
83608           "success.thank_you_where.format",
83609           { place, separator, region }
83610         );
83611       });
83612     }
83613     mode.selectedIDs = function() {
83614       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
83615     };
83616     mode.enter = function() {
83617       context.ui().sidebar.expand();
83618       function done() {
83619         context.ui().sidebar.show(commit);
83620       }
83621       keybindingOn();
83622       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83623       var osm = context.connection();
83624       if (!osm) {
83625         cancel();
83626         return;
83627       }
83628       if (osm.authenticated()) {
83629         done();
83630       } else {
83631         osm.authenticate(function(err) {
83632           if (err) {
83633             cancel();
83634           } else {
83635             done();
83636           }
83637         });
83638       }
83639     };
83640     mode.exit = function() {
83641       keybindingOff();
83642       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
83643       context.ui().sidebar.hide();
83644     };
83645     return mode;
83646   }
83647   var init_save2 = __esm({
83648     "modules/modes/save.js"() {
83649       "use strict";
83650       init_src5();
83651       init_localizer();
83652       init_browse();
83653       init_services();
83654       init_conflicts();
83655       init_confirm();
83656       init_commit();
83657       init_success();
83658       init_util();
83659     }
83660   });
83661
83662   // modules/modes/index.js
83663   var modes_exports2 = {};
83664   __export(modes_exports2, {
83665     modeAddArea: () => modeAddArea,
83666     modeAddLine: () => modeAddLine,
83667     modeAddNote: () => modeAddNote,
83668     modeAddPoint: () => modeAddPoint,
83669     modeBrowse: () => modeBrowse,
83670     modeDragNode: () => modeDragNode,
83671     modeDragNote: () => modeDragNote,
83672     modeDrawArea: () => modeDrawArea,
83673     modeDrawLine: () => modeDrawLine,
83674     modeMove: () => modeMove,
83675     modeRotate: () => modeRotate,
83676     modeSave: () => modeSave,
83677     modeSelect: () => modeSelect,
83678     modeSelectData: () => modeSelectData,
83679     modeSelectError: () => modeSelectError,
83680     modeSelectNote: () => modeSelectNote
83681   });
83682   var init_modes2 = __esm({
83683     "modules/modes/index.js"() {
83684       "use strict";
83685       init_add_area();
83686       init_add_line();
83687       init_add_point();
83688       init_add_note();
83689       init_browse();
83690       init_drag_node();
83691       init_drag_note();
83692       init_draw_area();
83693       init_draw_line();
83694       init_move3();
83695       init_rotate2();
83696       init_save2();
83697       init_select5();
83698       init_select_data();
83699       init_select_error();
83700       init_select_note();
83701     }
83702   });
83703
83704   // modules/core/context.js
83705   var context_exports = {};
83706   __export(context_exports, {
83707     coreContext: () => coreContext
83708   });
83709   function coreContext() {
83710     const dispatch14 = dispatch_default("enter", "exit", "change");
83711     const context = {};
83712     let _deferred2 = /* @__PURE__ */ new Set();
83713     context.version = package_default.version;
83714     context.privacyVersion = "20201202";
83715     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
83716     context.changeset = null;
83717     let _defaultChangesetComment = context.initialHashParams.comment;
83718     let _defaultChangesetSource = context.initialHashParams.source;
83719     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
83720     context.defaultChangesetComment = function(val) {
83721       if (!arguments.length) return _defaultChangesetComment;
83722       _defaultChangesetComment = val;
83723       return context;
83724     };
83725     context.defaultChangesetSource = function(val) {
83726       if (!arguments.length) return _defaultChangesetSource;
83727       _defaultChangesetSource = val;
83728       return context;
83729     };
83730     context.defaultChangesetHashtags = function(val) {
83731       if (!arguments.length) return _defaultChangesetHashtags;
83732       _defaultChangesetHashtags = val;
83733       return context;
83734     };
83735     let _setsDocumentTitle = true;
83736     context.setsDocumentTitle = function(val) {
83737       if (!arguments.length) return _setsDocumentTitle;
83738       _setsDocumentTitle = val;
83739       return context;
83740     };
83741     let _documentTitleBase = document.title;
83742     context.documentTitleBase = function(val) {
83743       if (!arguments.length) return _documentTitleBase;
83744       _documentTitleBase = val;
83745       return context;
83746     };
83747     let _ui;
83748     context.ui = () => _ui;
83749     context.lastPointerType = () => _ui.lastPointerType();
83750     let _keybinding = utilKeybinding("context");
83751     context.keybinding = () => _keybinding;
83752     select_default2(document).call(_keybinding);
83753     let _connection = services.osm;
83754     let _history;
83755     let _validator;
83756     let _uploader;
83757     context.connection = () => _connection;
83758     context.history = () => _history;
83759     context.validator = () => _validator;
83760     context.uploader = () => _uploader;
83761     context.preauth = (options) => {
83762       if (_connection) {
83763         _connection.switch(options);
83764       }
83765       return context;
83766     };
83767     context.locale = function(locale3) {
83768       if (!arguments.length) return _mainLocalizer.localeCode();
83769       _mainLocalizer.preferredLocaleCodes(locale3);
83770       return context;
83771     };
83772     function afterLoad(cid, callback) {
83773       return (err, result) => {
83774         if (err) {
83775           if (typeof callback === "function") {
83776             callback(err);
83777           }
83778           return;
83779         } else if (_connection && _connection.getConnectionId() !== cid) {
83780           if (typeof callback === "function") {
83781             callback({ message: "Connection Switched", status: -1 });
83782           }
83783           return;
83784         } else {
83785           _history.merge(result.data, result.extent);
83786           if (typeof callback === "function") {
83787             callback(err, result);
83788           }
83789           return;
83790         }
83791       };
83792     }
83793     context.loadTiles = (projection2, callback) => {
83794       const handle = window.requestIdleCallback(() => {
83795         _deferred2.delete(handle);
83796         if (_connection && context.editableDataEnabled()) {
83797           const cid = _connection.getConnectionId();
83798           _connection.loadTiles(projection2, afterLoad(cid, callback));
83799         }
83800       });
83801       _deferred2.add(handle);
83802     };
83803     context.loadTileAtLoc = (loc, callback) => {
83804       const handle = window.requestIdleCallback(() => {
83805         _deferred2.delete(handle);
83806         if (_connection && context.editableDataEnabled()) {
83807           const cid = _connection.getConnectionId();
83808           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
83809         }
83810       });
83811       _deferred2.add(handle);
83812     };
83813     context.loadEntity = (entityID, callback) => {
83814       if (_connection) {
83815         const cid = _connection.getConnectionId();
83816         _connection.loadEntity(entityID, afterLoad(cid, callback));
83817         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
83818       }
83819     };
83820     context.loadNote = (entityID, callback) => {
83821       if (_connection) {
83822         const cid = _connection.getConnectionId();
83823         _connection.loadEntityNote(entityID, afterLoad(cid, callback));
83824       }
83825     };
83826     context.zoomToEntity = (entityID, zoomTo) => {
83827       context.zoomToEntities([entityID], zoomTo);
83828     };
83829     context.zoomToEntities = (entityIDs, zoomTo) => {
83830       let loadedEntities = [];
83831       const throttledZoomTo = throttle_default(() => _map.zoomTo(loadedEntities), 500);
83832       entityIDs.forEach((entityID) => context.loadEntity(entityID, (err, result) => {
83833         if (err) return;
83834         const entity = result.data.find((e3) => e3.id === entityID);
83835         if (!entity) return;
83836         loadedEntities.push(entity);
83837         if (zoomTo !== false) {
83838           throttledZoomTo();
83839         }
83840       }));
83841       _map.on("drawn.zoomToEntity", () => {
83842         if (!entityIDs.every((entityID) => context.hasEntity(entityID))) return;
83843         _map.on("drawn.zoomToEntity", null);
83844         context.on("enter.zoomToEntity", null);
83845         context.enter(modeSelect(context, entityIDs));
83846       });
83847       context.on("enter.zoomToEntity", () => {
83848         if (_mode.id !== "browse") {
83849           _map.on("drawn.zoomToEntity", null);
83850           context.on("enter.zoomToEntity", null);
83851         }
83852       });
83853     };
83854     context.moveToNote = (noteId, moveTo) => {
83855       context.loadNote(noteId, (err, result) => {
83856         if (err) return;
83857         const entity = result.data.find((e3) => e3.id === noteId);
83858         if (!entity) return;
83859         const note = services.osm.getNote(noteId);
83860         if (moveTo !== false) {
83861           context.map().center(note.loc);
83862         }
83863         const noteLayer = context.layers().layer("notes");
83864         noteLayer.enabled(true);
83865         context.enter(modeSelectNote(context, noteId));
83866       });
83867     };
83868     let _minEditableZoom = 16;
83869     context.minEditableZoom = function(val) {
83870       if (!arguments.length) return _minEditableZoom;
83871       _minEditableZoom = val;
83872       if (_connection) {
83873         _connection.tileZoom(val);
83874       }
83875       return context;
83876     };
83877     context.maxCharsForTagKey = () => 255;
83878     context.maxCharsForTagValue = () => 255;
83879     context.maxCharsForRelationRole = () => 255;
83880     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
83881     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
83882     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
83883     let _inIntro = false;
83884     context.inIntro = function(val) {
83885       if (!arguments.length) return _inIntro;
83886       _inIntro = val;
83887       return context;
83888     };
83889     context.save = () => {
83890       if (_inIntro || context.container().select(".modal").size()) return;
83891       let canSave;
83892       if (_mode && _mode.id === "save") {
83893         canSave = false;
83894         if (services.osm && services.osm.isChangesetInflight()) {
83895           _history.clearSaved();
83896           return;
83897         }
83898       } else {
83899         canSave = context.selectedIDs().every((id2) => {
83900           const entity = context.hasEntity(id2);
83901           return entity && !entity.isDegenerate();
83902         });
83903       }
83904       if (canSave) {
83905         _history.save();
83906       }
83907       if (_history.hasChanges()) {
83908         return _t("save.unsaved_changes");
83909       }
83910     };
83911     context.debouncedSave = debounce_default(context.save, 350);
83912     function withDebouncedSave(fn) {
83913       return function() {
83914         const result = fn.apply(_history, arguments);
83915         context.debouncedSave();
83916         return result;
83917       };
83918     }
83919     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
83920     context.entity = (id2) => _history.graph().entity(id2);
83921     let _mode;
83922     context.mode = () => _mode;
83923     context.enter = (newMode) => {
83924       if (_mode) {
83925         _mode.exit();
83926         dispatch14.call("exit", this, _mode);
83927       }
83928       _mode = newMode;
83929       _mode.enter();
83930       dispatch14.call("enter", this, _mode);
83931     };
83932     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
83933     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
83934     let _selectedNoteID;
83935     context.selectedNoteID = function(noteID) {
83936       if (!arguments.length) return _selectedNoteID;
83937       _selectedNoteID = noteID;
83938       return context;
83939     };
83940     let _selectedErrorID;
83941     context.selectedErrorID = function(errorID) {
83942       if (!arguments.length) return _selectedErrorID;
83943       _selectedErrorID = errorID;
83944       return context;
83945     };
83946     context.install = (behavior) => context.surface().call(behavior);
83947     context.uninstall = (behavior) => context.surface().call(behavior.off);
83948     let _copyGraph;
83949     context.copyGraph = () => _copyGraph;
83950     let _copyIDs = [];
83951     context.copyIDs = function(val) {
83952       if (!arguments.length) return _copyIDs;
83953       _copyIDs = val;
83954       _copyGraph = _history.graph();
83955       return context;
83956     };
83957     let _copyLonLat;
83958     context.copyLonLat = function(val) {
83959       if (!arguments.length) return _copyLonLat;
83960       _copyLonLat = val;
83961       return context;
83962     };
83963     let _background;
83964     context.background = () => _background;
83965     let _features;
83966     context.features = () => _features;
83967     context.hasHiddenConnections = (id2) => {
83968       const graph = _history.graph();
83969       const entity = graph.entity(id2);
83970       return _features.hasHiddenConnections(entity, graph);
83971     };
83972     let _photos;
83973     context.photos = () => _photos;
83974     let _map;
83975     context.map = () => _map;
83976     context.layers = () => _map.layers();
83977     context.surface = () => _map.surface;
83978     context.editableDataEnabled = () => _map.editableDataEnabled();
83979     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
83980     context.editable = () => {
83981       const mode = context.mode();
83982       if (!mode || mode.id === "save") return false;
83983       return _map.editableDataEnabled();
83984     };
83985     let _debugFlags = {
83986       tile: false,
83987       // tile boundaries
83988       collision: false,
83989       // label collision bounding boxes
83990       imagery: false,
83991       // imagery bounding polygons
83992       target: false,
83993       // touch targets
83994       downloaded: false
83995       // downloaded data from osm
83996     };
83997     context.debugFlags = () => _debugFlags;
83998     context.getDebug = (flag) => flag && _debugFlags[flag];
83999     context.setDebug = function(flag, val) {
84000       if (arguments.length === 1) val = true;
84001       _debugFlags[flag] = val;
84002       dispatch14.call("change");
84003       return context;
84004     };
84005     let _container = select_default2(null);
84006     context.container = function(val) {
84007       if (!arguments.length) return _container;
84008       _container = val;
84009       _container.classed("ideditor", true);
84010       return context;
84011     };
84012     context.containerNode = function(val) {
84013       if (!arguments.length) return context.container().node();
84014       context.container(select_default2(val));
84015       return context;
84016     };
84017     let _embed;
84018     context.embed = function(val) {
84019       if (!arguments.length) return _embed;
84020       _embed = val;
84021       return context;
84022     };
84023     let _assetPath = "";
84024     context.assetPath = function(val) {
84025       if (!arguments.length) return _assetPath;
84026       _assetPath = val;
84027       _mainFileFetcher.assetPath(val);
84028       return context;
84029     };
84030     let _assetMap = {};
84031     context.assetMap = function(val) {
84032       if (!arguments.length) return _assetMap;
84033       _assetMap = val;
84034       _mainFileFetcher.assetMap(val);
84035       return context;
84036     };
84037     context.asset = (val) => {
84038       if (/^http(s)?:\/\//i.test(val)) return val;
84039       const filename = _assetPath + val;
84040       return _assetMap[filename] || filename;
84041     };
84042     context.imagePath = (val) => context.asset(`img/${val}`);
84043     context.reset = context.flush = () => {
84044       context.debouncedSave.cancel();
84045       Array.from(_deferred2).forEach((handle) => {
84046         window.cancelIdleCallback(handle);
84047         _deferred2.delete(handle);
84048       });
84049       Object.values(services).forEach((service) => {
84050         if (service && typeof service.reset === "function") {
84051           service.reset(context);
84052         }
84053       });
84054       context.changeset = null;
84055       _validator.reset();
84056       _features.reset();
84057       _history.reset();
84058       _uploader.reset();
84059       context.container().select(".inspector-wrap *").remove();
84060       return context;
84061     };
84062     context.projection = geoRawMercator();
84063     context.curtainProjection = geoRawMercator();
84064     context.init = () => {
84065       instantiateInternal();
84066       initializeDependents();
84067       return context;
84068       function instantiateInternal() {
84069         _history = coreHistory(context);
84070         context.graph = _history.graph;
84071         context.pauseChangeDispatch = _history.pauseChangeDispatch;
84072         context.resumeChangeDispatch = _history.resumeChangeDispatch;
84073         context.perform = withDebouncedSave(_history.perform);
84074         context.replace = withDebouncedSave(_history.replace);
84075         context.pop = withDebouncedSave(_history.pop);
84076         context.overwrite = withDebouncedSave(_history.overwrite);
84077         context.undo = withDebouncedSave(_history.undo);
84078         context.redo = withDebouncedSave(_history.redo);
84079         _validator = coreValidator(context);
84080         _uploader = coreUploader(context);
84081         _background = rendererBackground(context);
84082         _features = rendererFeatures(context);
84083         _map = rendererMap(context);
84084         _photos = rendererPhotos(context);
84085         _ui = uiInit(context);
84086       }
84087       function initializeDependents() {
84088         if (context.initialHashParams.presets) {
84089           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
84090         }
84091         if (context.initialHashParams.locale) {
84092           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
84093         }
84094         _mainLocalizer.ensureLoaded();
84095         _mainPresetIndex.ensureLoaded();
84096         _background.ensureLoaded();
84097         Object.values(services).forEach((service) => {
84098           if (service && typeof service.init === "function") {
84099             service.init();
84100           }
84101         });
84102         _map.init();
84103         _validator.init();
84104         _features.init();
84105         if (services.maprules && context.initialHashParams.maprules) {
84106           json_default(context.initialHashParams.maprules).then((mapcss) => {
84107             services.maprules.init();
84108             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
84109           }).catch(() => {
84110           });
84111         }
84112         if (!context.container().empty()) {
84113           _ui.ensureLoaded().then(() => {
84114             _background.init();
84115             _photos.init();
84116           });
84117         }
84118       }
84119     };
84120     return utilRebind(context, dispatch14, "on");
84121   }
84122   var init_context2 = __esm({
84123     "modules/core/context.js"() {
84124       "use strict";
84125       init_debounce();
84126       init_throttle();
84127       init_src4();
84128       init_src18();
84129       init_src5();
84130       init_package();
84131       init_localizer();
84132       init_file_fetcher();
84133       init_localizer();
84134       init_history();
84135       init_validator();
84136       init_uploader();
84137       init_raw_mercator();
84138       init_modes2();
84139       init_presets();
84140       init_renderer();
84141       init_services();
84142       init_init2();
84143       init_util();
84144     }
84145   });
84146
84147   // modules/core/index.js
84148   var core_exports = {};
84149   __export(core_exports, {
84150     LocationManager: () => LocationManager,
84151     coreContext: () => coreContext,
84152     coreDifference: () => coreDifference,
84153     coreFileFetcher: () => coreFileFetcher,
84154     coreGraph: () => coreGraph,
84155     coreHistory: () => coreHistory,
84156     coreLocalizer: () => coreLocalizer,
84157     coreTree: () => coreTree,
84158     coreUploader: () => coreUploader,
84159     coreValidator: () => coreValidator,
84160     fileFetcher: () => _mainFileFetcher,
84161     localizer: () => _mainLocalizer,
84162     locationManager: () => _sharedLocationManager,
84163     prefs: () => corePreferences,
84164     t: () => _t
84165   });
84166   var init_core = __esm({
84167     "modules/core/index.js"() {
84168       "use strict";
84169       init_context2();
84170       init_file_fetcher();
84171       init_difference();
84172       init_graph();
84173       init_history();
84174       init_localizer();
84175       init_LocationManager();
84176       init_preferences();
84177       init_tree();
84178       init_uploader();
84179       init_validator();
84180     }
84181   });
84182
84183   // modules/behavior/operation.js
84184   var operation_exports = {};
84185   __export(operation_exports, {
84186     behaviorOperation: () => behaviorOperation
84187   });
84188   function behaviorOperation(context) {
84189     var _operation;
84190     function keypress(d3_event) {
84191       var _a4;
84192       if (!context.map().withinEditableZoom()) return;
84193       if (((_a4 = _operation.availableForKeypress) == null ? void 0 : _a4.call(_operation)) === false) return;
84194       d3_event.preventDefault();
84195       if (!_operation.available()) {
84196         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_t.append("operations._unavailable", {
84197           operation: _t(`operations.${_operation.id}.title`) || _operation.id
84198         }))();
84199       } else if (_operation.disabled()) {
84200         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
84201       } else {
84202         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
84203         if (_operation.point) _operation.point(null);
84204         _operation(d3_event);
84205       }
84206     }
84207     function behavior() {
84208       if (_operation && _operation.available()) {
84209         behavior.on();
84210       }
84211       return behavior;
84212     }
84213     behavior.on = function() {
84214       context.keybinding().on(_operation.keys, keypress);
84215     };
84216     behavior.off = function() {
84217       context.keybinding().off(_operation.keys);
84218     };
84219     behavior.which = function(_3) {
84220       if (!arguments.length) return _operation;
84221       _operation = _3;
84222       return behavior;
84223     };
84224     return behavior;
84225   }
84226   var init_operation = __esm({
84227     "modules/behavior/operation.js"() {
84228       "use strict";
84229       init_core();
84230     }
84231   });
84232
84233   // modules/operations/circularize.js
84234   var circularize_exports2 = {};
84235   __export(circularize_exports2, {
84236     operationCircularize: () => operationCircularize
84237   });
84238   function operationCircularize(context, selectedIDs) {
84239     var _extent;
84240     var _actions = selectedIDs.map(getAction).filter(Boolean);
84241     var _amount = _actions.length === 1 ? "single" : "multiple";
84242     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
84243       return n3.loc;
84244     });
84245     function getAction(entityID) {
84246       var entity = context.entity(entityID);
84247       if (entity.type !== "way" || new Set(entity.nodes).size <= 1) return null;
84248       if (!_extent) {
84249         _extent = entity.extent(context.graph());
84250       } else {
84251         _extent = _extent.extend(entity.extent(context.graph()));
84252       }
84253       return actionCircularize(entityID, context.projection);
84254     }
84255     var operation2 = function() {
84256       if (!_actions.length) return;
84257       var combinedAction = function(graph, t2) {
84258         _actions.forEach(function(action) {
84259           if (!action.disabled(graph)) {
84260             graph = action(graph, t2);
84261           }
84262         });
84263         return graph;
84264       };
84265       combinedAction.transitionable = true;
84266       context.perform(combinedAction, operation2.annotation());
84267       window.setTimeout(function() {
84268         context.validator().validate();
84269       }, 300);
84270     };
84271     operation2.available = function() {
84272       return _actions.length && selectedIDs.length === _actions.length;
84273     };
84274     operation2.disabled = function() {
84275       if (!_actions.length) return "";
84276       var actionDisableds = _actions.map(function(action) {
84277         return action.disabled(context.graph());
84278       }).filter(Boolean);
84279       if (actionDisableds.length === _actions.length) {
84280         if (new Set(actionDisableds).size > 1) {
84281           return "multiple_blockers";
84282         }
84283         return actionDisableds[0];
84284       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
84285         return "too_large";
84286       } else if (someMissing()) {
84287         return "not_downloaded";
84288       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84289         return "connected_to_hidden";
84290       }
84291       return false;
84292       function someMissing() {
84293         if (context.inIntro()) return false;
84294         var osm = context.connection();
84295         if (osm) {
84296           var missing = _coords.filter(function(loc) {
84297             return !osm.isDataLoaded(loc);
84298           });
84299           if (missing.length) {
84300             missing.forEach(function(loc) {
84301               context.loadTileAtLoc(loc);
84302             });
84303             return true;
84304           }
84305         }
84306         return false;
84307       }
84308     };
84309     operation2.tooltip = function() {
84310       var disable = operation2.disabled();
84311       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
84312     };
84313     operation2.annotation = function() {
84314       return _t("operations.circularize.annotation.feature", { n: _actions.length });
84315     };
84316     operation2.id = "circularize";
84317     operation2.keys = [_t("operations.circularize.key")];
84318     operation2.title = _t.append("operations.circularize.title");
84319     operation2.behavior = behaviorOperation(context).which(operation2);
84320     return operation2;
84321   }
84322   var init_circularize2 = __esm({
84323     "modules/operations/circularize.js"() {
84324       "use strict";
84325       init_localizer();
84326       init_circularize();
84327       init_operation();
84328       init_util();
84329     }
84330   });
84331
84332   // modules/operations/rotate.js
84333   var rotate_exports3 = {};
84334   __export(rotate_exports3, {
84335     operationRotate: () => operationRotate
84336   });
84337   function operationRotate(context, selectedIDs) {
84338     var multi = selectedIDs.length === 1 ? "single" : "multiple";
84339     var nodes = utilGetAllNodes(selectedIDs, context.graph());
84340     var coords = nodes.map(function(n3) {
84341       return n3.loc;
84342     });
84343     var extent = utilTotalExtent(selectedIDs, context.graph());
84344     var operation2 = function() {
84345       context.enter(modeRotate(context, selectedIDs));
84346     };
84347     operation2.available = function() {
84348       return nodes.length >= 2;
84349     };
84350     operation2.disabled = function() {
84351       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
84352         return "too_large";
84353       } else if (someMissing()) {
84354         return "not_downloaded";
84355       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84356         return "connected_to_hidden";
84357       } else if (selectedIDs.some(incompleteRelation)) {
84358         return "incomplete_relation";
84359       }
84360       return false;
84361       function someMissing() {
84362         if (context.inIntro()) return false;
84363         var osm = context.connection();
84364         if (osm) {
84365           var missing = coords.filter(function(loc) {
84366             return !osm.isDataLoaded(loc);
84367           });
84368           if (missing.length) {
84369             missing.forEach(function(loc) {
84370               context.loadTileAtLoc(loc);
84371             });
84372             return true;
84373           }
84374         }
84375         return false;
84376       }
84377       function incompleteRelation(id2) {
84378         var entity = context.entity(id2);
84379         return entity.type === "relation" && !entity.isComplete(context.graph());
84380       }
84381     };
84382     operation2.tooltip = function() {
84383       var disable = operation2.disabled();
84384       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
84385     };
84386     operation2.annotation = function() {
84387       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
84388     };
84389     operation2.id = "rotate";
84390     operation2.keys = [_t("operations.rotate.key")];
84391     operation2.title = _t.append("operations.rotate.title");
84392     operation2.behavior = behaviorOperation(context).which(operation2);
84393     operation2.mouseOnly = true;
84394     return operation2;
84395   }
84396   var init_rotate3 = __esm({
84397     "modules/operations/rotate.js"() {
84398       "use strict";
84399       init_localizer();
84400       init_operation();
84401       init_rotate2();
84402       init_util2();
84403     }
84404   });
84405
84406   // modules/modes/move.js
84407   var move_exports3 = {};
84408   __export(move_exports3, {
84409     modeMove: () => modeMove
84410   });
84411   function modeMove(context, entityIDs, baseGraph) {
84412     var _tolerancePx = 4;
84413     var mode = {
84414       id: "move",
84415       button: "browse"
84416     };
84417     var keybinding = utilKeybinding("move");
84418     var behaviors = [
84419       behaviorEdit(context),
84420       operationCircularize(context, entityIDs).behavior,
84421       operationDelete(context, entityIDs).behavior,
84422       operationOrthogonalize(context, entityIDs).behavior,
84423       operationReflectLong(context, entityIDs).behavior,
84424       operationReflectShort(context, entityIDs).behavior,
84425       operationRotate(context, entityIDs).behavior
84426     ];
84427     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
84428     var _prevGraph;
84429     var _cache5;
84430     var _prevMouse;
84431     var _nudgeInterval;
84432     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
84433     function doMove(nudge) {
84434       nudge = nudge || [0, 0];
84435       let fn;
84436       if (_prevGraph !== context.graph()) {
84437         _cache5 = {};
84438         _prevMouse = context.map().mouse();
84439         fn = context.perform;
84440       } else {
84441         fn = context.overwrite;
84442       }
84443       const currMouse = context.map().mouse();
84444       const delta = geoVecSubtract(geoVecSubtract(currMouse, _prevMouse), nudge);
84445       _prevMouse = currMouse;
84446       fn(actionMove(entityIDs, delta, context.projection, _cache5));
84447       _prevGraph = context.graph();
84448     }
84449     function startNudge(nudge) {
84450       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
84451       _nudgeInterval = window.setInterval(function() {
84452         context.map().pan(nudge);
84453         doMove(nudge);
84454       }, 50);
84455     }
84456     function stopNudge() {
84457       if (_nudgeInterval) {
84458         window.clearInterval(_nudgeInterval);
84459         _nudgeInterval = null;
84460       }
84461     }
84462     function move() {
84463       doMove();
84464       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
84465       if (nudge) {
84466         startNudge(nudge);
84467       } else {
84468         stopNudge();
84469       }
84470     }
84471     function finish(d3_event) {
84472       d3_event.stopPropagation();
84473       context.replace(actionNoop(), annotation);
84474       context.enter(modeSelect(context, entityIDs));
84475       stopNudge();
84476     }
84477     function cancel() {
84478       if (baseGraph) {
84479         while (context.graph() !== baseGraph) context.pop();
84480         context.enter(modeBrowse(context));
84481       } else {
84482         if (_prevGraph) context.pop();
84483         context.enter(modeSelect(context, entityIDs));
84484       }
84485       stopNudge();
84486     }
84487     function undone() {
84488       context.enter(modeBrowse(context));
84489     }
84490     mode.enter = function() {
84491       _prevMouse = context.map().mouse();
84492       _prevGraph = null;
84493       _cache5 = {};
84494       context.features().forceVisible(entityIDs);
84495       behaviors.forEach(context.install);
84496       var downEvent;
84497       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
84498         downEvent = d3_event;
84499       });
84500       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
84501         if (!downEvent) return;
84502         var mapNode = context.container().select(".main-map").node();
84503         var pointGetter = utilFastMouse(mapNode);
84504         var p1 = pointGetter(downEvent);
84505         var p2 = pointGetter(d3_event);
84506         var dist = geoVecLength(p1, p2);
84507         if (dist <= _tolerancePx) finish(d3_event);
84508         downEvent = null;
84509       }, true);
84510       context.history().on("undone.modeMove", undone);
84511       keybinding.on("\u238B", cancel).on("\u21A9", finish);
84512       select_default2(document).call(keybinding);
84513     };
84514     mode.exit = function() {
84515       stopNudge();
84516       behaviors.forEach(function(behavior) {
84517         context.uninstall(behavior);
84518       });
84519       context.surface().on(_pointerPrefix + "down.modeMove", null);
84520       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
84521       context.history().on("undone.modeMove", null);
84522       select_default2(document).call(keybinding.unbind);
84523       context.features().forceVisible([]);
84524     };
84525     mode.selectedIDs = function() {
84526       if (!arguments.length) return entityIDs;
84527       return mode;
84528     };
84529     return mode;
84530   }
84531   var init_move3 = __esm({
84532     "modules/modes/move.js"() {
84533       "use strict";
84534       init_src5();
84535       init_localizer();
84536       init_move();
84537       init_noop2();
84538       init_edit();
84539       init_vector();
84540       init_geom();
84541       init_browse();
84542       init_select5();
84543       init_util();
84544       init_util2();
84545       init_circularize2();
84546       init_delete();
84547       init_orthogonalize2();
84548       init_reflect2();
84549       init_rotate3();
84550     }
84551   });
84552
84553   // modules/behavior/paste.js
84554   var paste_exports = {};
84555   __export(paste_exports, {
84556     behaviorPaste: () => behaviorPaste
84557   });
84558   function behaviorPaste(context) {
84559     function doPaste(d3_event) {
84560       if (!context.map().withinEditableZoom()) return;
84561       const isOsmLayerEnabled = context.layers().layer("osm").enabled();
84562       if (!isOsmLayerEnabled) return;
84563       d3_event.preventDefault();
84564       var baseGraph = context.graph();
84565       var mouse = context.map().mouse();
84566       var projection2 = context.projection;
84567       var viewport = geoExtent(projection2.clipExtent()).polygon();
84568       if (!geoPointInPolygon(mouse, viewport)) return;
84569       var oldIDs = context.copyIDs();
84570       if (!oldIDs.length) return;
84571       var extent = geoExtent();
84572       var oldGraph = context.copyGraph();
84573       var newIDs = [];
84574       var action = actionCopyEntities(oldIDs, oldGraph);
84575       context.perform(action);
84576       var copies = action.copies();
84577       var originals = /* @__PURE__ */ new Set();
84578       Object.values(copies).forEach(function(entity) {
84579         originals.add(entity.id);
84580       });
84581       for (var id2 in copies) {
84582         var oldEntity = oldGraph.entity(id2);
84583         var newEntity = copies[id2];
84584         extent._extend(oldEntity.extent(oldGraph));
84585         var parents = context.graph().parentWays(newEntity);
84586         var parentCopied = parents.some(function(parent2) {
84587           return originals.has(parent2.id);
84588         });
84589         if (!parentCopied) {
84590           newIDs.push(newEntity.id);
84591         }
84592       }
84593       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
84594       var delta = geoVecSubtract(mouse, copyPoint);
84595       context.perform(actionMove(newIDs, delta, projection2));
84596       context.enter(modeMove(context, newIDs, baseGraph));
84597     }
84598     function behavior() {
84599       context.keybinding().on(uiCmd("\u2318V"), doPaste);
84600       return behavior;
84601     }
84602     behavior.off = function() {
84603       context.keybinding().off(uiCmd("\u2318V"));
84604     };
84605     return behavior;
84606   }
84607   var init_paste = __esm({
84608     "modules/behavior/paste.js"() {
84609       "use strict";
84610       init_copy_entities();
84611       init_move();
84612       init_geo2();
84613       init_move3();
84614       init_cmd();
84615     }
84616   });
84617
84618   // modules/operations/continue.js
84619   var continue_exports = {};
84620   __export(continue_exports, {
84621     operationContinue: () => operationContinue
84622   });
84623   function operationContinue(context, selectedIDs) {
84624     var _entities = selectedIDs.map(function(id2) {
84625       return context.graph().entity(id2);
84626     });
84627     var _geometries = Object.assign(
84628       { line: [], vertex: [] },
84629       utilArrayGroupBy(_entities, function(entity) {
84630         return entity.geometry(context.graph());
84631       })
84632     );
84633     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
84634     function candidateWays() {
84635       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent2) {
84636         const geom = parent2.geometry(context.graph());
84637         return (geom === "line" || geom === "area") && !parent2.isClosed() && parent2.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent2);
84638       }) : [];
84639     }
84640     var _candidates = candidateWays();
84641     var operation2 = function() {
84642       var candidate = _candidates[0];
84643       const tagsToRemove = /* @__PURE__ */ new Set();
84644       if (_vertex.tags.fixme === "continue") tagsToRemove.add("fixme");
84645       if (_vertex.tags.noexit === "yes") tagsToRemove.add("noexit");
84646       if (tagsToRemove.size) {
84647         context.perform((graph) => {
84648           const newTags = { ..._vertex.tags };
84649           for (const key of tagsToRemove) {
84650             delete newTags[key];
84651           }
84652           return actionChangeTags(_vertex.id, newTags)(graph);
84653         }, operation2.annotation());
84654       }
84655       context.enter(
84656         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
84657       );
84658     };
84659     operation2.relatedEntityIds = function() {
84660       return _candidates.length ? [_candidates[0].id] : [];
84661     };
84662     operation2.available = function() {
84663       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
84664     };
84665     operation2.disabled = function() {
84666       if (_candidates.length === 0) {
84667         return "not_eligible";
84668       } else if (_candidates.length > 1) {
84669         return "multiple";
84670       }
84671       return false;
84672     };
84673     operation2.tooltip = function() {
84674       var disable = operation2.disabled();
84675       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
84676     };
84677     operation2.annotation = function() {
84678       return _t("operations.continue.annotation.line");
84679     };
84680     operation2.id = "continue";
84681     operation2.keys = [_t("operations.continue.key")];
84682     operation2.title = _t.append("operations.continue.title");
84683     operation2.behavior = behaviorOperation(context).which(operation2);
84684     return operation2;
84685   }
84686   var init_continue = __esm({
84687     "modules/operations/continue.js"() {
84688       "use strict";
84689       init_localizer();
84690       init_draw_line();
84691       init_operation();
84692       init_util();
84693       init_actions();
84694     }
84695   });
84696
84697   // modules/operations/copy.js
84698   var copy_exports = {};
84699   __export(copy_exports, {
84700     operationCopy: () => operationCopy
84701   });
84702   function operationCopy(context, selectedIDs) {
84703     function getFilteredIdsToCopy() {
84704       return selectedIDs.filter(function(selectedID) {
84705         var entity = context.graph().hasEntity(selectedID);
84706         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
84707       });
84708     }
84709     var operation2 = function() {
84710       var graph = context.graph();
84711       var selected = groupEntities(getFilteredIdsToCopy(), graph);
84712       var canCopy = [];
84713       var skip = {};
84714       var entity;
84715       var i3;
84716       for (i3 = 0; i3 < selected.relation.length; i3++) {
84717         entity = selected.relation[i3];
84718         if (!skip[entity.id] && entity.isComplete(graph)) {
84719           canCopy.push(entity.id);
84720           skip = getDescendants(entity.id, graph, skip);
84721         }
84722       }
84723       for (i3 = 0; i3 < selected.way.length; i3++) {
84724         entity = selected.way[i3];
84725         if (!skip[entity.id]) {
84726           canCopy.push(entity.id);
84727           skip = getDescendants(entity.id, graph, skip);
84728         }
84729       }
84730       for (i3 = 0; i3 < selected.node.length; i3++) {
84731         entity = selected.node[i3];
84732         if (!skip[entity.id]) {
84733           canCopy.push(entity.id);
84734         }
84735       }
84736       context.copyIDs(canCopy);
84737       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
84738         context.copyLonLat(context.projection.invert(_point));
84739       } else {
84740         context.copyLonLat(null);
84741       }
84742     };
84743     function groupEntities(ids, graph) {
84744       var entities = ids.map(function(id2) {
84745         return graph.entity(id2);
84746       });
84747       return Object.assign(
84748         { relation: [], way: [], node: [] },
84749         utilArrayGroupBy(entities, "type")
84750       );
84751     }
84752     function getDescendants(id2, graph, descendants) {
84753       var entity = graph.entity(id2);
84754       var children2;
84755       descendants = descendants || {};
84756       if (entity.type === "relation") {
84757         children2 = entity.members.map(function(m3) {
84758           return m3.id;
84759         });
84760       } else if (entity.type === "way") {
84761         children2 = entity.nodes;
84762       } else {
84763         children2 = [];
84764       }
84765       for (var i3 = 0; i3 < children2.length; i3++) {
84766         if (!descendants[children2[i3]]) {
84767           descendants[children2[i3]] = true;
84768           descendants = getDescendants(children2[i3], graph, descendants);
84769         }
84770       }
84771       return descendants;
84772     }
84773     operation2.available = function() {
84774       return getFilteredIdsToCopy().length > 0;
84775     };
84776     operation2.disabled = function() {
84777       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
84778       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
84779         return "too_large";
84780       }
84781       return false;
84782     };
84783     operation2.availableForKeypress = function() {
84784       var _a4;
84785       const selection2 = (_a4 = window.getSelection) == null ? void 0 : _a4.call(window);
84786       return !(selection2 == null ? void 0 : selection2.toString());
84787     };
84788     operation2.tooltip = function() {
84789       var disable = operation2.disabled();
84790       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
84791     };
84792     operation2.annotation = function() {
84793       return _t("operations.copy.annotation", { n: selectedIDs.length });
84794     };
84795     var _point;
84796     operation2.point = function(val) {
84797       _point = val;
84798       return operation2;
84799     };
84800     operation2.id = "copy";
84801     operation2.keys = [uiCmd("\u2318C")];
84802     operation2.title = _t.append("operations.copy.title");
84803     operation2.behavior = behaviorOperation(context).which(operation2);
84804     return operation2;
84805   }
84806   var init_copy = __esm({
84807     "modules/operations/copy.js"() {
84808       "use strict";
84809       init_localizer();
84810       init_operation();
84811       init_cmd();
84812       init_util();
84813     }
84814   });
84815
84816   // modules/operations/disconnect.js
84817   var disconnect_exports2 = {};
84818   __export(disconnect_exports2, {
84819     operationDisconnect: () => operationDisconnect
84820   });
84821   function operationDisconnect(context, selectedIDs) {
84822     var _vertexIDs = [];
84823     var _wayIDs = [];
84824     var _otherIDs = [];
84825     var _actions = [];
84826     selectedIDs.forEach(function(id2) {
84827       var entity = context.entity(id2);
84828       if (entity.type === "way") {
84829         _wayIDs.push(id2);
84830       } else if (entity.geometry(context.graph()) === "vertex") {
84831         _vertexIDs.push(id2);
84832       } else {
84833         _otherIDs.push(id2);
84834       }
84835     });
84836     var _coords, _descriptionID = "", _annotationID = "features";
84837     var _disconnectingVertexIds = [];
84838     var _disconnectingWayIds = [];
84839     if (_vertexIDs.length > 0) {
84840       _disconnectingVertexIds = _vertexIDs;
84841       _vertexIDs.forEach(function(vertexID) {
84842         var action = actionDisconnect(vertexID);
84843         if (_wayIDs.length > 0) {
84844           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
84845             var way = context.entity(wayID);
84846             return way.nodes.indexOf(vertexID) !== -1;
84847           });
84848           action.limitWays(waysIDsForVertex);
84849         }
84850         _actions.push(action);
84851         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
84852       });
84853       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
84854         return _wayIDs.indexOf(id2) === -1;
84855       });
84856       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
84857       if (_wayIDs.length === 1) {
84858         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
84859       } else {
84860         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
84861       }
84862     } else if (_wayIDs.length > 0) {
84863       var ways = _wayIDs.map(function(id2) {
84864         return context.entity(id2);
84865       });
84866       var nodes = utilGetAllNodes(_wayIDs, context.graph());
84867       _coords = nodes.map(function(n3) {
84868         return n3.loc;
84869       });
84870       var sharedActions = [];
84871       var sharedNodes = [];
84872       var unsharedActions = [];
84873       var unsharedNodes = [];
84874       nodes.forEach(function(node) {
84875         var action = actionDisconnect(node.id).limitWays(_wayIDs);
84876         if (action.disabled(context.graph()) !== "not_connected") {
84877           var count = 0;
84878           for (var i3 in ways) {
84879             var way = ways[i3];
84880             if (way.nodes.indexOf(node.id) !== -1) {
84881               count += 1;
84882             }
84883             if (count > 1) break;
84884           }
84885           if (count > 1) {
84886             sharedActions.push(action);
84887             sharedNodes.push(node);
84888           } else {
84889             unsharedActions.push(action);
84890             unsharedNodes.push(node);
84891           }
84892         }
84893       });
84894       _descriptionID += "no_points.";
84895       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
84896       if (sharedActions.length) {
84897         _actions = sharedActions;
84898         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
84899         _descriptionID += "conjoined";
84900         _annotationID = "from_each_other";
84901       } else {
84902         _actions = unsharedActions;
84903         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
84904         if (_wayIDs.length === 1) {
84905           _descriptionID += context.graph().geometry(_wayIDs[0]);
84906         } else {
84907           _descriptionID += "separate";
84908         }
84909       }
84910     }
84911     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
84912     var operation2 = function() {
84913       context.perform(function(graph) {
84914         return _actions.reduce(function(graph2, action) {
84915           return action(graph2);
84916         }, graph);
84917       }, operation2.annotation());
84918       context.validator().validate();
84919     };
84920     operation2.relatedEntityIds = function() {
84921       if (_vertexIDs.length) {
84922         return _disconnectingWayIds;
84923       }
84924       return _disconnectingVertexIds;
84925     };
84926     operation2.available = function() {
84927       if (_actions.length === 0) return false;
84928       if (_otherIDs.length !== 0) return false;
84929       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
84930         return _vertexIDs.some(function(vertexID) {
84931           var way = context.entity(wayID);
84932           return way.nodes.indexOf(vertexID) !== -1;
84933         });
84934       })) return false;
84935       return true;
84936     };
84937     operation2.disabled = function() {
84938       var reason;
84939       for (var actionIndex in _actions) {
84940         reason = _actions[actionIndex].disabled(context.graph());
84941         if (reason) return reason;
84942       }
84943       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
84944         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
84945       } else if (_coords && someMissing()) {
84946         return "not_downloaded";
84947       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84948         return "connected_to_hidden";
84949       }
84950       return false;
84951       function someMissing() {
84952         if (context.inIntro()) return false;
84953         var osm = context.connection();
84954         if (osm) {
84955           var missing = _coords.filter(function(loc) {
84956             return !osm.isDataLoaded(loc);
84957           });
84958           if (missing.length) {
84959             missing.forEach(function(loc) {
84960               context.loadTileAtLoc(loc);
84961             });
84962             return true;
84963           }
84964         }
84965         return false;
84966       }
84967     };
84968     operation2.tooltip = function() {
84969       var disable = operation2.disabled();
84970       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
84971     };
84972     operation2.annotation = function() {
84973       return _t("operations.disconnect.annotation." + _annotationID);
84974     };
84975     operation2.id = "disconnect";
84976     operation2.keys = [_t("operations.disconnect.key")];
84977     operation2.title = _t.append("operations.disconnect.title");
84978     operation2.behavior = behaviorOperation(context).which(operation2);
84979     return operation2;
84980   }
84981   var init_disconnect2 = __esm({
84982     "modules/operations/disconnect.js"() {
84983       "use strict";
84984       init_localizer();
84985       init_disconnect();
84986       init_operation();
84987       init_array3();
84988       init_util2();
84989     }
84990   });
84991
84992   // modules/operations/downgrade.js
84993   var downgrade_exports = {};
84994   __export(downgrade_exports, {
84995     operationDowngrade: () => operationDowngrade
84996   });
84997   function operationDowngrade(context, selectedIDs) {
84998     var _affectedFeatureCount = 0;
84999     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
85000     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
85001     function downgradeTypeForEntityIDs(entityIds) {
85002       var downgradeType;
85003       _affectedFeatureCount = 0;
85004       for (var i3 in entityIds) {
85005         var entityID = entityIds[i3];
85006         var type2 = downgradeTypeForEntityID(entityID);
85007         if (type2) {
85008           _affectedFeatureCount += 1;
85009           if (downgradeType && type2 !== downgradeType) {
85010             if (downgradeType !== "generic" && type2 !== "generic") {
85011               downgradeType = "building_address";
85012             } else {
85013               downgradeType = "generic";
85014             }
85015           } else {
85016             downgradeType = type2;
85017           }
85018         }
85019       }
85020       return downgradeType;
85021     }
85022     function downgradeTypeForEntityID(entityID) {
85023       var graph = context.graph();
85024       var entity = graph.entity(entityID);
85025       var preset = _mainPresetIndex.match(entity, graph);
85026       if (!preset || preset.isFallback()) return null;
85027       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
85028         return key.match(/^addr:.{1,}/);
85029       })) {
85030         return "address";
85031       }
85032       var geometry = entity.geometry(graph);
85033       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
85034         return "building";
85035       }
85036       if (geometry === "vertex" && Object.keys(entity.tags).length) {
85037         return "generic";
85038       }
85039       return null;
85040     }
85041     var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
85042     var addressKeysToKeep = ["source"];
85043     var operation2 = function() {
85044       context.perform(function(graph) {
85045         for (var i3 in selectedIDs) {
85046           var entityID = selectedIDs[i3];
85047           var type2 = downgradeTypeForEntityID(entityID);
85048           if (!type2) continue;
85049           var tags = Object.assign({}, graph.entity(entityID).tags);
85050           for (var key in tags) {
85051             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1) continue;
85052             if (type2 === "building") {
85053               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
85054             }
85055             if (type2 !== "generic") {
85056               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/)) continue;
85057             }
85058             delete tags[key];
85059           }
85060           graph = actionChangeTags(entityID, tags)(graph);
85061         }
85062         return graph;
85063       }, operation2.annotation());
85064       context.validator().validate();
85065       context.enter(modeSelect(context, selectedIDs));
85066     };
85067     operation2.available = function() {
85068       return _downgradeType;
85069     };
85070     operation2.disabled = function() {
85071       if (selectedIDs.some(hasWikidataTag)) {
85072         return "has_wikidata_tag";
85073       }
85074       return false;
85075       function hasWikidataTag(id2) {
85076         var entity = context.entity(id2);
85077         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
85078       }
85079     };
85080     operation2.tooltip = function() {
85081       var disable = operation2.disabled();
85082       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
85083     };
85084     operation2.annotation = function() {
85085       var suffix;
85086       if (_downgradeType === "building_address") {
85087         suffix = "generic";
85088       } else {
85089         suffix = _downgradeType;
85090       }
85091       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
85092     };
85093     operation2.id = "downgrade";
85094     operation2.keys = [uiCmd("\u232B")];
85095     operation2.title = _t.append("operations.downgrade.title");
85096     operation2.behavior = behaviorOperation(context).which(operation2);
85097     return operation2;
85098   }
85099   var init_downgrade = __esm({
85100     "modules/operations/downgrade.js"() {
85101       "use strict";
85102       init_change_tags();
85103       init_operation();
85104       init_select5();
85105       init_localizer();
85106       init_cmd();
85107       init_presets();
85108     }
85109   });
85110
85111   // modules/operations/extract.js
85112   var extract_exports2 = {};
85113   __export(extract_exports2, {
85114     operationExtract: () => operationExtract
85115   });
85116   function operationExtract(context, selectedIDs) {
85117     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
85118     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
85119       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
85120     }).filter(Boolean));
85121     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
85122     var _extent;
85123     var _actions = selectedIDs.map(function(entityID) {
85124       var graph = context.graph();
85125       var entity = graph.hasEntity(entityID);
85126       if (!entity || !entity.hasInterestingTags()) return null;
85127       if (entity.type === "node" && graph.parentWays(entity).length === 0) return null;
85128       if (entity.type !== "node") {
85129         var preset = _mainPresetIndex.match(entity, graph);
85130         if (preset.geometry.indexOf("point") === -1) return null;
85131       }
85132       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
85133       return actionExtract(entityID, context.projection);
85134     }).filter(Boolean);
85135     var operation2 = function(d3_event) {
85136       const shiftKeyPressed = (d3_event == null ? void 0 : d3_event.shiftKey) || false;
85137       var combinedAction = function(graph) {
85138         _actions.forEach(function(action) {
85139           graph = action(graph, shiftKeyPressed);
85140         });
85141         return graph;
85142       };
85143       context.perform(combinedAction, operation2.annotation());
85144       var extractedNodeIDs = _actions.map(function(action) {
85145         return action.getExtractedNodeID();
85146       });
85147       context.enter(modeSelect(context, extractedNodeIDs));
85148     };
85149     operation2.available = function() {
85150       return _actions.length && selectedIDs.length === _actions.length;
85151     };
85152     operation2.disabled = function() {
85153       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
85154         return "too_large";
85155       } else if (selectedIDs.some(function(entityID) {
85156         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
85157       })) {
85158         return "connected_to_hidden";
85159       }
85160       return false;
85161     };
85162     operation2.tooltip = function() {
85163       var disableReason = operation2.disabled();
85164       if (disableReason) {
85165         return _t.append("operations.extract." + disableReason + "." + _amount);
85166       } else {
85167         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
85168       }
85169     };
85170     operation2.annotation = function() {
85171       return _t("operations.extract.annotation", { n: selectedIDs.length });
85172     };
85173     operation2.id = "extract";
85174     operation2.keys = [_t("operations.extract.key")];
85175     operation2.title = _t.append("operations.extract.title");
85176     operation2.behavior = behaviorOperation(context).which(operation2);
85177     return operation2;
85178   }
85179   var init_extract2 = __esm({
85180     "modules/operations/extract.js"() {
85181       "use strict";
85182       init_extract();
85183       init_operation();
85184       init_select5();
85185       init_localizer();
85186       init_presets();
85187       init_array3();
85188     }
85189   });
85190
85191   // modules/operations/merge.js
85192   var merge_exports2 = {};
85193   __export(merge_exports2, {
85194     operationMerge: () => operationMerge
85195   });
85196   function operationMerge(context, selectedIDs) {
85197     var _action = getAction();
85198     function getAction() {
85199       var join = actionJoin(selectedIDs);
85200       if (!join.disabled(context.graph())) return join;
85201       var merge3 = actionMerge(selectedIDs);
85202       if (!merge3.disabled(context.graph())) return merge3;
85203       var mergePolygon = actionMergePolygon(selectedIDs);
85204       if (!mergePolygon.disabled(context.graph())) return mergePolygon;
85205       var mergeNodes = actionMergeNodes(selectedIDs);
85206       if (!mergeNodes.disabled(context.graph())) return mergeNodes;
85207       if (join.disabled(context.graph()) !== "not_eligible") return join;
85208       if (merge3.disabled(context.graph()) !== "not_eligible") return merge3;
85209       if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon;
85210       return mergeNodes;
85211     }
85212     var operation2 = function() {
85213       if (operation2.disabled()) return;
85214       context.perform(_action, operation2.annotation());
85215       context.validator().validate();
85216       var resultIDs = selectedIDs.filter(context.hasEntity);
85217       if (resultIDs.length > 1) {
85218         var interestingIDs = resultIDs.filter(function(id2) {
85219           return context.entity(id2).hasInterestingTags();
85220         });
85221         if (interestingIDs.length) resultIDs = interestingIDs;
85222       }
85223       context.enter(modeSelect(context, resultIDs));
85224     };
85225     operation2.available = function() {
85226       return selectedIDs.length >= 2;
85227     };
85228     operation2.disabled = function() {
85229       var actionDisabled = _action.disabled(context.graph());
85230       if (actionDisabled) return actionDisabled;
85231       var osm = context.connection();
85232       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
85233         return "too_many_vertices";
85234       }
85235       return false;
85236     };
85237     operation2.tooltip = function() {
85238       var disabled = operation2.disabled();
85239       if (disabled) {
85240         if (disabled === "conflicting_relations") {
85241           return _t.append("operations.merge.conflicting_relations");
85242         }
85243         if (disabled === "restriction" || disabled === "connectivity") {
85244           return _t.append(
85245             "operations.merge.damage_relation",
85246             { relation: _mainPresetIndex.item("type/" + disabled).name() }
85247           );
85248         }
85249         return _t.append("operations.merge." + disabled);
85250       }
85251       return _t.append("operations.merge.description");
85252     };
85253     operation2.annotation = function() {
85254       return _t("operations.merge.annotation", { n: selectedIDs.length });
85255     };
85256     operation2.id = "merge";
85257     operation2.keys = [_t("operations.merge.key")];
85258     operation2.title = _t.append("operations.merge.title");
85259     operation2.behavior = behaviorOperation(context).which(operation2);
85260     return operation2;
85261   }
85262   var init_merge6 = __esm({
85263     "modules/operations/merge.js"() {
85264       "use strict";
85265       init_localizer();
85266       init_join2();
85267       init_merge5();
85268       init_merge_nodes();
85269       init_merge_polygon();
85270       init_operation();
85271       init_select5();
85272       init_presets();
85273     }
85274   });
85275
85276   // modules/operations/paste.js
85277   var paste_exports2 = {};
85278   __export(paste_exports2, {
85279     operationPaste: () => operationPaste
85280   });
85281   function operationPaste(context) {
85282     var _pastePoint;
85283     var operation2 = function() {
85284       if (!_pastePoint) return;
85285       var oldIDs = context.copyIDs();
85286       if (!oldIDs.length) return;
85287       var projection2 = context.projection;
85288       var extent = geoExtent();
85289       var oldGraph = context.copyGraph();
85290       var newIDs = [];
85291       var action = actionCopyEntities(oldIDs, oldGraph);
85292       context.perform(action);
85293       var copies = action.copies();
85294       var originals = /* @__PURE__ */ new Set();
85295       Object.values(copies).forEach(function(entity) {
85296         originals.add(entity.id);
85297       });
85298       for (var id2 in copies) {
85299         var oldEntity = oldGraph.entity(id2);
85300         var newEntity = copies[id2];
85301         extent._extend(oldEntity.extent(oldGraph));
85302         var parents = context.graph().parentWays(newEntity);
85303         var parentCopied = parents.some(function(parent2) {
85304           return originals.has(parent2.id);
85305         });
85306         if (!parentCopied) {
85307           newIDs.push(newEntity.id);
85308         }
85309       }
85310       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
85311       var delta = geoVecSubtract(_pastePoint, copyPoint);
85312       context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
85313       context.enter(modeSelect(context, newIDs));
85314     };
85315     operation2.point = function(val) {
85316       _pastePoint = val;
85317       return operation2;
85318     };
85319     operation2.available = function() {
85320       return context.mode().id === "browse";
85321     };
85322     operation2.disabled = function() {
85323       return !context.copyIDs().length;
85324     };
85325     operation2.tooltip = function() {
85326       var oldGraph = context.copyGraph();
85327       var ids = context.copyIDs();
85328       if (!ids.length) {
85329         return _t.append("operations.paste.nothing_copied");
85330       }
85331       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
85332     };
85333     operation2.annotation = function() {
85334       var ids = context.copyIDs();
85335       return _t("operations.paste.annotation", { n: ids.length });
85336     };
85337     operation2.id = "paste";
85338     operation2.keys = [uiCmd("\u2318V")];
85339     operation2.title = _t.append("operations.paste.title");
85340     return operation2;
85341   }
85342   var init_paste2 = __esm({
85343     "modules/operations/paste.js"() {
85344       "use strict";
85345       init_copy_entities();
85346       init_move();
85347       init_select5();
85348       init_geo2();
85349       init_localizer();
85350       init_cmd();
85351       init_utilDisplayLabel();
85352     }
85353   });
85354
85355   // modules/operations/reverse.js
85356   var reverse_exports2 = {};
85357   __export(reverse_exports2, {
85358     operationReverse: () => operationReverse
85359   });
85360   function operationReverse(context, selectedIDs) {
85361     var operation2 = function() {
85362       context.perform(function combinedReverseAction(graph) {
85363         actions().forEach(function(action) {
85364           graph = action(graph);
85365         });
85366         return graph;
85367       }, operation2.annotation());
85368       context.validator().validate();
85369     };
85370     function actions(situation) {
85371       return selectedIDs.map(function(entityID) {
85372         var entity = context.hasEntity(entityID);
85373         if (!entity) return null;
85374         if (situation === "toolbar") {
85375           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided())) return null;
85376         }
85377         var geometry = entity.geometry(context.graph());
85378         if (entity.type !== "node" && geometry !== "line") return null;
85379         var action = actionReverse(entityID);
85380         if (action.disabled(context.graph())) return null;
85381         return action;
85382       }).filter(Boolean);
85383     }
85384     function reverseTypeID() {
85385       var acts = actions();
85386       var nodeActionCount = acts.filter(function(act) {
85387         var entity = context.hasEntity(act.entityID());
85388         return entity && entity.type === "node";
85389       }).length;
85390       if (nodeActionCount === 0) return "line";
85391       if (nodeActionCount === acts.length) return "point";
85392       return "feature";
85393     }
85394     operation2.available = function(situation) {
85395       return actions(situation).length > 0;
85396     };
85397     operation2.disabled = function() {
85398       return false;
85399     };
85400     operation2.tooltip = function() {
85401       return _t.append("operations.reverse.description." + reverseTypeID());
85402     };
85403     operation2.annotation = function() {
85404       var acts = actions();
85405       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
85406     };
85407     operation2.id = "reverse";
85408     operation2.keys = [_t("operations.reverse.key")];
85409     operation2.title = _t.append("operations.reverse.title");
85410     operation2.behavior = behaviorOperation(context).which(operation2);
85411     return operation2;
85412   }
85413   var init_reverse2 = __esm({
85414     "modules/operations/reverse.js"() {
85415       "use strict";
85416       init_localizer();
85417       init_reverse();
85418       init_operation();
85419     }
85420   });
85421
85422   // modules/operations/straighten.js
85423   var straighten_exports = {};
85424   __export(straighten_exports, {
85425     operationStraighten: () => operationStraighten
85426   });
85427   function operationStraighten(context, selectedIDs) {
85428     var _wayIDs = selectedIDs.filter(function(id2) {
85429       return id2.charAt(0) === "w";
85430     });
85431     var _nodeIDs = selectedIDs.filter(function(id2) {
85432       return id2.charAt(0) === "n";
85433     });
85434     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
85435     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
85436     var _coords = _nodes.map(function(n3) {
85437       return n3.loc;
85438     });
85439     var _extent = utilTotalExtent(selectedIDs, context.graph());
85440     var _action = chooseAction();
85441     var _geometry;
85442     function chooseAction() {
85443       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
85444         _geometry = "point";
85445         return actionStraightenNodes(_nodeIDs, context.projection);
85446       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
85447         var startNodeIDs = [];
85448         var endNodeIDs = [];
85449         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85450           var entity = context.entity(selectedIDs[i3]);
85451           if (entity.type === "node") {
85452             continue;
85453           } else if (entity.type !== "way" || entity.isClosed()) {
85454             return null;
85455           }
85456           startNodeIDs.push(entity.first());
85457           endNodeIDs.push(entity.last());
85458         }
85459         startNodeIDs = startNodeIDs.filter(function(n3) {
85460           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
85461         });
85462         endNodeIDs = endNodeIDs.filter(function(n3) {
85463           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
85464         });
85465         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null;
85466         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
85467           return node.id;
85468         });
85469         if (wayNodeIDs.length <= 2) return null;
85470         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1)) return null;
85471         if (_nodeIDs.length) {
85472           _extent = utilTotalExtent(_nodeIDs, context.graph());
85473         }
85474         _geometry = "line";
85475         return actionStraightenWay(selectedIDs, context.projection);
85476       }
85477       return null;
85478     }
85479     function operation2() {
85480       if (!_action) return;
85481       context.perform(_action, operation2.annotation());
85482       window.setTimeout(function() {
85483         context.validator().validate();
85484       }, 300);
85485     }
85486     operation2.available = function() {
85487       return Boolean(_action);
85488     };
85489     operation2.disabled = function() {
85490       var reason = _action.disabled(context.graph());
85491       if (reason) {
85492         return reason;
85493       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
85494         return "too_large";
85495       } else if (someMissing()) {
85496         return "not_downloaded";
85497       } else if (selectedIDs.some(context.hasHiddenConnections)) {
85498         return "connected_to_hidden";
85499       }
85500       return false;
85501       function someMissing() {
85502         if (context.inIntro()) return false;
85503         var osm = context.connection();
85504         if (osm) {
85505           var missing = _coords.filter(function(loc) {
85506             return !osm.isDataLoaded(loc);
85507           });
85508           if (missing.length) {
85509             missing.forEach(function(loc) {
85510               context.loadTileAtLoc(loc);
85511             });
85512             return true;
85513           }
85514         }
85515         return false;
85516       }
85517     };
85518     operation2.tooltip = function() {
85519       var disable = operation2.disabled();
85520       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
85521     };
85522     operation2.annotation = function() {
85523       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
85524     };
85525     operation2.id = "straighten";
85526     operation2.keys = [_t("operations.straighten.key")];
85527     operation2.title = _t.append("operations.straighten.title");
85528     operation2.behavior = behaviorOperation(context).which(operation2);
85529     return operation2;
85530   }
85531   var init_straighten = __esm({
85532     "modules/operations/straighten.js"() {
85533       "use strict";
85534       init_localizer();
85535       init_straighten_nodes();
85536       init_straighten_way();
85537       init_operation();
85538       init_util();
85539     }
85540   });
85541
85542   // modules/operations/index.js
85543   var operations_exports = {};
85544   __export(operations_exports, {
85545     operationCircularize: () => operationCircularize,
85546     operationContinue: () => operationContinue,
85547     operationCopy: () => operationCopy,
85548     operationDelete: () => operationDelete,
85549     operationDisconnect: () => operationDisconnect,
85550     operationDowngrade: () => operationDowngrade,
85551     operationExtract: () => operationExtract,
85552     operationMerge: () => operationMerge,
85553     operationMove: () => operationMove,
85554     operationOrthogonalize: () => operationOrthogonalize,
85555     operationPaste: () => operationPaste,
85556     operationReflectLong: () => operationReflectLong,
85557     operationReflectShort: () => operationReflectShort,
85558     operationReverse: () => operationReverse,
85559     operationRotate: () => operationRotate,
85560     operationSplit: () => operationSplit,
85561     operationStraighten: () => operationStraighten
85562   });
85563   var init_operations = __esm({
85564     "modules/operations/index.js"() {
85565       "use strict";
85566       init_circularize2();
85567       init_continue();
85568       init_copy();
85569       init_delete();
85570       init_disconnect2();
85571       init_downgrade();
85572       init_extract2();
85573       init_merge6();
85574       init_move2();
85575       init_orthogonalize2();
85576       init_paste2();
85577       init_reflect2();
85578       init_reverse2();
85579       init_rotate3();
85580       init_split2();
85581       init_straighten();
85582     }
85583   });
85584
85585   // modules/modes/select.js
85586   var select_exports2 = {};
85587   __export(select_exports2, {
85588     modeSelect: () => modeSelect
85589   });
85590   function modeSelect(context, selectedIDs) {
85591     var mode = {
85592       id: "select",
85593       button: "browse"
85594     };
85595     var keybinding = utilKeybinding("select");
85596     var _breatheBehavior = behaviorBreathe(context);
85597     var _modeDragNode = modeDragNode(context);
85598     var _selectBehavior;
85599     var _behaviors = [];
85600     var _operations = [];
85601     var _newFeature = false;
85602     var _follow = false;
85603     var _focusedParentWayId;
85604     var _focusedVertexIds;
85605     function singular() {
85606       if (selectedIDs && selectedIDs.length === 1) {
85607         return context.hasEntity(selectedIDs[0]);
85608       }
85609     }
85610     function selectedEntities() {
85611       return selectedIDs.map(function(id2) {
85612         return context.hasEntity(id2);
85613       }).filter(Boolean);
85614     }
85615     function checkSelectedIDs() {
85616       var ids = [];
85617       if (Array.isArray(selectedIDs)) {
85618         ids = selectedIDs.filter(function(id2) {
85619           return context.hasEntity(id2);
85620         });
85621       }
85622       if (!ids.length) {
85623         context.enter(modeBrowse(context));
85624         return false;
85625       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
85626         context.enter(modeSelect(context, ids));
85627         return false;
85628       }
85629       selectedIDs = ids;
85630       return true;
85631     }
85632     function parentWaysIdsOfSelection(onlyCommonParents) {
85633       var graph = context.graph();
85634       var parents = [];
85635       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85636         var entity = context.hasEntity(selectedIDs[i3]);
85637         if (!entity || entity.geometry(graph) !== "vertex") {
85638           return [];
85639         }
85640         var currParents = graph.parentWays(entity).map(function(w3) {
85641           return w3.id;
85642         });
85643         if (!parents.length) {
85644           parents = currParents;
85645           continue;
85646         }
85647         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
85648         if (!parents.length) {
85649           return [];
85650         }
85651       }
85652       return parents;
85653     }
85654     function childNodeIdsOfSelection(onlyCommon) {
85655       var graph = context.graph();
85656       var childs = [];
85657       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85658         var entity = context.hasEntity(selectedIDs[i3]);
85659         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
85660           return [];
85661         }
85662         var currChilds = graph.childNodes(entity).map(function(node) {
85663           return node.id;
85664         });
85665         if (!childs.length) {
85666           childs = currChilds;
85667           continue;
85668         }
85669         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
85670         if (!childs.length) {
85671           return [];
85672         }
85673       }
85674       return childs;
85675     }
85676     function checkFocusedParent() {
85677       if (_focusedParentWayId) {
85678         var parents = parentWaysIdsOfSelection(true);
85679         if (parents.indexOf(_focusedParentWayId) === -1) _focusedParentWayId = null;
85680       }
85681     }
85682     function parentWayIdForVertexNavigation() {
85683       var parentIds = parentWaysIdsOfSelection(true);
85684       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
85685         return _focusedParentWayId;
85686       }
85687       return parentIds.length ? parentIds[0] : null;
85688     }
85689     mode.selectedIDs = function(val) {
85690       if (!arguments.length) return selectedIDs;
85691       selectedIDs = val;
85692       return mode;
85693     };
85694     mode.zoomToSelected = function() {
85695       context.map().zoomToEase(selectedEntities());
85696     };
85697     mode.newFeature = function(val) {
85698       if (!arguments.length) return _newFeature;
85699       _newFeature = val;
85700       return mode;
85701     };
85702     mode.selectBehavior = function(val) {
85703       if (!arguments.length) return _selectBehavior;
85704       _selectBehavior = val;
85705       return mode;
85706     };
85707     mode.follow = function(val) {
85708       if (!arguments.length) return _follow;
85709       _follow = val;
85710       return mode;
85711     };
85712     function loadOperations() {
85713       _operations.forEach(function(operation2) {
85714         if (operation2.behavior) {
85715           context.uninstall(operation2.behavior);
85716         }
85717       });
85718       _operations = Object.values(operations_exports).map((o2) => o2(context, selectedIDs)).filter((o2) => o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy").concat([
85719         // group copy/downgrade/delete operation together at the end of the list
85720         operationCopy(context, selectedIDs),
85721         operationDowngrade(context, selectedIDs),
85722         operationDelete(context, selectedIDs)
85723       ]);
85724       _operations.filter((operation2) => operation2.available()).forEach((operation2) => {
85725         if (operation2.behavior) {
85726           context.install(operation2.behavior);
85727         }
85728       });
85729       _operations.filter((operation2) => !operation2.available()).forEach((operation2) => {
85730         if (operation2.behavior) {
85731           operation2.behavior.on();
85732         }
85733       });
85734       context.ui().closeEditMenu();
85735     }
85736     mode.operations = function() {
85737       return _operations.filter((operation2) => operation2.available());
85738     };
85739     mode.enter = function() {
85740       if (!checkSelectedIDs()) return;
85741       context.features().forceVisible(selectedIDs);
85742       _modeDragNode.restoreSelectedIDs(selectedIDs);
85743       loadOperations();
85744       if (!_behaviors.length) {
85745         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
85746         _behaviors = [
85747           behaviorPaste(context),
85748           _breatheBehavior,
85749           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
85750           _selectBehavior,
85751           behaviorLasso(context),
85752           _modeDragNode.behavior,
85753           modeDragNote(context).behavior
85754         ];
85755       }
85756       _behaviors.forEach(context.install);
85757       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);
85758       select_default2(document).call(keybinding);
85759       context.ui().sidebar.select(selectedIDs, _newFeature);
85760       context.history().on("change.select", function() {
85761         loadOperations();
85762         selectElements();
85763       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
85764       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
85765         selectElements();
85766         _breatheBehavior.restartIfNeeded(context.surface());
85767       });
85768       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
85769       selectElements();
85770       if (_follow) {
85771         var extent = geoExtent();
85772         var graph = context.graph();
85773         selectedIDs.forEach(function(id2) {
85774           var entity = context.entity(id2);
85775           extent._extend(entity.extent(graph));
85776         });
85777         var loc = extent.center();
85778         context.map().centerEase(loc);
85779         _follow = false;
85780       }
85781       function nudgeSelection(delta) {
85782         return function() {
85783           if (!context.map().withinEditableZoom()) return;
85784           var moveOp = operationMove(context, selectedIDs);
85785           if (moveOp.disabled()) {
85786             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
85787           } else {
85788             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
85789             context.validator().validate();
85790           }
85791         };
85792       }
85793       function scaleSelection(factor) {
85794         return function() {
85795           if (!context.map().withinEditableZoom()) return;
85796           let nodes = utilGetAllNodes(selectedIDs, context.graph());
85797           let isUp = factor > 1;
85798           if (nodes.length <= 1) return;
85799           let extent2 = utilTotalExtent(selectedIDs, context.graph());
85800           function scalingDisabled() {
85801             if (tooSmall()) {
85802               return "too_small";
85803             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
85804               return "too_large";
85805             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
85806               return "not_downloaded";
85807             } else if (selectedIDs.some(context.hasHiddenConnections)) {
85808               return "connected_to_hidden";
85809             }
85810             return false;
85811             function tooSmall() {
85812               if (isUp) return false;
85813               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
85814               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
85815               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
85816             }
85817             function someMissing() {
85818               if (context.inIntro()) return false;
85819               let osm = context.connection();
85820               if (osm) {
85821                 let missing = nodes.filter(function(n3) {
85822                   return !osm.isDataLoaded(n3.loc);
85823                 });
85824                 if (missing.length) {
85825                   missing.forEach(function(loc2) {
85826                     context.loadTileAtLoc(loc2);
85827                   });
85828                   return true;
85829                 }
85830               }
85831               return false;
85832             }
85833             function incompleteRelation(id2) {
85834               let entity = context.entity(id2);
85835               return entity.type === "relation" && !entity.isComplete(context.graph());
85836             }
85837           }
85838           const disabled = scalingDisabled();
85839           if (disabled) {
85840             let multi = selectedIDs.length === 1 ? "single" : "multiple";
85841             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
85842           } else {
85843             const pivot = context.projection(extent2.center());
85844             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
85845             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
85846             context.validator().validate();
85847           }
85848         };
85849       }
85850       function didDoubleUp(d3_event, loc2) {
85851         if (!context.map().withinEditableZoom()) return;
85852         var target = select_default2(d3_event.target);
85853         var datum2 = target.datum();
85854         var entity = datum2 && datum2.properties && datum2.properties.entity;
85855         if (!entity) return;
85856         if (entity instanceof osmWay && target.classed("target")) {
85857           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
85858           var prev = entity.nodes[choice.index - 1];
85859           var next = entity.nodes[choice.index];
85860           context.perform(
85861             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
85862             _t("operations.add.annotation.vertex")
85863           );
85864           context.validator().validate();
85865         } else if (entity.type === "midpoint") {
85866           context.perform(
85867             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
85868             _t("operations.add.annotation.vertex")
85869           );
85870           context.validator().validate();
85871         }
85872       }
85873       function selectElements() {
85874         if (!checkSelectedIDs()) return;
85875         var surface = context.surface();
85876         surface.selectAll(".selected-member").classed("selected-member", false);
85877         surface.selectAll(".selected").classed("selected", false);
85878         surface.selectAll(".related").classed("related", false);
85879         checkFocusedParent();
85880         if (_focusedParentWayId) {
85881           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85882         }
85883         if (context.map().withinEditableZoom()) {
85884           surface.selectAll(utilDeepMemberSelector(
85885             selectedIDs,
85886             context.graph(),
85887             true
85888             /* skipMultipolgonMembers */
85889           )).classed("selected-member", true);
85890           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
85891         }
85892       }
85893       function esc() {
85894         if (context.container().select(".combobox").size()) return;
85895         context.enter(modeBrowse(context));
85896       }
85897       function firstVertex(d3_event) {
85898         d3_event.preventDefault();
85899         var entity = singular();
85900         var parentId = parentWayIdForVertexNavigation();
85901         var way;
85902         if (entity && entity.type === "way") {
85903           way = entity;
85904         } else if (parentId) {
85905           way = context.entity(parentId);
85906         }
85907         _focusedParentWayId = way && way.id;
85908         if (way) {
85909           context.enter(
85910             mode.selectedIDs([way.first()]).follow(true)
85911           );
85912         }
85913       }
85914       function lastVertex(d3_event) {
85915         d3_event.preventDefault();
85916         var entity = singular();
85917         var parentId = parentWayIdForVertexNavigation();
85918         var way;
85919         if (entity && entity.type === "way") {
85920           way = entity;
85921         } else if (parentId) {
85922           way = context.entity(parentId);
85923         }
85924         _focusedParentWayId = way && way.id;
85925         if (way) {
85926           context.enter(
85927             mode.selectedIDs([way.last()]).follow(true)
85928           );
85929         }
85930       }
85931       function previousVertex(d3_event) {
85932         d3_event.preventDefault();
85933         var parentId = parentWayIdForVertexNavigation();
85934         _focusedParentWayId = parentId;
85935         if (!parentId) return;
85936         var way = context.entity(parentId);
85937         var length2 = way.nodes.length;
85938         var curr = way.nodes.indexOf(selectedIDs[0]);
85939         var index = -1;
85940         if (curr > 0) {
85941           index = curr - 1;
85942         } else if (way.isClosed()) {
85943           index = length2 - 2;
85944         }
85945         if (index !== -1) {
85946           context.enter(
85947             mode.selectedIDs([way.nodes[index]]).follow(true)
85948           );
85949         }
85950       }
85951       function nextVertex(d3_event) {
85952         d3_event.preventDefault();
85953         var parentId = parentWayIdForVertexNavigation();
85954         _focusedParentWayId = parentId;
85955         if (!parentId) return;
85956         var way = context.entity(parentId);
85957         var length2 = way.nodes.length;
85958         var curr = way.nodes.indexOf(selectedIDs[0]);
85959         var index = -1;
85960         if (curr < length2 - 1) {
85961           index = curr + 1;
85962         } else if (way.isClosed()) {
85963           index = 0;
85964         }
85965         if (index !== -1) {
85966           context.enter(
85967             mode.selectedIDs([way.nodes[index]]).follow(true)
85968           );
85969         }
85970       }
85971       function focusNextParent(d3_event) {
85972         d3_event.preventDefault();
85973         var parents = parentWaysIdsOfSelection(true);
85974         if (!parents || parents.length < 2) return;
85975         var index = parents.indexOf(_focusedParentWayId);
85976         if (index < 0 || index > parents.length - 2) {
85977           _focusedParentWayId = parents[0];
85978         } else {
85979           _focusedParentWayId = parents[index + 1];
85980         }
85981         var surface = context.surface();
85982         surface.selectAll(".related").classed("related", false);
85983         if (_focusedParentWayId) {
85984           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85985         }
85986       }
85987       function selectParent(d3_event) {
85988         d3_event.preventDefault();
85989         var currentSelectedIds = mode.selectedIDs();
85990         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
85991         if (!parentIds.length) return;
85992         context.enter(
85993           mode.selectedIDs(parentIds)
85994         );
85995         _focusedVertexIds = currentSelectedIds;
85996       }
85997       function selectChild(d3_event) {
85998         d3_event.preventDefault();
85999         var currentSelectedIds = mode.selectedIDs();
86000         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
86001         if (!childIds || !childIds.length) return;
86002         if (currentSelectedIds.length === 1) _focusedParentWayId = currentSelectedIds[0];
86003         context.enter(
86004           mode.selectedIDs(childIds)
86005         );
86006       }
86007     };
86008     mode.exit = function() {
86009       _newFeature = false;
86010       _focusedVertexIds = null;
86011       _operations.forEach((operation2) => {
86012         if (operation2.behavior) {
86013           context.uninstall(operation2.behavior);
86014         }
86015       });
86016       _operations = [];
86017       _behaviors.forEach(context.uninstall);
86018       select_default2(document).call(keybinding.unbind);
86019       context.ui().closeEditMenu();
86020       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
86021       var surface = context.surface();
86022       surface.selectAll(".selected-member").classed("selected-member", false);
86023       surface.selectAll(".selected").classed("selected", false);
86024       surface.selectAll(".highlighted").classed("highlighted", false);
86025       surface.selectAll(".related").classed("related", false);
86026       context.map().on("drawn.select", null);
86027       context.ui().sidebar.hide();
86028       context.features().forceVisible([]);
86029       var entity = singular();
86030       if (_newFeature && entity && entity.type === "relation" && // no tags
86031       Object.keys(entity.tags).length === 0 && // no parent relations
86032       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
86033       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
86034         var deleteAction = actionDeleteRelation(
86035           entity.id,
86036           true
86037           /* don't delete untagged members */
86038         );
86039         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
86040         context.validator().validate();
86041       }
86042     };
86043     return mode;
86044   }
86045   var init_select5 = __esm({
86046     "modules/modes/select.js"() {
86047       "use strict";
86048       init_src5();
86049       init_localizer();
86050       init_add_midpoint();
86051       init_delete_relation();
86052       init_move();
86053       init_scale();
86054       init_breathe();
86055       init_hover();
86056       init_lasso2();
86057       init_paste();
86058       init_select4();
86059       init_move2();
86060       init_geo2();
86061       init_browse();
86062       init_drag_node();
86063       init_drag_note();
86064       init_osm();
86065       init_operations();
86066       init_cmd();
86067       init_util();
86068     }
86069   });
86070
86071   // modules/behavior/lasso.js
86072   var lasso_exports2 = {};
86073   __export(lasso_exports2, {
86074     behaviorLasso: () => behaviorLasso
86075   });
86076   function behaviorLasso(context) {
86077     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
86078     var behavior = function(selection2) {
86079       var lasso;
86080       function pointerdown(d3_event) {
86081         var button = 0;
86082         if (d3_event.button === button && d3_event.shiftKey === true) {
86083           lasso = null;
86084           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
86085           d3_event.stopPropagation();
86086         }
86087       }
86088       function pointermove() {
86089         if (!lasso) {
86090           lasso = uiLasso(context);
86091           context.surface().call(lasso);
86092         }
86093         lasso.p(context.map().mouse());
86094       }
86095       function normalize2(a4, b3) {
86096         return [
86097           [Math.min(a4[0], b3[0]), Math.min(a4[1], b3[1])],
86098           [Math.max(a4[0], b3[0]), Math.max(a4[1], b3[1])]
86099         ];
86100       }
86101       function lassoed() {
86102         if (!lasso) return [];
86103         var graph = context.graph();
86104         var limitToNodes;
86105         if (context.map().editableDataEnabled(
86106           true
86107           /* skipZoomCheck */
86108         ) && context.map().isInWideSelection()) {
86109           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
86110         } else if (!context.map().editableDataEnabled()) {
86111           return [];
86112         }
86113         var bounds = lasso.extent().map(context.projection.invert);
86114         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
86115         var intersects2 = context.history().intersects(extent).filter(function(entity) {
86116           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
86117         });
86118         intersects2.sort(function(node1, node2) {
86119           var parents1 = graph.parentWays(node1);
86120           var parents2 = graph.parentWays(node2);
86121           if (parents1.length && parents2.length) {
86122             var sharedParents = utilArrayIntersection(parents1, parents2);
86123             if (sharedParents.length) {
86124               var sharedParentNodes = sharedParents[0].nodes;
86125               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
86126             } else {
86127               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
86128             }
86129           } else if (parents1.length || parents2.length) {
86130             return parents1.length - parents2.length;
86131           }
86132           return node1.loc[0] - node2.loc[0];
86133         });
86134         return intersects2.map(function(entity) {
86135           return entity.id;
86136         });
86137       }
86138       function pointerup() {
86139         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
86140         if (!lasso) return;
86141         var ids = lassoed();
86142         lasso.close();
86143         if (ids.length) {
86144           context.enter(modeSelect(context, ids));
86145         }
86146       }
86147       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
86148     };
86149     behavior.off = function(selection2) {
86150       selection2.on(_pointerPrefix + "down.lasso", null);
86151     };
86152     return behavior;
86153   }
86154   var init_lasso2 = __esm({
86155     "modules/behavior/lasso.js"() {
86156       "use strict";
86157       init_src5();
86158       init_geo2();
86159       init_select5();
86160       init_lasso();
86161       init_array3();
86162       init_util2();
86163     }
86164   });
86165
86166   // modules/modes/browse.js
86167   var browse_exports = {};
86168   __export(browse_exports, {
86169     modeBrowse: () => modeBrowse
86170   });
86171   function modeBrowse(context) {
86172     var mode = {
86173       button: "browse",
86174       id: "browse",
86175       title: _t.append("modes.browse.title"),
86176       description: _t.append("modes.browse.description")
86177     };
86178     var sidebar;
86179     var _selectBehavior;
86180     var _behaviors = [];
86181     mode.selectBehavior = function(val) {
86182       if (!arguments.length) return _selectBehavior;
86183       _selectBehavior = val;
86184       return mode;
86185     };
86186     mode.enter = function() {
86187       if (!_behaviors.length) {
86188         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
86189         _behaviors = [
86190           behaviorPaste(context),
86191           behaviorHover(context).on("hover", context.ui().sidebar.hover),
86192           _selectBehavior,
86193           behaviorLasso(context),
86194           modeDragNode(context).behavior,
86195           modeDragNote(context).behavior
86196         ];
86197       }
86198       _behaviors.forEach(context.install);
86199       if (document.activeElement && document.activeElement.blur) {
86200         document.activeElement.blur();
86201       }
86202       if (sidebar) {
86203         context.ui().sidebar.show(sidebar);
86204       } else {
86205         context.ui().sidebar.select(null);
86206       }
86207     };
86208     mode.exit = function() {
86209       context.ui().sidebar.hover.cancel();
86210       _behaviors.forEach(context.uninstall);
86211       if (sidebar) {
86212         context.ui().sidebar.hide();
86213       }
86214     };
86215     mode.sidebar = function(_3) {
86216       if (!arguments.length) return sidebar;
86217       sidebar = _3;
86218       return mode;
86219     };
86220     mode.operations = function() {
86221       return [operationPaste(context)];
86222     };
86223     return mode;
86224   }
86225   var init_browse = __esm({
86226     "modules/modes/browse.js"() {
86227       "use strict";
86228       init_localizer();
86229       init_hover();
86230       init_lasso2();
86231       init_paste();
86232       init_select4();
86233       init_drag_node();
86234       init_drag_note();
86235       init_paste2();
86236     }
86237   });
86238
86239   // modules/behavior/add_way.js
86240   var add_way_exports = {};
86241   __export(add_way_exports, {
86242     behaviorAddWay: () => behaviorAddWay
86243   });
86244   function behaviorAddWay(context) {
86245     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
86246     var draw = behaviorDraw(context);
86247     function behavior(surface) {
86248       draw.on("click", function() {
86249         dispatch14.apply("start", this, arguments);
86250       }).on("clickWay", function() {
86251         dispatch14.apply("startFromWay", this, arguments);
86252       }).on("clickNode", function() {
86253         dispatch14.apply("startFromNode", this, arguments);
86254       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
86255       context.map().dblclickZoomEnable(false);
86256       surface.call(draw);
86257     }
86258     behavior.off = function(surface) {
86259       surface.call(draw.off);
86260     };
86261     behavior.cancel = function() {
86262       window.setTimeout(function() {
86263         context.map().dblclickZoomEnable(true);
86264       }, 1e3);
86265       context.enter(modeBrowse(context));
86266     };
86267     return utilRebind(behavior, dispatch14, "on");
86268   }
86269   var init_add_way = __esm({
86270     "modules/behavior/add_way.js"() {
86271       "use strict";
86272       init_src4();
86273       init_draw();
86274       init_browse();
86275       init_rebind();
86276     }
86277   });
86278
86279   // modules/globals.d.ts
86280   var globals_d_exports = {};
86281   var init_globals_d = __esm({
86282     "modules/globals.d.ts"() {
86283       "use strict";
86284     }
86285   });
86286
86287   // modules/ui/panes/index.js
86288   var panes_exports = {};
86289   __export(panes_exports, {
86290     uiPaneBackground: () => uiPaneBackground,
86291     uiPaneHelp: () => uiPaneHelp,
86292     uiPaneIssues: () => uiPaneIssues,
86293     uiPaneMapData: () => uiPaneMapData,
86294     uiPanePreferences: () => uiPanePreferences
86295   });
86296   var init_panes = __esm({
86297     "modules/ui/panes/index.js"() {
86298       "use strict";
86299       init_background3();
86300       init_help();
86301       init_issues();
86302       init_map_data();
86303       init_preferences2();
86304     }
86305   });
86306
86307   // modules/ui/sections/index.js
86308   var sections_exports = {};
86309   __export(sections_exports, {
86310     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
86311     uiSectionBackgroundList: () => uiSectionBackgroundList,
86312     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
86313     uiSectionChanges: () => uiSectionChanges,
86314     uiSectionDataLayers: () => uiSectionDataLayers,
86315     uiSectionEntityIssues: () => uiSectionEntityIssues,
86316     uiSectionFeatureType: () => uiSectionFeatureType,
86317     uiSectionMapFeatures: () => uiSectionMapFeatures,
86318     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
86319     uiSectionOverlayList: () => uiSectionOverlayList,
86320     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
86321     uiSectionPresetFields: () => uiSectionPresetFields,
86322     uiSectionPrivacy: () => uiSectionPrivacy,
86323     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
86324     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
86325     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
86326     uiSectionSelectionList: () => uiSectionSelectionList,
86327     uiSectionValidationIssues: () => uiSectionValidationIssues,
86328     uiSectionValidationOptions: () => uiSectionValidationOptions,
86329     uiSectionValidationRules: () => uiSectionValidationRules,
86330     uiSectionValidationStatus: () => uiSectionValidationStatus
86331   });
86332   var init_sections = __esm({
86333     "modules/ui/sections/index.js"() {
86334       "use strict";
86335       init_background_display_options();
86336       init_background_list();
86337       init_background_offset();
86338       init_changes();
86339       init_data_layers();
86340       init_entity_issues();
86341       init_feature_type();
86342       init_map_features();
86343       init_map_style_options();
86344       init_overlay_list();
86345       init_photo_overlays();
86346       init_preset_fields();
86347       init_privacy();
86348       init_raw_member_editor();
86349       init_raw_membership_editor();
86350       init_raw_tag_editor();
86351       init_selection_list();
86352       init_validation_issues();
86353       init_validation_options();
86354       init_validation_rules();
86355       init_validation_status();
86356     }
86357   });
86358
86359   // modules/ui/settings/index.js
86360   var settings_exports = {};
86361   __export(settings_exports, {
86362     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
86363     uiSettingsCustomData: () => uiSettingsCustomData
86364   });
86365   var init_settings = __esm({
86366     "modules/ui/settings/index.js"() {
86367       "use strict";
86368       init_custom_background();
86369       init_custom_data();
86370     }
86371   });
86372
86373   // import("../**/*") in modules/core/file_fetcher.js
86374   var globImport;
86375   var init_ = __esm({
86376     'import("../**/*") in modules/core/file_fetcher.js'() {
86377       globImport = __glob({
86378         "../actions/add_entity.js": () => Promise.resolve().then(() => (init_add_entity(), add_entity_exports)),
86379         "../actions/add_member.js": () => Promise.resolve().then(() => (init_add_member(), add_member_exports)),
86380         "../actions/add_midpoint.js": () => Promise.resolve().then(() => (init_add_midpoint(), add_midpoint_exports)),
86381         "../actions/add_vertex.js": () => Promise.resolve().then(() => (init_add_vertex(), add_vertex_exports)),
86382         "../actions/change_member.js": () => Promise.resolve().then(() => (init_change_member(), change_member_exports)),
86383         "../actions/change_preset.js": () => Promise.resolve().then(() => (init_change_preset(), change_preset_exports)),
86384         "../actions/change_tags.js": () => Promise.resolve().then(() => (init_change_tags(), change_tags_exports)),
86385         "../actions/circularize.js": () => Promise.resolve().then(() => (init_circularize(), circularize_exports)),
86386         "../actions/connect.js": () => Promise.resolve().then(() => (init_connect(), connect_exports)),
86387         "../actions/copy_entities.js": () => Promise.resolve().then(() => (init_copy_entities(), copy_entities_exports)),
86388         "../actions/delete_member.js": () => Promise.resolve().then(() => (init_delete_member(), delete_member_exports)),
86389         "../actions/delete_members.js": () => Promise.resolve().then(() => (init_delete_members(), delete_members_exports)),
86390         "../actions/delete_multiple.js": () => Promise.resolve().then(() => (init_delete_multiple(), delete_multiple_exports)),
86391         "../actions/delete_node.js": () => Promise.resolve().then(() => (init_delete_node(), delete_node_exports)),
86392         "../actions/delete_relation.js": () => Promise.resolve().then(() => (init_delete_relation(), delete_relation_exports)),
86393         "../actions/delete_way.js": () => Promise.resolve().then(() => (init_delete_way(), delete_way_exports)),
86394         "../actions/discard_tags.js": () => Promise.resolve().then(() => (init_discard_tags(), discard_tags_exports)),
86395         "../actions/disconnect.js": () => Promise.resolve().then(() => (init_disconnect(), disconnect_exports)),
86396         "../actions/extract.js": () => Promise.resolve().then(() => (init_extract(), extract_exports)),
86397         "../actions/index.js": () => Promise.resolve().then(() => (init_actions(), actions_exports)),
86398         "../actions/join.js": () => Promise.resolve().then(() => (init_join2(), join_exports)),
86399         "../actions/merge.js": () => Promise.resolve().then(() => (init_merge5(), merge_exports)),
86400         "../actions/merge_nodes.js": () => Promise.resolve().then(() => (init_merge_nodes(), merge_nodes_exports)),
86401         "../actions/merge_polygon.js": () => Promise.resolve().then(() => (init_merge_polygon(), merge_polygon_exports)),
86402         "../actions/merge_remote_changes.js": () => Promise.resolve().then(() => (init_merge_remote_changes(), merge_remote_changes_exports)),
86403         "../actions/move.js": () => Promise.resolve().then(() => (init_move(), move_exports)),
86404         "../actions/move_member.js": () => Promise.resolve().then(() => (init_move_member(), move_member_exports)),
86405         "../actions/move_node.js": () => Promise.resolve().then(() => (init_move_node(), move_node_exports)),
86406         "../actions/noop.js": () => Promise.resolve().then(() => (init_noop2(), noop_exports)),
86407         "../actions/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize(), orthogonalize_exports)),
86408         "../actions/reflect.js": () => Promise.resolve().then(() => (init_reflect(), reflect_exports)),
86409         "../actions/restrict_turn.js": () => Promise.resolve().then(() => (init_restrict_turn(), restrict_turn_exports)),
86410         "../actions/reverse.js": () => Promise.resolve().then(() => (init_reverse(), reverse_exports)),
86411         "../actions/revert.js": () => Promise.resolve().then(() => (init_revert(), revert_exports)),
86412         "../actions/rotate.js": () => Promise.resolve().then(() => (init_rotate(), rotate_exports)),
86413         "../actions/scale.js": () => Promise.resolve().then(() => (init_scale(), scale_exports)),
86414         "../actions/split.js": () => Promise.resolve().then(() => (init_split(), split_exports)),
86415         "../actions/straighten_nodes.js": () => Promise.resolve().then(() => (init_straighten_nodes(), straighten_nodes_exports)),
86416         "../actions/straighten_way.js": () => Promise.resolve().then(() => (init_straighten_way(), straighten_way_exports)),
86417         "../actions/unrestrict_turn.js": () => Promise.resolve().then(() => (init_unrestrict_turn(), unrestrict_turn_exports)),
86418         "../actions/upgrade_tags.js": () => Promise.resolve().then(() => (init_upgrade_tags(), upgrade_tags_exports)),
86419         "../behavior/add_way.js": () => Promise.resolve().then(() => (init_add_way(), add_way_exports)),
86420         "../behavior/breathe.js": () => Promise.resolve().then(() => (init_breathe(), breathe_exports)),
86421         "../behavior/drag.js": () => Promise.resolve().then(() => (init_drag2(), drag_exports)),
86422         "../behavior/draw.js": () => Promise.resolve().then(() => (init_draw(), draw_exports)),
86423         "../behavior/draw_way.js": () => Promise.resolve().then(() => (init_draw_way(), draw_way_exports)),
86424         "../behavior/edit.js": () => Promise.resolve().then(() => (init_edit(), edit_exports)),
86425         "../behavior/hash.js": () => Promise.resolve().then(() => (init_hash(), hash_exports)),
86426         "../behavior/hover.js": () => Promise.resolve().then(() => (init_hover(), hover_exports)),
86427         "../behavior/index.js": () => Promise.resolve().then(() => (init_behavior(), behavior_exports)),
86428         "../behavior/lasso.js": () => Promise.resolve().then(() => (init_lasso2(), lasso_exports2)),
86429         "../behavior/operation.js": () => Promise.resolve().then(() => (init_operation(), operation_exports)),
86430         "../behavior/paste.js": () => Promise.resolve().then(() => (init_paste(), paste_exports)),
86431         "../behavior/select.js": () => Promise.resolve().then(() => (init_select4(), select_exports)),
86432         "../core/LocationManager.js": () => Promise.resolve().then(() => (init_LocationManager(), LocationManager_exports)),
86433         "../core/context.js": () => Promise.resolve().then(() => (init_context2(), context_exports)),
86434         "../core/difference.js": () => Promise.resolve().then(() => (init_difference(), difference_exports)),
86435         "../core/file_fetcher.js": () => Promise.resolve().then(() => (init_file_fetcher(), file_fetcher_exports)),
86436         "../core/graph.js": () => Promise.resolve().then(() => (init_graph(), graph_exports)),
86437         "../core/history.js": () => Promise.resolve().then(() => (init_history(), history_exports)),
86438         "../core/index.js": () => Promise.resolve().then(() => (init_core(), core_exports)),
86439         "../core/localizer.js": () => Promise.resolve().then(() => (init_localizer(), localizer_exports)),
86440         "../core/preferences.js": () => Promise.resolve().then(() => (init_preferences(), preferences_exports)),
86441         "../core/tree.js": () => Promise.resolve().then(() => (init_tree(), tree_exports)),
86442         "../core/uploader.js": () => Promise.resolve().then(() => (init_uploader(), uploader_exports)),
86443         "../core/validation/index.js": () => Promise.resolve().then(() => (init_validation(), validation_exports)),
86444         "../core/validation/models.js": () => Promise.resolve().then(() => (init_models(), models_exports)),
86445         "../core/validator.js": () => Promise.resolve().then(() => (init_validator(), validator_exports)),
86446         "../geo/extent.js": () => Promise.resolve().then(() => (init_extent(), extent_exports)),
86447         "../geo/geo.js": () => Promise.resolve().then(() => (init_geo(), geo_exports)),
86448         "../geo/geom.js": () => Promise.resolve().then(() => (init_geom(), geom_exports)),
86449         "../geo/index.js": () => Promise.resolve().then(() => (init_geo2(), geo_exports2)),
86450         "../geo/ortho.js": () => Promise.resolve().then(() => (init_ortho(), ortho_exports)),
86451         "../geo/raw_mercator.js": () => Promise.resolve().then(() => (init_raw_mercator(), raw_mercator_exports)),
86452         "../geo/vector.js": () => Promise.resolve().then(() => (init_vector(), vector_exports)),
86453         "../globals.d.ts": () => Promise.resolve().then(() => (init_globals_d(), globals_d_exports)),
86454         "../id.js": () => Promise.resolve().then(() => (init_id2(), id_exports)),
86455         "../index.js": () => Promise.resolve().then(() => (init_index(), index_exports)),
86456         "../modes/add_area.js": () => Promise.resolve().then(() => (init_add_area(), add_area_exports)),
86457         "../modes/add_line.js": () => Promise.resolve().then(() => (init_add_line(), add_line_exports)),
86458         "../modes/add_note.js": () => Promise.resolve().then(() => (init_add_note(), add_note_exports)),
86459         "../modes/add_point.js": () => Promise.resolve().then(() => (init_add_point(), add_point_exports)),
86460         "../modes/browse.js": () => Promise.resolve().then(() => (init_browse(), browse_exports)),
86461         "../modes/drag_node.js": () => Promise.resolve().then(() => (init_drag_node(), drag_node_exports)),
86462         "../modes/drag_note.js": () => Promise.resolve().then(() => (init_drag_note(), drag_note_exports)),
86463         "../modes/draw_area.js": () => Promise.resolve().then(() => (init_draw_area(), draw_area_exports)),
86464         "../modes/draw_line.js": () => Promise.resolve().then(() => (init_draw_line(), draw_line_exports)),
86465         "../modes/index.js": () => Promise.resolve().then(() => (init_modes2(), modes_exports2)),
86466         "../modes/move.js": () => Promise.resolve().then(() => (init_move3(), move_exports3)),
86467         "../modes/rotate.js": () => Promise.resolve().then(() => (init_rotate2(), rotate_exports2)),
86468         "../modes/save.js": () => Promise.resolve().then(() => (init_save2(), save_exports2)),
86469         "../modes/select.js": () => Promise.resolve().then(() => (init_select5(), select_exports2)),
86470         "../modes/select_data.js": () => Promise.resolve().then(() => (init_select_data(), select_data_exports)),
86471         "../modes/select_error.js": () => Promise.resolve().then(() => (init_select_error(), select_error_exports)),
86472         "../modes/select_note.js": () => Promise.resolve().then(() => (init_select_note(), select_note_exports)),
86473         "../operations/circularize.js": () => Promise.resolve().then(() => (init_circularize2(), circularize_exports2)),
86474         "../operations/continue.js": () => Promise.resolve().then(() => (init_continue(), continue_exports)),
86475         "../operations/copy.js": () => Promise.resolve().then(() => (init_copy(), copy_exports)),
86476         "../operations/delete.js": () => Promise.resolve().then(() => (init_delete(), delete_exports)),
86477         "../operations/disconnect.js": () => Promise.resolve().then(() => (init_disconnect2(), disconnect_exports2)),
86478         "../operations/downgrade.js": () => Promise.resolve().then(() => (init_downgrade(), downgrade_exports)),
86479         "../operations/extract.js": () => Promise.resolve().then(() => (init_extract2(), extract_exports2)),
86480         "../operations/index.js": () => Promise.resolve().then(() => (init_operations(), operations_exports)),
86481         "../operations/merge.js": () => Promise.resolve().then(() => (init_merge6(), merge_exports2)),
86482         "../operations/move.js": () => Promise.resolve().then(() => (init_move2(), move_exports2)),
86483         "../operations/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize2(), orthogonalize_exports2)),
86484         "../operations/paste.js": () => Promise.resolve().then(() => (init_paste2(), paste_exports2)),
86485         "../operations/reflect.js": () => Promise.resolve().then(() => (init_reflect2(), reflect_exports2)),
86486         "../operations/reverse.js": () => Promise.resolve().then(() => (init_reverse2(), reverse_exports2)),
86487         "../operations/rotate.js": () => Promise.resolve().then(() => (init_rotate3(), rotate_exports3)),
86488         "../operations/split.js": () => Promise.resolve().then(() => (init_split2(), split_exports2)),
86489         "../operations/straighten.js": () => Promise.resolve().then(() => (init_straighten(), straighten_exports)),
86490         "../osm/changeset.js": () => Promise.resolve().then(() => (init_changeset(), changeset_exports)),
86491         "../osm/deprecated.js": () => Promise.resolve().then(() => (init_deprecated(), deprecated_exports)),
86492         "../osm/entity.js": () => Promise.resolve().then(() => (init_entity(), entity_exports)),
86493         "../osm/index.js": () => Promise.resolve().then(() => (init_osm(), osm_exports)),
86494         "../osm/intersection.js": () => Promise.resolve().then(() => (init_intersection(), intersection_exports)),
86495         "../osm/lanes.js": () => Promise.resolve().then(() => (init_lanes(), lanes_exports)),
86496         "../osm/multipolygon.js": () => Promise.resolve().then(() => (init_multipolygon(), multipolygon_exports)),
86497         "../osm/node.js": () => Promise.resolve().then(() => (init_node2(), node_exports)),
86498         "../osm/note.js": () => Promise.resolve().then(() => (init_note(), note_exports)),
86499         "../osm/qa_item.js": () => Promise.resolve().then(() => (init_qa_item(), qa_item_exports)),
86500         "../osm/relation.js": () => Promise.resolve().then(() => (init_relation(), relation_exports)),
86501         "../osm/tags.js": () => Promise.resolve().then(() => (init_tags(), tags_exports)),
86502         "../osm/way.js": () => Promise.resolve().then(() => (init_way(), way_exports)),
86503         "../presets/category.js": () => Promise.resolve().then(() => (init_category(), category_exports)),
86504         "../presets/collection.js": () => Promise.resolve().then(() => (init_collection(), collection_exports)),
86505         "../presets/field.js": () => Promise.resolve().then(() => (init_field(), field_exports)),
86506         "../presets/index.js": () => Promise.resolve().then(() => (init_presets(), presets_exports)),
86507         "../presets/preset.js": () => Promise.resolve().then(() => (init_preset(), preset_exports)),
86508         "../renderer/background.js": () => Promise.resolve().then(() => (init_background2(), background_exports2)),
86509         "../renderer/background_source.js": () => Promise.resolve().then(() => (init_background_source(), background_source_exports)),
86510         "../renderer/features.js": () => Promise.resolve().then(() => (init_features(), features_exports)),
86511         "../renderer/index.js": () => Promise.resolve().then(() => (init_renderer(), renderer_exports)),
86512         "../renderer/map.js": () => Promise.resolve().then(() => (init_map(), map_exports)),
86513         "../renderer/photos.js": () => Promise.resolve().then(() => (init_photos(), photos_exports)),
86514         "../renderer/tile_layer.js": () => Promise.resolve().then(() => (init_tile_layer(), tile_layer_exports)),
86515         "../services/index.js": () => Promise.resolve().then(() => (init_services(), services_exports)),
86516         "../services/kartaview.js": () => Promise.resolve().then(() => (init_kartaview(), kartaview_exports)),
86517         "../services/keepRight.js": () => Promise.resolve().then(() => (init_keepRight(), keepRight_exports)),
86518         "../services/mapilio.js": () => Promise.resolve().then(() => (init_mapilio(), mapilio_exports)),
86519         "../services/mapillary.js": () => Promise.resolve().then(() => (init_mapillary(), mapillary_exports)),
86520         "../services/maprules.js": () => Promise.resolve().then(() => (init_maprules(), maprules_exports)),
86521         "../services/nominatim.js": () => Promise.resolve().then(() => (init_nominatim(), nominatim_exports)),
86522         "../services/nsi.js": () => Promise.resolve().then(() => (init_nsi(), nsi_exports)),
86523         "../services/osm.js": () => Promise.resolve().then(() => (init_osm2(), osm_exports2)),
86524         "../services/osm_wikibase.js": () => Promise.resolve().then(() => (init_osm_wikibase(), osm_wikibase_exports)),
86525         "../services/osmose.js": () => Promise.resolve().then(() => (init_osmose(), osmose_exports)),
86526         "../services/pannellum_photo.js": () => Promise.resolve().then(() => (init_pannellum_photo(), pannellum_photo_exports)),
86527         "../services/panoramax.js": () => Promise.resolve().then(() => (init_panoramax(), panoramax_exports)),
86528         "../services/plane_photo.js": () => Promise.resolve().then(() => (init_plane_photo(), plane_photo_exports)),
86529         "../services/streetside.js": () => Promise.resolve().then(() => (init_streetside(), streetside_exports)),
86530         "../services/taginfo.js": () => Promise.resolve().then(() => (init_taginfo(), taginfo_exports)),
86531         "../services/vector_tile.js": () => Promise.resolve().then(() => (init_vector_tile2(), vector_tile_exports)),
86532         "../services/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder(), vegbilder_exports)),
86533         "../services/wikidata.js": () => Promise.resolve().then(() => (init_wikidata(), wikidata_exports)),
86534         "../services/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia(), wikipedia_exports)),
86535         "../svg/areas.js": () => Promise.resolve().then(() => (init_areas(), areas_exports)),
86536         "../svg/data.js": () => Promise.resolve().then(() => (init_data2(), data_exports)),
86537         "../svg/debug.js": () => Promise.resolve().then(() => (init_debug(), debug_exports)),
86538         "../svg/defs.js": () => Promise.resolve().then(() => (init_defs(), defs_exports)),
86539         "../svg/geolocate.js": () => Promise.resolve().then(() => (init_geolocate(), geolocate_exports)),
86540         "../svg/helpers.js": () => Promise.resolve().then(() => (init_helpers(), helpers_exports)),
86541         "../svg/icon.js": () => Promise.resolve().then(() => (init_icon(), icon_exports)),
86542         "../svg/index.js": () => Promise.resolve().then(() => (init_svg(), svg_exports)),
86543         "../svg/kartaview_images.js": () => Promise.resolve().then(() => (init_kartaview_images(), kartaview_images_exports)),
86544         "../svg/keepRight.js": () => Promise.resolve().then(() => (init_keepRight2(), keepRight_exports2)),
86545         "../svg/labels.js": () => Promise.resolve().then(() => (init_labels(), labels_exports)),
86546         "../svg/layers.js": () => Promise.resolve().then(() => (init_layers(), layers_exports)),
86547         "../svg/lines.js": () => Promise.resolve().then(() => (init_lines(), lines_exports)),
86548         "../svg/local_photos.js": () => Promise.resolve().then(() => (init_local_photos(), local_photos_exports)),
86549         "../svg/mapilio_images.js": () => Promise.resolve().then(() => (init_mapilio_images(), mapilio_images_exports)),
86550         "../svg/mapillary_images.js": () => Promise.resolve().then(() => (init_mapillary_images(), mapillary_images_exports)),
86551         "../svg/mapillary_map_features.js": () => Promise.resolve().then(() => (init_mapillary_map_features(), mapillary_map_features_exports)),
86552         "../svg/mapillary_position.js": () => Promise.resolve().then(() => (init_mapillary_position(), mapillary_position_exports)),
86553         "../svg/mapillary_signs.js": () => Promise.resolve().then(() => (init_mapillary_signs(), mapillary_signs_exports)),
86554         "../svg/midpoints.js": () => Promise.resolve().then(() => (init_midpoints(), midpoints_exports)),
86555         "../svg/notes.js": () => Promise.resolve().then(() => (init_notes(), notes_exports)),
86556         "../svg/osm.js": () => Promise.resolve().then(() => (init_osm3(), osm_exports3)),
86557         "../svg/osmose.js": () => Promise.resolve().then(() => (init_osmose2(), osmose_exports2)),
86558         "../svg/panoramax_images.js": () => Promise.resolve().then(() => (init_panoramax_images(), panoramax_images_exports)),
86559         "../svg/points.js": () => Promise.resolve().then(() => (init_points(), points_exports)),
86560         "../svg/streetside.js": () => Promise.resolve().then(() => (init_streetside2(), streetside_exports2)),
86561         "../svg/tag_classes.js": () => Promise.resolve().then(() => (init_tag_classes(), tag_classes_exports)),
86562         "../svg/tag_pattern.js": () => Promise.resolve().then(() => (init_tag_pattern(), tag_pattern_exports)),
86563         "../svg/touch.js": () => Promise.resolve().then(() => (init_touch(), touch_exports)),
86564         "../svg/turns.js": () => Promise.resolve().then(() => (init_turns(), turns_exports)),
86565         "../svg/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder2(), vegbilder_exports2)),
86566         "../svg/vertices.js": () => Promise.resolve().then(() => (init_vertices(), vertices_exports)),
86567         "../ui/account.js": () => Promise.resolve().then(() => (init_account(), account_exports)),
86568         "../ui/attribution.js": () => Promise.resolve().then(() => (init_attribution(), attribution_exports)),
86569         "../ui/changeset_editor.js": () => Promise.resolve().then(() => (init_changeset_editor(), changeset_editor_exports)),
86570         "../ui/cmd.js": () => Promise.resolve().then(() => (init_cmd(), cmd_exports)),
86571         "../ui/combobox.js": () => Promise.resolve().then(() => (init_combobox(), combobox_exports)),
86572         "../ui/commit.js": () => Promise.resolve().then(() => (init_commit(), commit_exports)),
86573         "../ui/commit_warnings.js": () => Promise.resolve().then(() => (init_commit_warnings(), commit_warnings_exports)),
86574         "../ui/confirm.js": () => Promise.resolve().then(() => (init_confirm(), confirm_exports)),
86575         "../ui/conflicts.js": () => Promise.resolve().then(() => (init_conflicts(), conflicts_exports)),
86576         "../ui/contributors.js": () => Promise.resolve().then(() => (init_contributors(), contributors_exports)),
86577         "../ui/curtain.js": () => Promise.resolve().then(() => (init_curtain(), curtain_exports)),
86578         "../ui/data_editor.js": () => Promise.resolve().then(() => (init_data_editor(), data_editor_exports)),
86579         "../ui/data_header.js": () => Promise.resolve().then(() => (init_data_header(), data_header_exports)),
86580         "../ui/disclosure.js": () => Promise.resolve().then(() => (init_disclosure(), disclosure_exports)),
86581         "../ui/edit_menu.js": () => Promise.resolve().then(() => (init_edit_menu(), edit_menu_exports)),
86582         "../ui/entity_editor.js": () => Promise.resolve().then(() => (init_entity_editor(), entity_editor_exports)),
86583         "../ui/feature_info.js": () => Promise.resolve().then(() => (init_feature_info(), feature_info_exports)),
86584         "../ui/feature_list.js": () => Promise.resolve().then(() => (init_feature_list(), feature_list_exports)),
86585         "../ui/field.js": () => Promise.resolve().then(() => (init_field2(), field_exports2)),
86586         "../ui/field_help.js": () => Promise.resolve().then(() => (init_field_help(), field_help_exports)),
86587         "../ui/fields/access.js": () => Promise.resolve().then(() => (init_access(), access_exports)),
86588         "../ui/fields/address.js": () => Promise.resolve().then(() => (init_address(), address_exports)),
86589         "../ui/fields/check.js": () => Promise.resolve().then(() => (init_check(), check_exports)),
86590         "../ui/fields/combo.js": () => Promise.resolve().then(() => (init_combo(), combo_exports)),
86591         "../ui/fields/directional_combo.js": () => Promise.resolve().then(() => (init_directional_combo(), directional_combo_exports)),
86592         "../ui/fields/index.js": () => Promise.resolve().then(() => (init_fields(), fields_exports)),
86593         "../ui/fields/input.js": () => Promise.resolve().then(() => (init_input(), input_exports)),
86594         "../ui/fields/lanes.js": () => Promise.resolve().then(() => (init_lanes2(), lanes_exports2)),
86595         "../ui/fields/localized.js": () => Promise.resolve().then(() => (init_localized(), localized_exports)),
86596         "../ui/fields/radio.js": () => Promise.resolve().then(() => (init_radio(), radio_exports)),
86597         "../ui/fields/restrictions.js": () => Promise.resolve().then(() => (init_restrictions(), restrictions_exports)),
86598         "../ui/fields/roadheight.js": () => Promise.resolve().then(() => (init_roadheight(), roadheight_exports)),
86599         "../ui/fields/roadspeed.js": () => Promise.resolve().then(() => (init_roadspeed(), roadspeed_exports)),
86600         "../ui/fields/textarea.js": () => Promise.resolve().then(() => (init_textarea(), textarea_exports)),
86601         "../ui/fields/wikidata.js": () => Promise.resolve().then(() => (init_wikidata2(), wikidata_exports2)),
86602         "../ui/fields/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia2(), wikipedia_exports2)),
86603         "../ui/flash.js": () => Promise.resolve().then(() => (init_flash(), flash_exports)),
86604         "../ui/form_fields.js": () => Promise.resolve().then(() => (init_form_fields(), form_fields_exports)),
86605         "../ui/full_screen.js": () => Promise.resolve().then(() => (init_full_screen(), full_screen_exports)),
86606         "../ui/geolocate.js": () => Promise.resolve().then(() => (init_geolocate2(), geolocate_exports2)),
86607         "../ui/index.js": () => Promise.resolve().then(() => (init_ui(), ui_exports)),
86608         "../ui/info.js": () => Promise.resolve().then(() => (init_info(), info_exports)),
86609         "../ui/init.js": () => Promise.resolve().then(() => (init_init2(), init_exports)),
86610         "../ui/inspector.js": () => Promise.resolve().then(() => (init_inspector(), inspector_exports)),
86611         "../ui/intro/area.js": () => Promise.resolve().then(() => (init_area4(), area_exports)),
86612         "../ui/intro/building.js": () => Promise.resolve().then(() => (init_building(), building_exports)),
86613         "../ui/intro/helper.js": () => Promise.resolve().then(() => (init_helper(), helper_exports)),
86614         "../ui/intro/index.js": () => Promise.resolve().then(() => (init_intro2(), intro_exports2)),
86615         "../ui/intro/intro.js": () => Promise.resolve().then(() => (init_intro(), intro_exports)),
86616         "../ui/intro/line.js": () => Promise.resolve().then(() => (init_line2(), line_exports)),
86617         "../ui/intro/navigation.js": () => Promise.resolve().then(() => (init_navigation(), navigation_exports)),
86618         "../ui/intro/point.js": () => Promise.resolve().then(() => (init_point(), point_exports)),
86619         "../ui/intro/start_editing.js": () => Promise.resolve().then(() => (init_start_editing(), start_editing_exports)),
86620         "../ui/intro/welcome.js": () => Promise.resolve().then(() => (init_welcome(), welcome_exports)),
86621         "../ui/issues_info.js": () => Promise.resolve().then(() => (init_issues_info(), issues_info_exports)),
86622         "../ui/keepRight_details.js": () => Promise.resolve().then(() => (init_keepRight_details(), keepRight_details_exports)),
86623         "../ui/keepRight_editor.js": () => Promise.resolve().then(() => (init_keepRight_editor(), keepRight_editor_exports)),
86624         "../ui/keepRight_header.js": () => Promise.resolve().then(() => (init_keepRight_header(), keepRight_header_exports)),
86625         "../ui/lasso.js": () => Promise.resolve().then(() => (init_lasso(), lasso_exports)),
86626         "../ui/length_indicator.js": () => Promise.resolve().then(() => (init_length_indicator(), length_indicator_exports)),
86627         "../ui/loading.js": () => Promise.resolve().then(() => (init_loading(), loading_exports)),
86628         "../ui/map_in_map.js": () => Promise.resolve().then(() => (init_map_in_map(), map_in_map_exports)),
86629         "../ui/modal.js": () => Promise.resolve().then(() => (init_modal(), modal_exports)),
86630         "../ui/note_comments.js": () => Promise.resolve().then(() => (init_note_comments(), note_comments_exports)),
86631         "../ui/note_editor.js": () => Promise.resolve().then(() => (init_note_editor(), note_editor_exports)),
86632         "../ui/note_header.js": () => Promise.resolve().then(() => (init_note_header(), note_header_exports)),
86633         "../ui/note_report.js": () => Promise.resolve().then(() => (init_note_report(), note_report_exports)),
86634         "../ui/notice.js": () => Promise.resolve().then(() => (init_notice(), notice_exports)),
86635         "../ui/osmose_details.js": () => Promise.resolve().then(() => (init_osmose_details(), osmose_details_exports)),
86636         "../ui/osmose_editor.js": () => Promise.resolve().then(() => (init_osmose_editor(), osmose_editor_exports)),
86637         "../ui/osmose_header.js": () => Promise.resolve().then(() => (init_osmose_header(), osmose_header_exports)),
86638         "../ui/pane.js": () => Promise.resolve().then(() => (init_pane(), pane_exports)),
86639         "../ui/panels/background.js": () => Promise.resolve().then(() => (init_background(), background_exports)),
86640         "../ui/panels/history.js": () => Promise.resolve().then(() => (init_history2(), history_exports2)),
86641         "../ui/panels/index.js": () => Promise.resolve().then(() => (init_panels(), panels_exports)),
86642         "../ui/panels/location.js": () => Promise.resolve().then(() => (init_location(), location_exports)),
86643         "../ui/panels/measurement.js": () => Promise.resolve().then(() => (init_measurement(), measurement_exports)),
86644         "../ui/panes/background.js": () => Promise.resolve().then(() => (init_background3(), background_exports3)),
86645         "../ui/panes/help.js": () => Promise.resolve().then(() => (init_help(), help_exports)),
86646         "../ui/panes/index.js": () => Promise.resolve().then(() => (init_panes(), panes_exports)),
86647         "../ui/panes/issues.js": () => Promise.resolve().then(() => (init_issues(), issues_exports)),
86648         "../ui/panes/map_data.js": () => Promise.resolve().then(() => (init_map_data(), map_data_exports)),
86649         "../ui/panes/preferences.js": () => Promise.resolve().then(() => (init_preferences2(), preferences_exports2)),
86650         "../ui/photoviewer.js": () => Promise.resolve().then(() => (init_photoviewer(), photoviewer_exports)),
86651         "../ui/popover.js": () => Promise.resolve().then(() => (init_popover(), popover_exports)),
86652         "../ui/preset_icon.js": () => Promise.resolve().then(() => (init_preset_icon(), preset_icon_exports)),
86653         "../ui/preset_list.js": () => Promise.resolve().then(() => (init_preset_list(), preset_list_exports)),
86654         "../ui/restore.js": () => Promise.resolve().then(() => (init_restore(), restore_exports)),
86655         "../ui/scale.js": () => Promise.resolve().then(() => (init_scale2(), scale_exports2)),
86656         "../ui/section.js": () => Promise.resolve().then(() => (init_section(), section_exports)),
86657         "../ui/sections/background_display_options.js": () => Promise.resolve().then(() => (init_background_display_options(), background_display_options_exports)),
86658         "../ui/sections/background_list.js": () => Promise.resolve().then(() => (init_background_list(), background_list_exports)),
86659         "../ui/sections/background_offset.js": () => Promise.resolve().then(() => (init_background_offset(), background_offset_exports)),
86660         "../ui/sections/changes.js": () => Promise.resolve().then(() => (init_changes(), changes_exports)),
86661         "../ui/sections/data_layers.js": () => Promise.resolve().then(() => (init_data_layers(), data_layers_exports)),
86662         "../ui/sections/entity_issues.js": () => Promise.resolve().then(() => (init_entity_issues(), entity_issues_exports)),
86663         "../ui/sections/feature_type.js": () => Promise.resolve().then(() => (init_feature_type(), feature_type_exports)),
86664         "../ui/sections/index.js": () => Promise.resolve().then(() => (init_sections(), sections_exports)),
86665         "../ui/sections/map_features.js": () => Promise.resolve().then(() => (init_map_features(), map_features_exports)),
86666         "../ui/sections/map_style_options.js": () => Promise.resolve().then(() => (init_map_style_options(), map_style_options_exports)),
86667         "../ui/sections/overlay_list.js": () => Promise.resolve().then(() => (init_overlay_list(), overlay_list_exports)),
86668         "../ui/sections/photo_overlays.js": () => Promise.resolve().then(() => (init_photo_overlays(), photo_overlays_exports)),
86669         "../ui/sections/preset_fields.js": () => Promise.resolve().then(() => (init_preset_fields(), preset_fields_exports)),
86670         "../ui/sections/privacy.js": () => Promise.resolve().then(() => (init_privacy(), privacy_exports)),
86671         "../ui/sections/raw_member_editor.js": () => Promise.resolve().then(() => (init_raw_member_editor(), raw_member_editor_exports)),
86672         "../ui/sections/raw_membership_editor.js": () => Promise.resolve().then(() => (init_raw_membership_editor(), raw_membership_editor_exports)),
86673         "../ui/sections/raw_tag_editor.js": () => Promise.resolve().then(() => (init_raw_tag_editor(), raw_tag_editor_exports)),
86674         "../ui/sections/selection_list.js": () => Promise.resolve().then(() => (init_selection_list(), selection_list_exports)),
86675         "../ui/sections/validation_issues.js": () => Promise.resolve().then(() => (init_validation_issues(), validation_issues_exports)),
86676         "../ui/sections/validation_options.js": () => Promise.resolve().then(() => (init_validation_options(), validation_options_exports)),
86677         "../ui/sections/validation_rules.js": () => Promise.resolve().then(() => (init_validation_rules(), validation_rules_exports)),
86678         "../ui/sections/validation_status.js": () => Promise.resolve().then(() => (init_validation_status(), validation_status_exports)),
86679         "../ui/settings/custom_background.js": () => Promise.resolve().then(() => (init_custom_background(), custom_background_exports)),
86680         "../ui/settings/custom_data.js": () => Promise.resolve().then(() => (init_custom_data(), custom_data_exports)),
86681         "../ui/settings/index.js": () => Promise.resolve().then(() => (init_settings(), settings_exports)),
86682         "../ui/settings/local_photos.js": () => Promise.resolve().then(() => (init_local_photos2(), local_photos_exports2)),
86683         "../ui/shortcuts.js": () => Promise.resolve().then(() => (init_shortcuts(), shortcuts_exports)),
86684         "../ui/sidebar.js": () => Promise.resolve().then(() => (init_sidebar(), sidebar_exports)),
86685         "../ui/source_switch.js": () => Promise.resolve().then(() => (init_source_switch(), source_switch_exports)),
86686         "../ui/spinner.js": () => Promise.resolve().then(() => (init_spinner(), spinner_exports)),
86687         "../ui/splash.js": () => Promise.resolve().then(() => (init_splash(), splash_exports)),
86688         "../ui/status.js": () => Promise.resolve().then(() => (init_status(), status_exports)),
86689         "../ui/success.js": () => Promise.resolve().then(() => (init_success(), success_exports)),
86690         "../ui/tag_reference.js": () => Promise.resolve().then(() => (init_tag_reference(), tag_reference_exports)),
86691         "../ui/toggle.js": () => Promise.resolve().then(() => (init_toggle(), toggle_exports)),
86692         "../ui/tools/index.js": () => Promise.resolve().then(() => (init_tools(), tools_exports)),
86693         "../ui/tools/modes.js": () => Promise.resolve().then(() => (init_modes(), modes_exports)),
86694         "../ui/tools/notes.js": () => Promise.resolve().then(() => (init_notes2(), notes_exports2)),
86695         "../ui/tools/save.js": () => Promise.resolve().then(() => (init_save(), save_exports)),
86696         "../ui/tools/sidebar_toggle.js": () => Promise.resolve().then(() => (init_sidebar_toggle(), sidebar_toggle_exports)),
86697         "../ui/tools/undo_redo.js": () => Promise.resolve().then(() => (init_undo_redo(), undo_redo_exports)),
86698         "../ui/tooltip.js": () => Promise.resolve().then(() => (init_tooltip(), tooltip_exports)),
86699         "../ui/top_toolbar.js": () => Promise.resolve().then(() => (init_top_toolbar(), top_toolbar_exports)),
86700         "../ui/version.js": () => Promise.resolve().then(() => (init_version(), version_exports)),
86701         "../ui/view_on_keepRight.js": () => Promise.resolve().then(() => (init_view_on_keepRight(), view_on_keepRight_exports)),
86702         "../ui/view_on_osm.js": () => Promise.resolve().then(() => (init_view_on_osm(), view_on_osm_exports)),
86703         "../ui/view_on_osmose.js": () => Promise.resolve().then(() => (init_view_on_osmose(), view_on_osmose_exports)),
86704         "../ui/zoom.js": () => Promise.resolve().then(() => (init_zoom3(), zoom_exports)),
86705         "../ui/zoom_to_selection.js": () => Promise.resolve().then(() => (init_zoom_to_selection(), zoom_to_selection_exports)),
86706         "../util/IntervalTasksQueue.js": () => Promise.resolve().then(() => (init_IntervalTasksQueue(), IntervalTasksQueue_exports)),
86707         "../util/aes.js": () => Promise.resolve().then(() => (init_aes(), aes_exports)),
86708         "../util/array.js": () => Promise.resolve().then(() => (init_array3(), array_exports)),
86709         "../util/bind_once.js": () => Promise.resolve().then(() => (init_bind_once(), bind_once_exports)),
86710         "../util/clean_tags.js": () => Promise.resolve().then(() => (init_clean_tags(), clean_tags_exports)),
86711         "../util/detect.js": () => Promise.resolve().then(() => (init_detect(), detect_exports)),
86712         "../util/dimensions.js": () => Promise.resolve().then(() => (init_dimensions(), dimensions_exports)),
86713         "../util/double_up.js": () => Promise.resolve().then(() => (init_double_up(), double_up_exports)),
86714         "../util/get_set_value.js": () => Promise.resolve().then(() => (init_get_set_value(), get_set_value_exports)),
86715         "../util/index.js": () => Promise.resolve().then(() => (init_util(), util_exports)),
86716         "../util/jxon.js": () => Promise.resolve().then(() => (init_jxon(), jxon_exports)),
86717         "../util/keybinding.js": () => Promise.resolve().then(() => (init_keybinding(), keybinding_exports)),
86718         "../util/object.js": () => Promise.resolve().then(() => (init_object2(), object_exports)),
86719         "../util/rebind.js": () => Promise.resolve().then(() => (init_rebind(), rebind_exports)),
86720         "../util/session_mutex.js": () => Promise.resolve().then(() => (init_session_mutex(), session_mutex_exports)),
86721         "../util/svg_paths_rtl_fix.js": () => Promise.resolve().then(() => (init_svg_paths_rtl_fix(), svg_paths_rtl_fix_exports)),
86722         "../util/tiler.js": () => Promise.resolve().then(() => (init_tiler(), tiler_exports)),
86723         "../util/trigger_event.js": () => Promise.resolve().then(() => (init_trigger_event(), trigger_event_exports)),
86724         "../util/units.js": () => Promise.resolve().then(() => (init_units(), units_exports)),
86725         "../util/util.js": () => Promise.resolve().then(() => (init_util2(), util_exports2)),
86726         "../util/utilDisplayLabel.js": () => Promise.resolve().then(() => (init_utilDisplayLabel(), utilDisplayLabel_exports)),
86727         "../util/zoom_pan.js": () => Promise.resolve().then(() => (init_zoom_pan(), zoom_pan_exports)),
86728         "../validations/almost_junction.js": () => Promise.resolve().then(() => (init_almost_junction(), almost_junction_exports)),
86729         "../validations/close_nodes.js": () => Promise.resolve().then(() => (init_close_nodes(), close_nodes_exports)),
86730         "../validations/crossing_ways.js": () => Promise.resolve().then(() => (init_crossing_ways(), crossing_ways_exports)),
86731         "../validations/disconnected_way.js": () => Promise.resolve().then(() => (init_disconnected_way(), disconnected_way_exports)),
86732         "../validations/help_request.js": () => Promise.resolve().then(() => (init_help_request(), help_request_exports)),
86733         "../validations/impossible_oneway.js": () => Promise.resolve().then(() => (init_impossible_oneway(), impossible_oneway_exports)),
86734         "../validations/incompatible_source.js": () => Promise.resolve().then(() => (init_incompatible_source(), incompatible_source_exports)),
86735         "../validations/index.js": () => Promise.resolve().then(() => (init_validations(), validations_exports)),
86736         "../validations/invalid_format.js": () => Promise.resolve().then(() => (init_invalid_format(), invalid_format_exports)),
86737         "../validations/maprules.js": () => Promise.resolve().then(() => (init_maprules2(), maprules_exports2)),
86738         "../validations/mismatched_geometry.js": () => Promise.resolve().then(() => (init_mismatched_geometry(), mismatched_geometry_exports)),
86739         "../validations/missing_role.js": () => Promise.resolve().then(() => (init_missing_role(), missing_role_exports)),
86740         "../validations/missing_tag.js": () => Promise.resolve().then(() => (init_missing_tag(), missing_tag_exports)),
86741         "../validations/mutually_exclusive_tags.js": () => Promise.resolve().then(() => (init_mutually_exclusive_tags(), mutually_exclusive_tags_exports)),
86742         "../validations/osm_api_limits.js": () => Promise.resolve().then(() => (init_osm_api_limits(), osm_api_limits_exports)),
86743         "../validations/outdated_tags.js": () => Promise.resolve().then(() => (init_outdated_tags(), outdated_tags_exports)),
86744         "../validations/private_data.js": () => Promise.resolve().then(() => (init_private_data(), private_data_exports)),
86745         "../validations/suspicious_name.js": () => Promise.resolve().then(() => (init_suspicious_name(), suspicious_name_exports)),
86746         "../validations/unsquare_way.js": () => Promise.resolve().then(() => (init_unsquare_way(), unsquare_way_exports))
86747       });
86748     }
86749   });
86750
86751   // modules/core/file_fetcher.js
86752   var file_fetcher_exports = {};
86753   __export(file_fetcher_exports, {
86754     coreFileFetcher: () => coreFileFetcher,
86755     fileFetcher: () => _mainFileFetcher
86756   });
86757   function coreFileFetcher() {
86758     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
86759     const v3 = (0, import_vparse2.default)(ociVersion);
86760     const ociVersionMinor = `${v3.major}.${v3.minor}`;
86761     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
86762     let _this = {};
86763     let _inflight4 = {};
86764     let _fileMap = {
86765       "address_formats": "data/address_formats.min.json",
86766       "imagery": "data/imagery.min.json",
86767       "intro_graph": "data/intro_graph.min.json",
86768       "keepRight": "data/keepRight.min.json",
86769       "languages": "data/languages.min.json",
86770       "locales": "locales/index.min.json",
86771       "phone_formats": "data/phone_formats.min.json",
86772       "qa_data": "data/qa_data.min.json",
86773       "shortcuts": "data/shortcuts.min.json",
86774       "territory_languages": "data/territory_languages.min.json",
86775       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
86776       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
86777       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
86778       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
86779       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
86780       "discarded": presetsCdnUrl + "dist/discarded.min.json",
86781       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
86782       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
86783       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
86784       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
86785       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.2") + "data/wikipedia.min.json"
86786     };
86787     let _cachedData = {};
86788     _this.cache = () => _cachedData;
86789     _this.get = (which) => {
86790       if (_cachedData[which]) {
86791         return Promise.resolve(_cachedData[which]);
86792       }
86793       const file = _fileMap[which];
86794       const url = file && _this.asset(file);
86795       if (!url) {
86796         return Promise.reject(`Unknown data file for "${which}"`);
86797       }
86798       if (url.includes("{presets_version}")) {
86799         return _this.get("presets_package").then((result) => {
86800           const presetsVersion2 = result.version;
86801           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
86802         });
86803       } else {
86804         return getUrl(url, which);
86805       }
86806     };
86807     function getUrl(url, which) {
86808       let prom = _inflight4[url];
86809       if (!prom) {
86810         _inflight4[url] = prom = (window.VITEST ? globImport(`../${url}`) : fetch(url)).then((response) => {
86811           if (window.VITEST) return response.default;
86812           if (!response.ok || !response.json) {
86813             throw new Error(response.status + " " + response.statusText);
86814           }
86815           if (response.status === 204 || response.status === 205) return;
86816           return response.json();
86817         }).then((result) => {
86818           delete _inflight4[url];
86819           if (!result) {
86820             throw new Error(`No data loaded for "${which}"`);
86821           }
86822           _cachedData[which] = result;
86823           return result;
86824         }).catch((err) => {
86825           delete _inflight4[url];
86826           throw err;
86827         });
86828       }
86829       return prom;
86830     }
86831     _this.fileMap = function(val) {
86832       if (!arguments.length) return _fileMap;
86833       _fileMap = val;
86834       return _this;
86835     };
86836     let _assetPath = "";
86837     _this.assetPath = function(val) {
86838       if (!arguments.length) return _assetPath;
86839       _assetPath = val;
86840       return _this;
86841     };
86842     let _assetMap = {};
86843     _this.assetMap = function(val) {
86844       if (!arguments.length) return _assetMap;
86845       _assetMap = val;
86846       return _this;
86847     };
86848     _this.asset = (val) => {
86849       if (/^http(s)?:\/\//i.test(val)) return val;
86850       const filename = _assetPath + val;
86851       return _assetMap[filename] || filename;
86852     };
86853     return _this;
86854   }
86855   var import_vparse2, _mainFileFetcher;
86856   var init_file_fetcher = __esm({
86857     "modules/core/file_fetcher.js"() {
86858       "use strict";
86859       import_vparse2 = __toESM(require_vparse());
86860       init_id();
86861       init_package();
86862       init_();
86863       _mainFileFetcher = coreFileFetcher();
86864     }
86865   });
86866
86867   // modules/core/localizer.js
86868   var localizer_exports = {};
86869   __export(localizer_exports, {
86870     coreLocalizer: () => coreLocalizer,
86871     localizer: () => _mainLocalizer,
86872     t: () => _t
86873   });
86874   function coreLocalizer() {
86875     let localizer = {};
86876     let _dataLanguages = {};
86877     let _dataLocales = {};
86878     let _localeStrings = {};
86879     let _localeCode = "en-US";
86880     let _localeCodes = ["en-US", "en"];
86881     let _languageCode = "en";
86882     let _textDirection = "ltr";
86883     let _usesMetric = false;
86884     let _languageNames = {};
86885     let _scriptNames = {};
86886     localizer.localeCode = () => _localeCode;
86887     localizer.localeCodes = () => _localeCodes;
86888     localizer.languageCode = () => _languageCode;
86889     localizer.textDirection = () => _textDirection;
86890     localizer.usesMetric = () => _usesMetric;
86891     localizer.languageNames = () => _languageNames;
86892     localizer.scriptNames = () => _scriptNames;
86893     let _preferredLocaleCodes = [];
86894     localizer.preferredLocaleCodes = function(codes) {
86895       if (!arguments.length) return _preferredLocaleCodes;
86896       if (typeof codes === "string") {
86897         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
86898       } else {
86899         _preferredLocaleCodes = codes;
86900       }
86901       return localizer;
86902     };
86903     var _loadPromise;
86904     localizer.ensureLoaded = () => {
86905       if (_loadPromise) return _loadPromise;
86906       let filesToFetch = [
86907         "languages",
86908         // load the list of languages
86909         "locales"
86910         // load the list of supported locales
86911       ];
86912       const localeDirs = {
86913         general: "locales",
86914         tagging: presetsCdnUrl + "dist/translations"
86915       };
86916       let fileMap = _mainFileFetcher.fileMap();
86917       for (let scopeId in localeDirs) {
86918         const key = `locales_index_${scopeId}`;
86919         if (!fileMap[key]) {
86920           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
86921         }
86922         filesToFetch.push(key);
86923       }
86924       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
86925         _dataLanguages = results[0];
86926         _dataLocales = results[1];
86927         let indexes = results.slice(2);
86928         _localeCodes = localizer.localesToUseFrom(_dataLocales);
86929         _localeCode = _localeCodes[0];
86930         let loadStringsPromises = [];
86931         indexes.forEach((index, i3) => {
86932           const fullCoverageIndex = _localeCodes.findIndex(function(locale3) {
86933             return index[locale3] && index[locale3].pct === 1;
86934           });
86935           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
86936             let scopeId = Object.keys(localeDirs)[i3];
86937             let directory = Object.values(localeDirs)[i3];
86938             if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
86939           });
86940         });
86941         return Promise.all(loadStringsPromises);
86942       }).then(() => {
86943         updateForCurrentLocale();
86944       }).catch((err) => console.error(err));
86945     };
86946     localizer.localesToUseFrom = (supportedLocales) => {
86947       const requestedLocales = [
86948         ..._preferredLocaleCodes || [],
86949         ...utilDetect().browserLocales,
86950         // List of locales preferred by the browser in priority order.
86951         "en"
86952         // fallback to English since it's the only guaranteed complete language
86953       ];
86954       let toUse = [];
86955       for (const locale3 of requestedLocales) {
86956         if (supportedLocales[locale3]) toUse.push(locale3);
86957         if ("Intl" in window && "Locale" in window.Intl) {
86958           const localeObj = new Intl.Locale(locale3);
86959           const withoutScript = `${localeObj.language}-${localeObj.region}`;
86960           const base = localeObj.language;
86961           if (supportedLocales[withoutScript]) toUse.push(withoutScript);
86962           if (supportedLocales[base]) toUse.push(base);
86963         } else if (locale3.includes("-")) {
86964           let langPart = locale3.split("-")[0];
86965           if (supportedLocales[langPart]) toUse.push(langPart);
86966         }
86967       }
86968       return utilArrayUniq(toUse);
86969     };
86970     function updateForCurrentLocale() {
86971       if (!_localeCode) return;
86972       _languageCode = _localeCode.split("-")[0];
86973       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
86974       const hash2 = utilStringQs(window.location.hash);
86975       if (hash2.rtl === "true") {
86976         _textDirection = "rtl";
86977       } else if (hash2.rtl === "false") {
86978         _textDirection = "ltr";
86979       } else {
86980         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
86981       }
86982       let locale3 = _localeCode;
86983       if (locale3.toLowerCase() === "en-us") locale3 = "en";
86984       _languageNames = _localeStrings.general[locale3].languageNames || _localeStrings.general[_languageCode].languageNames;
86985       _scriptNames = _localeStrings.general[locale3].scriptNames || _localeStrings.general[_languageCode].scriptNames;
86986       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
86987     }
86988     localizer.loadLocale = (locale3, scopeId, directory) => {
86989       if (locale3.toLowerCase() === "en-us") locale3 = "en";
86990       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale3]) {
86991         return Promise.resolve(locale3);
86992       }
86993       let fileMap = _mainFileFetcher.fileMap();
86994       const key = `locale_${scopeId}_${locale3}`;
86995       if (!fileMap[key]) {
86996         fileMap[key] = `${directory}/${locale3}.min.json`;
86997       }
86998       return _mainFileFetcher.get(key).then((d2) => {
86999         if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
87000         _localeStrings[scopeId][locale3] = d2[locale3];
87001         return locale3;
87002       });
87003     };
87004     localizer.pluralRule = function(number3) {
87005       return pluralRule(number3, _localeCode);
87006     };
87007     function pluralRule(number3, localeCode) {
87008       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
87009       if (rules) {
87010         return rules.select(number3);
87011       }
87012       if (number3 === 1) return "one";
87013       return "other";
87014     }
87015     localizer.tInfo = function(origStringId, replacements, locale3) {
87016       let stringId = origStringId.trim();
87017       let scopeId = "general";
87018       if (stringId[0] === "_") {
87019         let split = stringId.split(".");
87020         scopeId = split[0].slice(1);
87021         stringId = split.slice(1).join(".");
87022       }
87023       locale3 = locale3 || _localeCode;
87024       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
87025       let stringsKey = locale3;
87026       if (stringsKey.toLowerCase() === "en-us") stringsKey = "en";
87027       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
87028       while (result !== void 0 && path.length) {
87029         result = result[path.pop()];
87030       }
87031       if (result !== void 0) {
87032         if (replacements) {
87033           if (typeof result === "object" && Object.keys(result).length) {
87034             const number3 = Object.values(replacements).find(function(value) {
87035               return typeof value === "number";
87036             });
87037             if (number3 !== void 0) {
87038               const rule = pluralRule(number3, locale3);
87039               if (result[rule]) {
87040                 result = result[rule];
87041               } else {
87042                 result = Object.values(result)[0];
87043               }
87044             }
87045           }
87046           if (typeof result === "string") {
87047             for (let key in replacements) {
87048               let value = replacements[key];
87049               if (typeof value === "number") {
87050                 if (value.toLocaleString) {
87051                   value = value.toLocaleString(locale3, {
87052                     style: "decimal",
87053                     useGrouping: true,
87054                     minimumFractionDigits: 0
87055                   });
87056                 } else {
87057                   value = value.toString();
87058                 }
87059               }
87060               const token = `{${key}}`;
87061               const regex = new RegExp(token, "g");
87062               result = result.replace(regex, value);
87063             }
87064           }
87065         }
87066         if (typeof result === "string") {
87067           return {
87068             text: result,
87069             locale: locale3
87070           };
87071         }
87072       }
87073       let index = _localeCodes.indexOf(locale3);
87074       if (index >= 0 && index < _localeCodes.length - 1) {
87075         let fallback = _localeCodes[index + 1];
87076         return localizer.tInfo(origStringId, replacements, fallback);
87077       }
87078       if (replacements && "default" in replacements) {
87079         return {
87080           text: replacements.default,
87081           locale: null
87082         };
87083       }
87084       const missing = `Missing ${locale3} translation: ${origStringId}`;
87085       if (typeof console !== "undefined") console.error(missing);
87086       return {
87087         text: missing,
87088         locale: "en"
87089       };
87090     };
87091     localizer.hasTextForStringId = function(stringId) {
87092       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
87093     };
87094     localizer.t = function(stringId, replacements, locale3) {
87095       return localizer.tInfo(stringId, replacements, locale3).text;
87096     };
87097     localizer.t.html = function(stringId, replacements, locale3) {
87098       replacements = Object.assign({}, replacements);
87099       for (var k3 in replacements) {
87100         if (typeof replacements[k3] === "string") {
87101           replacements[k3] = escape_default(replacements[k3]);
87102         }
87103         if (typeof replacements[k3] === "object" && typeof replacements[k3].html === "string") {
87104           replacements[k3] = replacements[k3].html;
87105         }
87106       }
87107       const info = localizer.tInfo(stringId, replacements, locale3);
87108       if (info.text) {
87109         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
87110       } else {
87111         return "";
87112       }
87113     };
87114     localizer.t.append = function(stringId, replacements, locale3) {
87115       const ret = function(selection2) {
87116         const info = localizer.tInfo(stringId, replacements, locale3);
87117         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
87118       };
87119       ret.stringId = stringId;
87120       return ret;
87121     };
87122     localizer.t.addOrUpdate = function(stringId, replacements, locale3) {
87123       const ret = function(selection2) {
87124         const info = localizer.tInfo(stringId, replacements, locale3);
87125         const span = selection2.selectAll("span.localized-text").data([info]);
87126         const enter = span.enter().append("span").classed("localized-text", true);
87127         span.merge(enter).attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
87128       };
87129       ret.stringId = stringId;
87130       return ret;
87131     };
87132     localizer.languageName = (code, options) => {
87133       if (_languageNames && _languageNames[code]) {
87134         return _languageNames[code];
87135       }
87136       if (options && options.localOnly) return null;
87137       const langInfo = _dataLanguages[code];
87138       if (langInfo) {
87139         if (langInfo.nativeName) {
87140           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
87141         } else if (langInfo.base && langInfo.script) {
87142           const base = langInfo.base;
87143           if (_languageNames && _languageNames[base]) {
87144             const scriptCode = langInfo.script;
87145             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
87146             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
87147           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
87148             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
87149           }
87150         }
87151       }
87152       return code;
87153     };
87154     localizer.floatFormatter = (locale3) => {
87155       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
87156         return (number3, fractionDigits) => {
87157           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
87158         };
87159       } else {
87160         return (number3, fractionDigits) => number3.toLocaleString(locale3, {
87161           minimumFractionDigits: fractionDigits,
87162           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
87163         });
87164       }
87165     };
87166     localizer.floatParser = (locale3) => {
87167       const polyfill = (string) => +string.trim();
87168       if (!("Intl" in window && "NumberFormat" in Intl)) return polyfill;
87169       const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
87170       if (!("formatToParts" in format2)) return polyfill;
87171       const parts = format2.formatToParts(-12345.6);
87172       const numerals = Array.from({ length: 10 }).map((_3, i3) => format2.format(i3));
87173       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
87174       const literalPart = parts.find((d2) => d2.type === "literal");
87175       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
87176       const groupPart = parts.find((d2) => d2.type === "group");
87177       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
87178       const decimalPart = parts.find((d2) => d2.type === "decimal");
87179       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
87180       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
87181       const getIndex = (d2) => index.get(d2);
87182       return (string) => {
87183         string = string.trim();
87184         if (literal) string = string.replace(literal, "");
87185         if (group) string = string.replace(group, "");
87186         if (decimal) string = string.replace(decimal, ".");
87187         string = string.replace(numeral, getIndex);
87188         return string ? +string : NaN;
87189       };
87190     };
87191     localizer.decimalPlaceCounter = (locale3) => {
87192       var literal, group, decimal;
87193       if ("Intl" in window && "NumberFormat" in Intl) {
87194         const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
87195         if ("formatToParts" in format2) {
87196           const parts = format2.formatToParts(-12345.6);
87197           const literalPart = parts.find((d2) => d2.type === "literal");
87198           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
87199           const groupPart = parts.find((d2) => d2.type === "group");
87200           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
87201           const decimalPart = parts.find((d2) => d2.type === "decimal");
87202           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
87203         }
87204       }
87205       return (string) => {
87206         string = string.trim();
87207         if (literal) string = string.replace(literal, "");
87208         if (group) string = string.replace(group, "");
87209         const parts = string.split(decimal || ".");
87210         return parts && parts[1] && parts[1].length || 0;
87211       };
87212     };
87213     return localizer;
87214   }
87215   var _mainLocalizer, _t;
87216   var init_localizer = __esm({
87217     "modules/core/localizer.js"() {
87218       "use strict";
87219       init_lodash();
87220       init_file_fetcher();
87221       init_detect();
87222       init_util();
87223       init_array3();
87224       init_id();
87225       _mainLocalizer = coreLocalizer();
87226       _t = _mainLocalizer.t;
87227     }
87228   });
87229
87230   // modules/util/util.js
87231   var util_exports2 = {};
87232   __export(util_exports2, {
87233     utilAsyncMap: () => utilAsyncMap,
87234     utilCleanOsmString: () => utilCleanOsmString,
87235     utilCombinedTags: () => utilCombinedTags,
87236     utilCompareIDs: () => utilCompareIDs,
87237     utilDeepMemberSelector: () => utilDeepMemberSelector,
87238     utilDisplayName: () => utilDisplayName,
87239     utilDisplayNameForPath: () => utilDisplayNameForPath,
87240     utilDisplayType: () => utilDisplayType,
87241     utilEditDistance: () => utilEditDistance,
87242     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
87243     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
87244     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
87245     utilEntityRoot: () => utilEntityRoot,
87246     utilEntitySelector: () => utilEntitySelector,
87247     utilFastMouse: () => utilFastMouse,
87248     utilFunctor: () => utilFunctor,
87249     utilGetAllNodes: () => utilGetAllNodes,
87250     utilHashcode: () => utilHashcode,
87251     utilHighlightEntities: () => utilHighlightEntities,
87252     utilNoAuto: () => utilNoAuto,
87253     utilOldestID: () => utilOldestID,
87254     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
87255     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
87256     utilQsString: () => utilQsString,
87257     utilSafeClassName: () => utilSafeClassName,
87258     utilSetTransform: () => utilSetTransform,
87259     utilStringQs: () => utilStringQs,
87260     utilTagDiff: () => utilTagDiff,
87261     utilTagText: () => utilTagText,
87262     utilTotalExtent: () => utilTotalExtent,
87263     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
87264     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
87265     utilUniqueDomId: () => utilUniqueDomId,
87266     utilWrap: () => utilWrap
87267   });
87268   function utilTagText(entity) {
87269     var obj = entity && entity.tags || {};
87270     return Object.keys(obj).map(function(k3) {
87271       return k3 + "=" + obj[k3];
87272     }).join(", ");
87273   }
87274   function utilTotalExtent(array2, graph) {
87275     var extent = geoExtent();
87276     var val, entity;
87277     for (var i3 = 0; i3 < array2.length; i3++) {
87278       val = array2[i3];
87279       entity = typeof val === "string" ? graph.hasEntity(val) : val;
87280       if (entity) {
87281         extent._extend(entity.extent(graph));
87282       }
87283     }
87284     return extent;
87285   }
87286   function utilTagDiff(oldTags, newTags) {
87287     var tagDiff = [];
87288     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
87289     keys2.forEach(function(k3) {
87290       var oldVal = oldTags[k3];
87291       var newVal = newTags[k3];
87292       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
87293         tagDiff.push({
87294           type: "-",
87295           key: k3,
87296           oldVal,
87297           newVal,
87298           display: "- " + k3 + "=" + oldVal
87299         });
87300       }
87301       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
87302         tagDiff.push({
87303           type: "+",
87304           key: k3,
87305           oldVal,
87306           newVal,
87307           display: "+ " + k3 + "=" + newVal
87308         });
87309       }
87310     });
87311     return tagDiff;
87312   }
87313   function utilEntitySelector(ids) {
87314     return ids.length ? "." + ids.join(",.") : "nothing";
87315   }
87316   function utilEntityOrMemberSelector(ids, graph) {
87317     var seen = new Set(ids);
87318     ids.forEach(collectShallowDescendants);
87319     return utilEntitySelector(Array.from(seen));
87320     function collectShallowDescendants(id2) {
87321       var entity = graph.hasEntity(id2);
87322       if (!entity || entity.type !== "relation") return;
87323       entity.members.map(function(member) {
87324         return member.id;
87325       }).forEach(function(id3) {
87326         seen.add(id3);
87327       });
87328     }
87329   }
87330   function utilEntityOrDeepMemberSelector(ids, graph) {
87331     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
87332   }
87333   function utilEntityAndDeepMemberIDs(ids, graph) {
87334     var seen = /* @__PURE__ */ new Set();
87335     ids.forEach(collectDeepDescendants);
87336     return Array.from(seen);
87337     function collectDeepDescendants(id2) {
87338       if (seen.has(id2)) return;
87339       seen.add(id2);
87340       var entity = graph.hasEntity(id2);
87341       if (!entity || entity.type !== "relation") return;
87342       entity.members.map(function(member) {
87343         return member.id;
87344       }).forEach(collectDeepDescendants);
87345     }
87346   }
87347   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
87348     var idsSet = new Set(ids);
87349     var seen = /* @__PURE__ */ new Set();
87350     var returners = /* @__PURE__ */ new Set();
87351     ids.forEach(collectDeepDescendants);
87352     return utilEntitySelector(Array.from(returners));
87353     function collectDeepDescendants(id2) {
87354       if (seen.has(id2)) return;
87355       seen.add(id2);
87356       if (!idsSet.has(id2)) {
87357         returners.add(id2);
87358       }
87359       var entity = graph.hasEntity(id2);
87360       if (!entity || entity.type !== "relation") return;
87361       if (skipMultipolgonMembers && entity.isMultipolygon()) return;
87362       entity.members.map(function(member) {
87363         return member.id;
87364       }).forEach(collectDeepDescendants);
87365     }
87366   }
87367   function utilHighlightEntities(ids, highlighted, context) {
87368     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
87369   }
87370   function utilGetAllNodes(ids, graph) {
87371     var seen = /* @__PURE__ */ new Set();
87372     var nodes = /* @__PURE__ */ new Set();
87373     ids.forEach(collectNodes);
87374     return Array.from(nodes);
87375     function collectNodes(id2) {
87376       if (seen.has(id2)) return;
87377       seen.add(id2);
87378       var entity = graph.hasEntity(id2);
87379       if (!entity) return;
87380       if (entity.type === "node") {
87381         nodes.add(entity);
87382       } else if (entity.type === "way") {
87383         entity.nodes.forEach(collectNodes);
87384       } else {
87385         entity.members.map(function(member) {
87386           return member.id;
87387         }).forEach(collectNodes);
87388       }
87389     }
87390   }
87391   function utilDisplayName(entity, hideNetwork) {
87392     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
87393     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
87394     var tags = {
87395       addr: entity.tags["addr:housenumber"] || entity.tags["addr:housename"],
87396       direction: entity.tags.direction,
87397       from: entity.tags.from,
87398       name,
87399       network: hideNetwork ? void 0 : entity.tags.cycle_network || entity.tags.network,
87400       ref: entity.tags.ref,
87401       to: entity.tags.to,
87402       via: entity.tags.via
87403     };
87404     if (entity.tags.route && entity.tags.name && entity.tags.name.match(/[→⇒↔⇔]|[-=]>/)) {
87405       return entity.tags.name;
87406     }
87407     if (!entity.tags.route && name) {
87408       return name;
87409     }
87410     if (tags.addr) {
87411       return tags.addr;
87412     }
87413     var keyComponents = [];
87414     if (tags.network) {
87415       keyComponents.push("network");
87416     }
87417     if (tags.ref) {
87418       keyComponents.push("ref");
87419     }
87420     if (tags.name) {
87421       keyComponents.push("name");
87422     }
87423     if (entity.tags.route) {
87424       if (tags.direction) {
87425         keyComponents.push("direction");
87426       } else if (tags.from && tags.to) {
87427         keyComponents.push("from");
87428         keyComponents.push("to");
87429         if (tags.via) {
87430           keyComponents.push("via");
87431         }
87432       }
87433     }
87434     if (keyComponents.length) {
87435       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
87436     }
87437     return name;
87438   }
87439   function utilDisplayNameForPath(entity) {
87440     var name = utilDisplayName(entity);
87441     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
87442     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
87443     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
87444       name = fixRTLTextForSvg(name);
87445     }
87446     return name;
87447   }
87448   function utilDisplayType(id2) {
87449     return {
87450       n: _t("inspector.node"),
87451       w: _t("inspector.way"),
87452       r: _t("inspector.relation")
87453     }[id2.charAt(0)];
87454   }
87455   function utilEntityRoot(entityType) {
87456     return {
87457       node: "n",
87458       way: "w",
87459       relation: "r"
87460     }[entityType];
87461   }
87462   function utilCombinedTags(entityIDs, graph) {
87463     var tags = {};
87464     var tagCounts = {};
87465     var allKeys = /* @__PURE__ */ new Set();
87466     var allTags = [];
87467     var entities = entityIDs.map(function(entityID) {
87468       return graph.hasEntity(entityID);
87469     }).filter(Boolean);
87470     entities.forEach(function(entity) {
87471       var keys2 = Object.keys(entity.tags).filter(Boolean);
87472       keys2.forEach(function(key2) {
87473         allKeys.add(key2);
87474       });
87475     });
87476     entities.forEach(function(entity) {
87477       allTags.push(entity.tags);
87478       allKeys.forEach(function(key2) {
87479         var value = entity.tags[key2];
87480         if (!tags.hasOwnProperty(key2)) {
87481           tags[key2] = value;
87482         } else {
87483           if (!Array.isArray(tags[key2])) {
87484             if (tags[key2] !== value) {
87485               tags[key2] = [tags[key2], value];
87486             }
87487           } else {
87488             if (tags[key2].indexOf(value) === -1) {
87489               tags[key2].push(value);
87490             }
87491           }
87492         }
87493         var tagHash = key2 + "=" + value;
87494         if (!tagCounts[tagHash]) tagCounts[tagHash] = 0;
87495         tagCounts[tagHash] += 1;
87496       });
87497     });
87498     for (var key in tags) {
87499       if (!Array.isArray(tags[key])) continue;
87500       tags[key] = tags[key].sort(function(val12, val2) {
87501         var key2 = key2;
87502         var count2 = tagCounts[key2 + "=" + val2];
87503         var count1 = tagCounts[key2 + "=" + val12];
87504         if (count2 !== count1) {
87505           return count2 - count1;
87506         }
87507         if (val2 && val12) {
87508           return val12.localeCompare(val2);
87509         }
87510         return val12 ? 1 : -1;
87511       });
87512     }
87513     tags = Object.defineProperty(tags, Symbol.for("allTags"), { enumerable: false, value: allTags });
87514     return tags;
87515   }
87516   function utilStringQs(str) {
87517     str = str.replace(/^[#?]{0,2}/, "");
87518     return Object.fromEntries(new URLSearchParams(str));
87519   }
87520   function utilQsString(obj, softEncode) {
87521     let str = new URLSearchParams(obj).toString();
87522     if (softEncode) {
87523       str = str.replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
87524     }
87525     return str;
87526   }
87527   function utilPrefixDOMProperty(property) {
87528     var prefixes2 = ["webkit", "ms", "moz", "o"];
87529     var i3 = -1;
87530     var n3 = prefixes2.length;
87531     var s2 = document.body;
87532     if (property in s2) return property;
87533     property = property.slice(0, 1).toUpperCase() + property.slice(1);
87534     while (++i3 < n3) {
87535       if (prefixes2[i3] + property in s2) {
87536         return prefixes2[i3] + property;
87537       }
87538     }
87539     return false;
87540   }
87541   function utilPrefixCSSProperty(property) {
87542     var prefixes2 = ["webkit", "ms", "Moz", "O"];
87543     var i3 = -1;
87544     var n3 = prefixes2.length;
87545     var s2 = document.body.style;
87546     if (property.toLowerCase() in s2) {
87547       return property.toLowerCase();
87548     }
87549     while (++i3 < n3) {
87550       if (prefixes2[i3] + property in s2) {
87551         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
87552       }
87553     }
87554     return false;
87555   }
87556   function utilSetTransform(el, x2, y2, scale) {
87557     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
87558     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
87559     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
87560   }
87561   function utilEditDistance(a4, b3) {
87562     a4 = (0, import_diacritics3.remove)(a4.toLowerCase());
87563     b3 = (0, import_diacritics3.remove)(b3.toLowerCase());
87564     if (a4.length === 0) return b3.length;
87565     if (b3.length === 0) return a4.length;
87566     var matrix = [];
87567     var i3, j3;
87568     for (i3 = 0; i3 <= b3.length; i3++) {
87569       matrix[i3] = [i3];
87570     }
87571     for (j3 = 0; j3 <= a4.length; j3++) {
87572       matrix[0][j3] = j3;
87573     }
87574     for (i3 = 1; i3 <= b3.length; i3++) {
87575       for (j3 = 1; j3 <= a4.length; j3++) {
87576         if (b3.charAt(i3 - 1) === a4.charAt(j3 - 1)) {
87577           matrix[i3][j3] = matrix[i3 - 1][j3 - 1];
87578         } else {
87579           matrix[i3][j3] = Math.min(
87580             matrix[i3 - 1][j3 - 1] + 1,
87581             // substitution
87582             Math.min(
87583               matrix[i3][j3 - 1] + 1,
87584               // insertion
87585               matrix[i3 - 1][j3] + 1
87586             )
87587           );
87588         }
87589       }
87590     }
87591     return matrix[b3.length][a4.length];
87592   }
87593   function utilFastMouse(container) {
87594     var rect = container.getBoundingClientRect();
87595     var rectLeft = rect.left;
87596     var rectTop = rect.top;
87597     var clientLeft = +container.clientLeft;
87598     var clientTop = +container.clientTop;
87599     return function(e3) {
87600       return [
87601         e3.clientX - rectLeft - clientLeft,
87602         e3.clientY - rectTop - clientTop
87603       ];
87604     };
87605   }
87606   function utilAsyncMap(inputs, func, callback) {
87607     var remaining = inputs.length;
87608     var results = [];
87609     var errors = [];
87610     inputs.forEach(function(d2, i3) {
87611       func(d2, function done(err, data) {
87612         errors[i3] = err;
87613         results[i3] = data;
87614         remaining--;
87615         if (!remaining) callback(errors, results);
87616       });
87617     });
87618   }
87619   function utilWrap(index, length2) {
87620     if (index < 0) {
87621       index += Math.ceil(-index / length2) * length2;
87622     }
87623     return index % length2;
87624   }
87625   function utilFunctor(value) {
87626     if (typeof value === "function") return value;
87627     return function() {
87628       return value;
87629     };
87630   }
87631   function utilNoAuto(selection2) {
87632     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
87633     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");
87634   }
87635   function utilHashcode(str) {
87636     var hash2 = 0;
87637     if (str.length === 0) {
87638       return hash2;
87639     }
87640     for (var i3 = 0; i3 < str.length; i3++) {
87641       var char = str.charCodeAt(i3);
87642       hash2 = (hash2 << 5) - hash2 + char;
87643       hash2 = hash2 & hash2;
87644     }
87645     return hash2;
87646   }
87647   function utilSafeClassName(str) {
87648     return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
87649   }
87650   function utilUniqueDomId(val) {
87651     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
87652   }
87653   function utilUnicodeCharsCount(str) {
87654     return Array.from(str).length;
87655   }
87656   function utilUnicodeCharsTruncated(str, limit) {
87657     return Array.from(str).slice(0, limit).join("");
87658   }
87659   function toNumericID(id2) {
87660     var match = id2.match(/^[cnwr](-?\d+)$/);
87661     if (match) {
87662       return parseInt(match[1], 10);
87663     }
87664     return NaN;
87665   }
87666   function compareNumericIDs(left, right) {
87667     if (isNaN(left) && isNaN(right)) return -1;
87668     if (isNaN(left)) return 1;
87669     if (isNaN(right)) return -1;
87670     if (Math.sign(left) !== Math.sign(right)) return -Math.sign(left);
87671     if (Math.sign(left) < 0) return Math.sign(right - left);
87672     return Math.sign(left - right);
87673   }
87674   function utilCompareIDs(left, right) {
87675     return compareNumericIDs(toNumericID(left), toNumericID(right));
87676   }
87677   function utilOldestID(ids) {
87678     if (ids.length === 0) {
87679       return void 0;
87680     }
87681     var oldestIDIndex = 0;
87682     var oldestID = toNumericID(ids[0]);
87683     for (var i3 = 1; i3 < ids.length; i3++) {
87684       var num = toNumericID(ids[i3]);
87685       if (compareNumericIDs(oldestID, num) === 1) {
87686         oldestIDIndex = i3;
87687         oldestID = num;
87688       }
87689     }
87690     return ids[oldestIDIndex];
87691   }
87692   function utilCleanOsmString(val, maxChars) {
87693     if (val === void 0 || val === null) {
87694       val = "";
87695     } else {
87696       val = val.toString();
87697     }
87698     val = val.trim();
87699     if (val.normalize) val = val.normalize("NFC");
87700     return utilUnicodeCharsTruncated(val, maxChars);
87701   }
87702   var import_diacritics3, transformProperty;
87703   var init_util2 = __esm({
87704     "modules/util/util.js"() {
87705       "use strict";
87706       import_diacritics3 = __toESM(require_diacritics());
87707       init_svg_paths_rtl_fix();
87708       init_localizer();
87709       init_array3();
87710       init_detect();
87711       init_extent();
87712     }
87713   });
87714
87715   // modules/osm/entity.js
87716   var entity_exports = {};
87717   __export(entity_exports, {
87718     osmEntity: () => osmEntity
87719   });
87720   function osmEntity(attrs) {
87721     if (this instanceof osmEntity) return;
87722     if (attrs && attrs.type) {
87723       return osmEntity[attrs.type].apply(this, arguments);
87724     } else if (attrs && attrs.id) {
87725       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
87726     }
87727     return new osmEntity().initialize(arguments);
87728   }
87729   var init_entity = __esm({
87730     "modules/osm/entity.js"() {
87731       "use strict";
87732       init_index();
87733       init_tags();
87734       init_array3();
87735       init_util2();
87736       osmEntity.id = function(type2) {
87737         return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
87738       };
87739       osmEntity.id.next = {
87740         changeset: -1,
87741         node: -1,
87742         way: -1,
87743         relation: -1
87744       };
87745       osmEntity.id.fromOSM = function(type2, id2) {
87746         return type2[0] + id2;
87747       };
87748       osmEntity.id.toOSM = function(id2) {
87749         var match = id2.match(/^[cnwr](-?\d+)$/);
87750         if (match) {
87751           return match[1];
87752         }
87753         return "";
87754       };
87755       osmEntity.id.type = function(id2) {
87756         return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
87757       };
87758       osmEntity.key = function(entity) {
87759         return entity.id + "v" + (entity.v || 0);
87760       };
87761       osmEntity.prototype = {
87762         /** @type {Tags} */
87763         tags: {},
87764         /** @type {String} */
87765         id: void 0,
87766         initialize: function(sources) {
87767           for (var i3 = 0; i3 < sources.length; ++i3) {
87768             var source = sources[i3];
87769             for (var prop in source) {
87770               if (Object.prototype.hasOwnProperty.call(source, prop)) {
87771                 if (source[prop] === void 0) {
87772                   delete this[prop];
87773                 } else {
87774                   this[prop] = source[prop];
87775                 }
87776               }
87777             }
87778           }
87779           if (!this.id && this.type) {
87780             this.id = osmEntity.id(this.type);
87781           }
87782           if (!this.hasOwnProperty("visible")) {
87783             this.visible = true;
87784           }
87785           if (debug) {
87786             Object.freeze(this);
87787             Object.freeze(this.tags);
87788             if (this.loc) Object.freeze(this.loc);
87789             if (this.nodes) Object.freeze(this.nodes);
87790             if (this.members) Object.freeze(this.members);
87791           }
87792           return this;
87793         },
87794         copy: function(resolver, copies) {
87795           if (copies[this.id]) return copies[this.id];
87796           var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
87797           copies[this.id] = copy2;
87798           return copy2;
87799         },
87800         osmId: function() {
87801           return osmEntity.id.toOSM(this.id);
87802         },
87803         isNew: function() {
87804           var osmId = osmEntity.id.toOSM(this.id);
87805           return osmId.length === 0 || osmId[0] === "-";
87806         },
87807         update: function(attrs) {
87808           return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
87809         },
87810         /**
87811          *
87812          * @param {Tags} tags tags to merge into this entity's tags
87813          * @param {Tags} setTags (optional) a set of tags to overwrite in this entity's tags
87814          * @returns {iD.OsmEntity}
87815          */
87816         mergeTags: function(tags, setTags = {}) {
87817           const merged = Object.assign({}, this.tags);
87818           let changed = false;
87819           for (const k3 in tags) {
87820             if (setTags.hasOwnProperty(k3)) continue;
87821             const t12 = this.tags[k3];
87822             const t2 = tags[k3];
87823             if (!t12) {
87824               changed = true;
87825               merged[k3] = t2;
87826             } else if (t12 !== t2) {
87827               changed = true;
87828               merged[k3] = utilUnicodeCharsTruncated(
87829                 utilArrayUnion(t12.split(/;\s*/), t2.split(/;\s*/)).join(";"),
87830                 255
87831                 // avoid exceeding character limit; see also context.maxCharsForTagValue()
87832               );
87833             }
87834           }
87835           for (const k3 in setTags) {
87836             if (this.tags[k3] !== setTags[k3]) {
87837               changed = true;
87838               merged[k3] = setTags[k3];
87839             }
87840           }
87841           return changed ? this.update({ tags: merged }) : this;
87842         },
87843         intersects: function(extent, resolver) {
87844           return this.extent(resolver).intersects(extent);
87845         },
87846         hasNonGeometryTags: function() {
87847           return Object.keys(this.tags).some(function(k3) {
87848             return k3 !== "area";
87849           });
87850         },
87851         hasParentRelations: function(resolver) {
87852           return resolver.parentRelations(this).length > 0;
87853         },
87854         hasInterestingTags: function() {
87855           return Object.keys(this.tags).some(osmIsInterestingTag);
87856         },
87857         isDegenerate: function() {
87858           return true;
87859         }
87860       };
87861     }
87862   });
87863
87864   // modules/osm/way.js
87865   var way_exports = {};
87866   __export(way_exports, {
87867     osmWay: () => osmWay
87868   });
87869   function osmWay() {
87870     if (!(this instanceof osmWay)) {
87871       return new osmWay().initialize(arguments);
87872     } else if (arguments.length) {
87873       this.initialize(arguments);
87874     }
87875   }
87876   function noRepeatNodes(node, i3, arr) {
87877     return i3 === 0 || node !== arr[i3 - 1];
87878   }
87879   var prototype3;
87880   var init_way = __esm({
87881     "modules/osm/way.js"() {
87882       "use strict";
87883       init_src2();
87884       init_geo2();
87885       init_entity();
87886       init_lanes();
87887       init_tags();
87888       init_util();
87889       osmEntity.way = osmWay;
87890       osmWay.prototype = Object.create(osmEntity.prototype);
87891       prototype3 = {
87892         type: "way",
87893         nodes: [],
87894         copy: function(resolver, copies) {
87895           if (copies[this.id]) return copies[this.id];
87896           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
87897           var nodes = this.nodes.map(function(id2) {
87898             return resolver.entity(id2).copy(resolver, copies).id;
87899           });
87900           copy2 = copy2.update({ nodes });
87901           copies[this.id] = copy2;
87902           return copy2;
87903         },
87904         extent: function(resolver) {
87905           return resolver.transient(this, "extent", function() {
87906             var extent = geoExtent();
87907             for (var i3 = 0; i3 < this.nodes.length; i3++) {
87908               var node = resolver.hasEntity(this.nodes[i3]);
87909               if (node) {
87910                 extent._extend(node.extent());
87911               }
87912             }
87913             return extent;
87914           });
87915         },
87916         first: function() {
87917           return this.nodes[0];
87918         },
87919         last: function() {
87920           return this.nodes[this.nodes.length - 1];
87921         },
87922         contains: function(node) {
87923           return this.nodes.indexOf(node) >= 0;
87924         },
87925         affix: function(node) {
87926           if (this.nodes[0] === node) return "prefix";
87927           if (this.nodes[this.nodes.length - 1] === node) return "suffix";
87928         },
87929         layer: function() {
87930           if (isFinite(this.tags.layer)) {
87931             return Math.max(-10, Math.min(+this.tags.layer, 10));
87932           }
87933           if (this.tags.covered === "yes") return -1;
87934           if (this.tags.location === "overground") return 1;
87935           if (this.tags.location === "underground") return -1;
87936           if (this.tags.location === "underwater") return -10;
87937           if (this.tags.power === "line") return 10;
87938           if (this.tags.power === "minor_line") return 10;
87939           if (this.tags.aerialway) return 10;
87940           if (this.tags.bridge) return 1;
87941           if (this.tags.cutting) return -1;
87942           if (this.tags.tunnel) return -1;
87943           if (this.tags.waterway) return -1;
87944           if (this.tags.man_made === "pipeline") return -10;
87945           if (this.tags.boundary) return -10;
87946           return 0;
87947         },
87948         // the approximate width of the line based on its tags except its `width` tag
87949         impliedLineWidthMeters: function() {
87950           var averageWidths = {
87951             highway: {
87952               // width is for single lane
87953               motorway: 5,
87954               motorway_link: 5,
87955               trunk: 4.5,
87956               trunk_link: 4.5,
87957               primary: 4,
87958               secondary: 4,
87959               tertiary: 4,
87960               primary_link: 4,
87961               secondary_link: 4,
87962               tertiary_link: 4,
87963               unclassified: 4,
87964               road: 4,
87965               living_street: 4,
87966               bus_guideway: 4,
87967               busway: 4,
87968               pedestrian: 4,
87969               residential: 3.5,
87970               service: 3.5,
87971               track: 3,
87972               cycleway: 2.5,
87973               bridleway: 2,
87974               corridor: 2,
87975               steps: 2,
87976               path: 1.5,
87977               footway: 1.5,
87978               ladder: 0.5
87979             },
87980             railway: {
87981               // width includes ties and rail bed, not just track gauge
87982               rail: 2.5,
87983               light_rail: 2.5,
87984               tram: 2.5,
87985               subway: 2.5,
87986               monorail: 2.5,
87987               funicular: 2.5,
87988               disused: 2.5,
87989               preserved: 2.5,
87990               miniature: 1.5,
87991               narrow_gauge: 1.5
87992             },
87993             waterway: {
87994               river: 50,
87995               canal: 25,
87996               stream: 5,
87997               tidal_channel: 5,
87998               fish_pass: 2.5,
87999               drain: 2.5,
88000               ditch: 1.5
88001             }
88002           };
88003           for (var key in averageWidths) {
88004             if (this.tags[key] && averageWidths[key][this.tags[key]]) {
88005               var width = averageWidths[key][this.tags[key]];
88006               if (key === "highway") {
88007                 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
88008                 if (!laneCount) laneCount = this.isOneWay() ? 1 : 2;
88009                 return width * laneCount;
88010               }
88011               return width;
88012             }
88013           }
88014           return null;
88015         },
88016         /** @returns {boolean} for example, if `oneway=yes` */
88017         isOneWayForwards() {
88018           if (this.tags.oneway === "no") return false;
88019           return !!utilCheckTagDictionary(this.tags, osmOneWayForwardTags);
88020         },
88021         /** @returns {boolean} for example, if `oneway=-1` */
88022         isOneWayBackwards() {
88023           if (this.tags.oneway === "no") return false;
88024           return !!utilCheckTagDictionary(this.tags, osmOneWayBackwardTags);
88025         },
88026         /** @returns {boolean} for example, if `oneway=alternating` */
88027         isBiDirectional() {
88028           if (this.tags.oneway === "no") return false;
88029           return !!utilCheckTagDictionary(this.tags, osmOneWayBiDirectionalTags);
88030         },
88031         /** @returns {boolean} */
88032         isOneWay() {
88033           if (this.tags.oneway === "no") return false;
88034           return !!utilCheckTagDictionary(this.tags, osmOneWayTags);
88035         },
88036         // Some identifier for tag that implies that this way is "sided",
88037         // i.e. the right side is the 'inside' (e.g. the right side of a
88038         // natural=cliff is lower).
88039         sidednessIdentifier: function() {
88040           for (const realKey in this.tags) {
88041             const value = this.tags[realKey];
88042             const key = osmRemoveLifecyclePrefix(realKey);
88043             if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
88044               if (osmRightSideIsInsideTags[key][value] === true) {
88045                 return key;
88046               } else {
88047                 return osmRightSideIsInsideTags[key][value];
88048               }
88049             }
88050           }
88051           return null;
88052         },
88053         isSided: function() {
88054           if (this.tags.two_sided === "yes") {
88055             return false;
88056           }
88057           return this.sidednessIdentifier() !== null;
88058         },
88059         lanes: function() {
88060           return osmLanes(this);
88061         },
88062         isClosed: function() {
88063           return this.nodes.length > 1 && this.first() === this.last();
88064         },
88065         isConvex: function(resolver) {
88066           if (!this.isClosed() || this.isDegenerate()) return null;
88067           var nodes = utilArrayUniq(resolver.childNodes(this));
88068           var coords = nodes.map(function(n3) {
88069             return n3.loc;
88070           });
88071           var curr = 0;
88072           var prev = 0;
88073           for (var i3 = 0; i3 < coords.length; i3++) {
88074             var o2 = coords[(i3 + 1) % coords.length];
88075             var a4 = coords[i3];
88076             var b3 = coords[(i3 + 2) % coords.length];
88077             var res = geoVecCross(a4, b3, o2);
88078             curr = res > 0 ? 1 : res < 0 ? -1 : 0;
88079             if (curr === 0) {
88080               continue;
88081             } else if (prev && curr !== prev) {
88082               return false;
88083             }
88084             prev = curr;
88085           }
88086           return true;
88087         },
88088         // returns an object with the tag that implies this is an area, if any
88089         tagSuggestingArea: function() {
88090           return osmTagSuggestingArea(this.tags);
88091         },
88092         isArea: function() {
88093           if (this.tags.area === "yes") return true;
88094           if (!this.isClosed() || this.tags.area === "no") return false;
88095           return this.tagSuggestingArea() !== null;
88096         },
88097         isDegenerate: function() {
88098           return new Set(this.nodes).size < (this.isClosed() ? 3 : 2);
88099         },
88100         areAdjacent: function(n1, n22) {
88101           for (var i3 = 0; i3 < this.nodes.length; i3++) {
88102             if (this.nodes[i3] === n1) {
88103               if (this.nodes[i3 - 1] === n22) return true;
88104               if (this.nodes[i3 + 1] === n22) return true;
88105             }
88106           }
88107           return false;
88108         },
88109         geometry: function(graph) {
88110           return graph.transient(this, "geometry", function() {
88111             return this.isArea() ? "area" : "line";
88112           });
88113         },
88114         // returns an array of objects representing the segments between the nodes in this way
88115         segments: function(graph) {
88116           function segmentExtent(graph2) {
88117             var n1 = graph2.hasEntity(this.nodes[0]);
88118             var n22 = graph2.hasEntity(this.nodes[1]);
88119             return n1 && n22 && geoExtent([
88120               [
88121                 Math.min(n1.loc[0], n22.loc[0]),
88122                 Math.min(n1.loc[1], n22.loc[1])
88123               ],
88124               [
88125                 Math.max(n1.loc[0], n22.loc[0]),
88126                 Math.max(n1.loc[1], n22.loc[1])
88127               ]
88128             ]);
88129           }
88130           return graph.transient(this, "segments", function() {
88131             var segments = [];
88132             for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
88133               segments.push({
88134                 id: this.id + "-" + i3,
88135                 wayId: this.id,
88136                 index: i3,
88137                 nodes: [this.nodes[i3], this.nodes[i3 + 1]],
88138                 extent: segmentExtent
88139               });
88140             }
88141             return segments;
88142           });
88143         },
88144         // If this way is not closed, append the beginning node to the end of the nodelist to close it.
88145         close: function() {
88146           if (this.isClosed() || !this.nodes.length) return this;
88147           var nodes = this.nodes.slice();
88148           nodes = nodes.filter(noRepeatNodes);
88149           nodes.push(nodes[0]);
88150           return this.update({ nodes });
88151         },
88152         // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
88153         unclose: function() {
88154           if (!this.isClosed()) return this;
88155           var nodes = this.nodes.slice();
88156           var connector = this.first();
88157           var i3 = nodes.length - 1;
88158           while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88159             nodes.splice(i3, 1);
88160             i3 = nodes.length - 1;
88161           }
88162           nodes = nodes.filter(noRepeatNodes);
88163           return this.update({ nodes });
88164         },
88165         // Adds a node (id) in front of the node which is currently at position index.
88166         // If index is undefined, the node will be added to the end of the way for linear ways,
88167         //   or just before the final connecting node for circular ways.
88168         // Consecutive duplicates are eliminated including existing ones.
88169         // Circularity is always preserved when adding a node.
88170         addNode: function(id2, index) {
88171           var nodes = this.nodes.slice();
88172           var isClosed = this.isClosed();
88173           var max3 = isClosed ? nodes.length - 1 : nodes.length;
88174           if (index === void 0) {
88175             index = max3;
88176           }
88177           if (index < 0 || index > max3) {
88178             throw new RangeError("index " + index + " out of range 0.." + max3);
88179           }
88180           if (isClosed) {
88181             var connector = this.first();
88182             var i3 = 1;
88183             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
88184               nodes.splice(i3, 1);
88185               if (index > i3) index--;
88186             }
88187             i3 = nodes.length - 1;
88188             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88189               nodes.splice(i3, 1);
88190               if (index > i3) index--;
88191               i3 = nodes.length - 1;
88192             }
88193           }
88194           nodes.splice(index, 0, id2);
88195           nodes = nodes.filter(noRepeatNodes);
88196           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88197             nodes.push(nodes[0]);
88198           }
88199           return this.update({ nodes });
88200         },
88201         // Replaces the node which is currently at position index with the given node (id).
88202         // Consecutive duplicates are eliminated including existing ones.
88203         // Circularity is preserved when updating a node.
88204         updateNode: function(id2, index) {
88205           var nodes = this.nodes.slice();
88206           var isClosed = this.isClosed();
88207           var max3 = nodes.length - 1;
88208           if (index === void 0 || index < 0 || index > max3) {
88209             throw new RangeError("index " + index + " out of range 0.." + max3);
88210           }
88211           if (isClosed) {
88212             var connector = this.first();
88213             var i3 = 1;
88214             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
88215               nodes.splice(i3, 1);
88216               if (index > i3) index--;
88217             }
88218             i3 = nodes.length - 1;
88219             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88220               nodes.splice(i3, 1);
88221               if (index === i3) index = 0;
88222               i3 = nodes.length - 1;
88223             }
88224           }
88225           nodes.splice(index, 1, id2);
88226           nodes = nodes.filter(noRepeatNodes);
88227           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88228             nodes.push(nodes[0]);
88229           }
88230           return this.update({ nodes });
88231         },
88232         // Replaces each occurrence of node id needle with replacement.
88233         // Consecutive duplicates are eliminated including existing ones.
88234         // Circularity is preserved.
88235         replaceNode: function(needleID, replacementID) {
88236           var nodes = this.nodes.slice();
88237           var isClosed = this.isClosed();
88238           for (var i3 = 0; i3 < nodes.length; i3++) {
88239             if (nodes[i3] === needleID) {
88240               nodes[i3] = replacementID;
88241             }
88242           }
88243           nodes = nodes.filter(noRepeatNodes);
88244           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88245             nodes.push(nodes[0]);
88246           }
88247           return this.update({ nodes });
88248         },
88249         // Removes each occurrence of node id.
88250         // Consecutive duplicates are eliminated including existing ones.
88251         // Circularity is preserved.
88252         removeNode: function(id2) {
88253           var nodes = this.nodes.slice();
88254           var isClosed = this.isClosed();
88255           nodes = nodes.filter(function(node) {
88256             return node !== id2;
88257           }).filter(noRepeatNodes);
88258           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88259             nodes.push(nodes[0]);
88260           }
88261           return this.update({ nodes });
88262         },
88263         asJXON: function(changeset_id) {
88264           var r2 = {
88265             way: {
88266               "@id": this.osmId(),
88267               "@version": this.version || 0,
88268               nd: this.nodes.map(function(id2) {
88269                 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
88270               }, this),
88271               tag: Object.keys(this.tags).map(function(k3) {
88272                 return { keyAttributes: { k: k3, v: this.tags[k3] } };
88273               }, this)
88274             }
88275           };
88276           if (changeset_id) {
88277             r2.way["@changeset"] = changeset_id;
88278           }
88279           return r2;
88280         },
88281         asGeoJSON: function(resolver) {
88282           return resolver.transient(this, "GeoJSON", function() {
88283             var coordinates = resolver.childNodes(this).map(function(n3) {
88284               return n3.loc;
88285             });
88286             if (this.isArea() && this.isClosed()) {
88287               return {
88288                 type: "Polygon",
88289                 coordinates: [coordinates]
88290               };
88291             } else {
88292               return {
88293                 type: "LineString",
88294                 coordinates
88295               };
88296             }
88297           });
88298         },
88299         area: function(resolver) {
88300           return resolver.transient(this, "area", function() {
88301             var nodes = resolver.childNodes(this);
88302             var json = {
88303               type: "Polygon",
88304               coordinates: [nodes.map(function(n3) {
88305                 return n3.loc;
88306               })]
88307             };
88308             if (!this.isClosed() && nodes.length) {
88309               json.coordinates[0].push(nodes[0].loc);
88310             }
88311             var area = area_default(json);
88312             if (area > 2 * Math.PI) {
88313               json.coordinates[0] = json.coordinates[0].reverse();
88314               area = area_default(json);
88315             }
88316             return isNaN(area) ? 0 : area;
88317           });
88318         }
88319       };
88320       Object.assign(osmWay.prototype, prototype3);
88321     }
88322   });
88323
88324   // modules/osm/multipolygon.js
88325   var multipolygon_exports = {};
88326   __export(multipolygon_exports, {
88327     osmJoinWays: () => osmJoinWays
88328   });
88329   function osmJoinWays(toJoin, graph) {
88330     function resolve(member) {
88331       return graph.childNodes(graph.entity(member.id));
88332     }
88333     function reverse(item2) {
88334       var action = actionReverse(item2.id, { reverseOneway: true });
88335       sequences.actions.push(action);
88336       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
88337     }
88338     toJoin = toJoin.filter(function(member) {
88339       return member.type === "way" && graph.hasEntity(member.id);
88340     });
88341     var i3;
88342     var joinAsMembers = true;
88343     for (i3 = 0; i3 < toJoin.length; i3++) {
88344       if (toJoin[i3] instanceof osmWay) {
88345         joinAsMembers = false;
88346         break;
88347       }
88348     }
88349     var sequences = [];
88350     sequences.actions = [];
88351     while (toJoin.length) {
88352       var item = toJoin.shift();
88353       var currWays = [item];
88354       var currNodes = resolve(item).slice();
88355       while (toJoin.length) {
88356         var start2 = currNodes[0];
88357         var end = currNodes[currNodes.length - 1];
88358         var fn = null;
88359         var nodes = null;
88360         for (i3 = 0; i3 < toJoin.length; i3++) {
88361           item = toJoin[i3];
88362           nodes = resolve(item);
88363           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
88364             currWays[0] = reverse(currWays[0]);
88365             currNodes.reverse();
88366             start2 = currNodes[0];
88367             end = currNodes[currNodes.length - 1];
88368           }
88369           if (nodes[0] === end) {
88370             fn = currNodes.push;
88371             nodes = nodes.slice(1);
88372             break;
88373           } else if (nodes[nodes.length - 1] === end) {
88374             fn = currNodes.push;
88375             nodes = nodes.slice(0, -1).reverse();
88376             item = reverse(item);
88377             break;
88378           } else if (nodes[nodes.length - 1] === start2) {
88379             fn = currNodes.unshift;
88380             nodes = nodes.slice(0, -1);
88381             break;
88382           } else if (nodes[0] === start2) {
88383             fn = currNodes.unshift;
88384             nodes = nodes.slice(1).reverse();
88385             item = reverse(item);
88386             break;
88387           } else {
88388             fn = nodes = null;
88389           }
88390         }
88391         if (!nodes) {
88392           break;
88393         }
88394         fn.apply(currWays, [item]);
88395         fn.apply(currNodes, nodes);
88396         toJoin.splice(i3, 1);
88397       }
88398       currWays.nodes = currNodes;
88399       sequences.push(currWays);
88400     }
88401     return sequences;
88402   }
88403   var init_multipolygon = __esm({
88404     "modules/osm/multipolygon.js"() {
88405       "use strict";
88406       init_reverse();
88407       init_way();
88408     }
88409   });
88410
88411   // modules/actions/add_member.js
88412   var add_member_exports = {};
88413   __export(add_member_exports, {
88414     actionAddMember: () => actionAddMember
88415   });
88416   function actionAddMember(relationId, member, memberIndex) {
88417     return function action(graph) {
88418       var relation = graph.entity(relationId);
88419       var isPTv2 = /stop|platform/.test(member.role);
88420       if (member.type === "way" && !isPTv2) {
88421         graph = addWayMember(relation, graph);
88422       } else {
88423         if (isPTv2 && isNaN(memberIndex)) {
88424           memberIndex = 0;
88425         }
88426         graph = graph.replace(relation.addMember(member, memberIndex));
88427       }
88428       return graph;
88429     };
88430     function addWayMember(relation, graph) {
88431       var groups, item, i3, j3, k3;
88432       var PTv2members = [];
88433       var members = [];
88434       for (i3 = 0; i3 < relation.members.length; i3++) {
88435         var m3 = relation.members[i3];
88436         if (/stop|platform/.test(m3.role)) {
88437           PTv2members.push(m3);
88438         } else {
88439           members.push(m3);
88440         }
88441       }
88442       relation = relation.update({ members });
88443       groups = utilArrayGroupBy(relation.members, "type");
88444       groups.way = groups.way || [];
88445       groups.way.push(member);
88446       members = withIndex(groups.way);
88447       var joined = osmJoinWays(members, graph);
88448       for (i3 = 0; i3 < joined.length; i3++) {
88449         var segment = joined[i3];
88450         var nodes = segment.nodes.slice();
88451         var startIndex = segment[0].index;
88452         for (j3 = 0; j3 < members.length; j3++) {
88453           if (members[j3].index === startIndex) {
88454             break;
88455           }
88456         }
88457         for (k3 = 0; k3 < segment.length; k3++) {
88458           item = segment[k3];
88459           var way = graph.entity(item.id);
88460           if (k3 > 0) {
88461             if (j3 + k3 >= members.length || item.index !== members[j3 + k3].index) {
88462               moveMember(members, item.index, j3 + k3);
88463             }
88464           }
88465           nodes.splice(0, way.nodes.length - 1);
88466         }
88467       }
88468       var wayMembers = [];
88469       for (i3 = 0; i3 < members.length; i3++) {
88470         item = members[i3];
88471         if (item.index === -1) continue;
88472         wayMembers.push(utilObjectOmit(item, ["index"]));
88473       }
88474       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
88475       return graph.replace(relation.update({ members: newMembers }));
88476       function moveMember(arr, findIndex, toIndex) {
88477         var i4;
88478         for (i4 = 0; i4 < arr.length; i4++) {
88479           if (arr[i4].index === findIndex) {
88480             break;
88481           }
88482         }
88483         var item2 = Object.assign({}, arr[i4]);
88484         arr[i4].index = -1;
88485         delete item2.index;
88486         arr.splice(toIndex, 0, item2);
88487       }
88488       function withIndex(arr) {
88489         var result = new Array(arr.length);
88490         for (var i4 = 0; i4 < arr.length; i4++) {
88491           result[i4] = Object.assign({}, arr[i4]);
88492           result[i4].index = i4;
88493         }
88494         return result;
88495       }
88496     }
88497   }
88498   var init_add_member = __esm({
88499     "modules/actions/add_member.js"() {
88500       "use strict";
88501       init_multipolygon();
88502       init_util();
88503     }
88504   });
88505
88506   // modules/actions/index.js
88507   var actions_exports = {};
88508   __export(actions_exports, {
88509     actionAddEntity: () => actionAddEntity,
88510     actionAddMember: () => actionAddMember,
88511     actionAddMidpoint: () => actionAddMidpoint,
88512     actionAddVertex: () => actionAddVertex,
88513     actionChangeMember: () => actionChangeMember,
88514     actionChangePreset: () => actionChangePreset,
88515     actionChangeTags: () => actionChangeTags,
88516     actionCircularize: () => actionCircularize,
88517     actionConnect: () => actionConnect,
88518     actionCopyEntities: () => actionCopyEntities,
88519     actionDeleteMember: () => actionDeleteMember,
88520     actionDeleteMultiple: () => actionDeleteMultiple,
88521     actionDeleteNode: () => actionDeleteNode,
88522     actionDeleteRelation: () => actionDeleteRelation,
88523     actionDeleteWay: () => actionDeleteWay,
88524     actionDiscardTags: () => actionDiscardTags,
88525     actionDisconnect: () => actionDisconnect,
88526     actionExtract: () => actionExtract,
88527     actionJoin: () => actionJoin,
88528     actionMerge: () => actionMerge,
88529     actionMergeNodes: () => actionMergeNodes,
88530     actionMergePolygon: () => actionMergePolygon,
88531     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
88532     actionMove: () => actionMove,
88533     actionMoveMember: () => actionMoveMember,
88534     actionMoveNode: () => actionMoveNode,
88535     actionNoop: () => actionNoop,
88536     actionOrthogonalize: () => actionOrthogonalize,
88537     actionReflect: () => actionReflect,
88538     actionRestrictTurn: () => actionRestrictTurn,
88539     actionReverse: () => actionReverse,
88540     actionRevert: () => actionRevert,
88541     actionRotate: () => actionRotate,
88542     actionScale: () => actionScale,
88543     actionSplit: () => actionSplit,
88544     actionStraightenNodes: () => actionStraightenNodes,
88545     actionStraightenWay: () => actionStraightenWay,
88546     actionUnrestrictTurn: () => actionUnrestrictTurn,
88547     actionUpgradeTags: () => actionUpgradeTags
88548   });
88549   var init_actions = __esm({
88550     "modules/actions/index.js"() {
88551       "use strict";
88552       init_add_entity();
88553       init_add_member();
88554       init_add_midpoint();
88555       init_add_vertex();
88556       init_change_member();
88557       init_change_preset();
88558       init_change_tags();
88559       init_circularize();
88560       init_connect();
88561       init_copy_entities();
88562       init_delete_member();
88563       init_delete_multiple();
88564       init_delete_node();
88565       init_delete_relation();
88566       init_delete_way();
88567       init_discard_tags();
88568       init_disconnect();
88569       init_extract();
88570       init_join2();
88571       init_merge5();
88572       init_merge_nodes();
88573       init_merge_polygon();
88574       init_merge_remote_changes();
88575       init_move();
88576       init_move_member();
88577       init_move_node();
88578       init_noop2();
88579       init_orthogonalize();
88580       init_restrict_turn();
88581       init_reverse();
88582       init_revert();
88583       init_rotate();
88584       init_scale();
88585       init_split();
88586       init_straighten_nodes();
88587       init_straighten_way();
88588       init_unrestrict_turn();
88589       init_reflect();
88590       init_upgrade_tags();
88591     }
88592   });
88593
88594   // modules/index.js
88595   var index_exports = {};
88596   __export(index_exports, {
88597     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
88598     LocationManager: () => LocationManager,
88599     QAItem: () => QAItem,
88600     actionAddEntity: () => actionAddEntity,
88601     actionAddMember: () => actionAddMember,
88602     actionAddMidpoint: () => actionAddMidpoint,
88603     actionAddVertex: () => actionAddVertex,
88604     actionChangeMember: () => actionChangeMember,
88605     actionChangePreset: () => actionChangePreset,
88606     actionChangeTags: () => actionChangeTags,
88607     actionCircularize: () => actionCircularize,
88608     actionConnect: () => actionConnect,
88609     actionCopyEntities: () => actionCopyEntities,
88610     actionDeleteMember: () => actionDeleteMember,
88611     actionDeleteMultiple: () => actionDeleteMultiple,
88612     actionDeleteNode: () => actionDeleteNode,
88613     actionDeleteRelation: () => actionDeleteRelation,
88614     actionDeleteWay: () => actionDeleteWay,
88615     actionDiscardTags: () => actionDiscardTags,
88616     actionDisconnect: () => actionDisconnect,
88617     actionExtract: () => actionExtract,
88618     actionJoin: () => actionJoin,
88619     actionMerge: () => actionMerge,
88620     actionMergeNodes: () => actionMergeNodes,
88621     actionMergePolygon: () => actionMergePolygon,
88622     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
88623     actionMove: () => actionMove,
88624     actionMoveMember: () => actionMoveMember,
88625     actionMoveNode: () => actionMoveNode,
88626     actionNoop: () => actionNoop,
88627     actionOrthogonalize: () => actionOrthogonalize,
88628     actionReflect: () => actionReflect,
88629     actionRestrictTurn: () => actionRestrictTurn,
88630     actionReverse: () => actionReverse,
88631     actionRevert: () => actionRevert,
88632     actionRotate: () => actionRotate,
88633     actionScale: () => actionScale,
88634     actionSplit: () => actionSplit,
88635     actionStraightenNodes: () => actionStraightenNodes,
88636     actionStraightenWay: () => actionStraightenWay,
88637     actionUnrestrictTurn: () => actionUnrestrictTurn,
88638     actionUpgradeTags: () => actionUpgradeTags,
88639     behaviorAddWay: () => behaviorAddWay,
88640     behaviorBreathe: () => behaviorBreathe,
88641     behaviorDrag: () => behaviorDrag,
88642     behaviorDraw: () => behaviorDraw,
88643     behaviorDrawWay: () => behaviorDrawWay,
88644     behaviorEdit: () => behaviorEdit,
88645     behaviorHash: () => behaviorHash,
88646     behaviorHover: () => behaviorHover,
88647     behaviorLasso: () => behaviorLasso,
88648     behaviorOperation: () => behaviorOperation,
88649     behaviorPaste: () => behaviorPaste,
88650     behaviorSelect: () => behaviorSelect,
88651     coreContext: () => coreContext,
88652     coreDifference: () => coreDifference,
88653     coreFileFetcher: () => coreFileFetcher,
88654     coreGraph: () => coreGraph,
88655     coreHistory: () => coreHistory,
88656     coreLocalizer: () => coreLocalizer,
88657     coreTree: () => coreTree,
88658     coreUploader: () => coreUploader,
88659     coreValidator: () => coreValidator,
88660     d3: () => d3,
88661     debug: () => debug,
88662     dmsCoordinatePair: () => dmsCoordinatePair,
88663     dmsMatcher: () => dmsMatcher,
88664     fileFetcher: () => _mainFileFetcher,
88665     geoAngle: () => geoAngle,
88666     geoChooseEdge: () => geoChooseEdge,
88667     geoEdgeEqual: () => geoEdgeEqual,
88668     geoExtent: () => geoExtent,
88669     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
88670     geoHasLineIntersections: () => geoHasLineIntersections,
88671     geoHasSelfIntersections: () => geoHasSelfIntersections,
88672     geoLatToMeters: () => geoLatToMeters,
88673     geoLineIntersection: () => geoLineIntersection,
88674     geoLonToMeters: () => geoLonToMeters,
88675     geoMetersToLat: () => geoMetersToLat,
88676     geoMetersToLon: () => geoMetersToLon,
88677     geoMetersToOffset: () => geoMetersToOffset,
88678     geoOffsetToMeters: () => geoOffsetToMeters,
88679     geoOrthoCalcScore: () => geoOrthoCalcScore,
88680     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
88681     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
88682     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
88683     geoPathHasIntersections: () => geoPathHasIntersections,
88684     geoPathIntersections: () => geoPathIntersections,
88685     geoPathLength: () => geoPathLength,
88686     geoPointInPolygon: () => geoPointInPolygon,
88687     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
88688     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
88689     geoRawMercator: () => geoRawMercator,
88690     geoRotate: () => geoRotate,
88691     geoScaleToZoom: () => geoScaleToZoom,
88692     geoSphericalClosestNode: () => geoSphericalClosestNode,
88693     geoSphericalDistance: () => geoSphericalDistance,
88694     geoVecAdd: () => geoVecAdd,
88695     geoVecAngle: () => geoVecAngle,
88696     geoVecCross: () => geoVecCross,
88697     geoVecDot: () => geoVecDot,
88698     geoVecEqual: () => geoVecEqual,
88699     geoVecFloor: () => geoVecFloor,
88700     geoVecInterp: () => geoVecInterp,
88701     geoVecLength: () => geoVecLength,
88702     geoVecLengthSquare: () => geoVecLengthSquare,
88703     geoVecNormalize: () => geoVecNormalize,
88704     geoVecNormalizedDot: () => geoVecNormalizedDot,
88705     geoVecProject: () => geoVecProject,
88706     geoVecScale: () => geoVecScale,
88707     geoVecSubtract: () => geoVecSubtract,
88708     geoViewportEdge: () => geoViewportEdge,
88709     geoZoomToScale: () => geoZoomToScale,
88710     likelyRawNumberFormat: () => likelyRawNumberFormat,
88711     localizer: () => _mainLocalizer,
88712     locationManager: () => _sharedLocationManager,
88713     modeAddArea: () => modeAddArea,
88714     modeAddLine: () => modeAddLine,
88715     modeAddNote: () => modeAddNote,
88716     modeAddPoint: () => modeAddPoint,
88717     modeBrowse: () => modeBrowse,
88718     modeDragNode: () => modeDragNode,
88719     modeDragNote: () => modeDragNote,
88720     modeDrawArea: () => modeDrawArea,
88721     modeDrawLine: () => modeDrawLine,
88722     modeMove: () => modeMove,
88723     modeRotate: () => modeRotate,
88724     modeSave: () => modeSave,
88725     modeSelect: () => modeSelect,
88726     modeSelectData: () => modeSelectData,
88727     modeSelectError: () => modeSelectError,
88728     modeSelectNote: () => modeSelectNote,
88729     operationCircularize: () => operationCircularize,
88730     operationContinue: () => operationContinue,
88731     operationCopy: () => operationCopy,
88732     operationDelete: () => operationDelete,
88733     operationDisconnect: () => operationDisconnect,
88734     operationDowngrade: () => operationDowngrade,
88735     operationExtract: () => operationExtract,
88736     operationMerge: () => operationMerge,
88737     operationMove: () => operationMove,
88738     operationOrthogonalize: () => operationOrthogonalize,
88739     operationPaste: () => operationPaste,
88740     operationReflectLong: () => operationReflectLong,
88741     operationReflectShort: () => operationReflectShort,
88742     operationReverse: () => operationReverse,
88743     operationRotate: () => operationRotate,
88744     operationSplit: () => operationSplit,
88745     operationStraighten: () => operationStraighten,
88746     osmAreaKeys: () => osmAreaKeys,
88747     osmChangeset: () => osmChangeset,
88748     osmEntity: () => osmEntity,
88749     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
88750     osmInferRestriction: () => osmInferRestriction,
88751     osmIntersection: () => osmIntersection,
88752     osmIsInterestingTag: () => osmIsInterestingTag,
88753     osmJoinWays: () => osmJoinWays,
88754     osmLanes: () => osmLanes,
88755     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
88756     osmNode: () => osmNode,
88757     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
88758     osmNote: () => osmNote,
88759     osmPavedTags: () => osmPavedTags,
88760     osmPointTags: () => osmPointTags,
88761     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
88762     osmRelation: () => osmRelation,
88763     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
88764     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
88765     osmSetAreaKeys: () => osmSetAreaKeys,
88766     osmSetPointTags: () => osmSetPointTags,
88767     osmSetVertexTags: () => osmSetVertexTags,
88768     osmTagSuggestingArea: () => osmTagSuggestingArea,
88769     osmTurn: () => osmTurn,
88770     osmVertexTags: () => osmVertexTags,
88771     osmWay: () => osmWay,
88772     prefs: () => corePreferences,
88773     presetCategory: () => presetCategory,
88774     presetCollection: () => presetCollection,
88775     presetField: () => presetField,
88776     presetIndex: () => presetIndex,
88777     presetManager: () => _mainPresetIndex,
88778     presetPreset: () => presetPreset,
88779     rendererBackground: () => rendererBackground,
88780     rendererBackgroundSource: () => rendererBackgroundSource,
88781     rendererFeatures: () => rendererFeatures,
88782     rendererMap: () => rendererMap,
88783     rendererPhotos: () => rendererPhotos,
88784     rendererTileLayer: () => rendererTileLayer,
88785     serviceKartaview: () => kartaview_default,
88786     serviceKeepRight: () => keepRight_default,
88787     serviceMapRules: () => maprules_default,
88788     serviceMapilio: () => mapilio_default,
88789     serviceMapillary: () => mapillary_default,
88790     serviceNominatim: () => nominatim_default,
88791     serviceNsi: () => nsi_default,
88792     serviceOsm: () => osm_default,
88793     serviceOsmWikibase: () => osm_wikibase_default,
88794     serviceOsmose: () => osmose_default,
88795     servicePanoramax: () => panoramax_default,
88796     serviceStreetside: () => streetside_default,
88797     serviceTaginfo: () => taginfo_default,
88798     serviceVectorTile: () => vector_tile_default,
88799     serviceVegbilder: () => vegbilder_default,
88800     serviceWikidata: () => wikidata_default,
88801     serviceWikipedia: () => wikipedia_default,
88802     services: () => services,
88803     setDebug: () => setDebug,
88804     svgAreas: () => svgAreas,
88805     svgData: () => svgData,
88806     svgDebug: () => svgDebug,
88807     svgDefs: () => svgDefs,
88808     svgGeolocate: () => svgGeolocate,
88809     svgIcon: () => svgIcon,
88810     svgKartaviewImages: () => svgKartaviewImages,
88811     svgKeepRight: () => svgKeepRight,
88812     svgLabels: () => svgLabels,
88813     svgLayers: () => svgLayers,
88814     svgLines: () => svgLines,
88815     svgMapilioImages: () => svgMapilioImages,
88816     svgMapillaryImages: () => svgMapillaryImages,
88817     svgMapillarySigns: () => svgMapillarySigns,
88818     svgMarkerSegments: () => svgMarkerSegments,
88819     svgMidpoints: () => svgMidpoints,
88820     svgNotes: () => svgNotes,
88821     svgOsm: () => svgOsm,
88822     svgPanoramaxImages: () => svgPanoramaxImages,
88823     svgPassiveVertex: () => svgPassiveVertex,
88824     svgPath: () => svgPath,
88825     svgPointTransform: () => svgPointTransform,
88826     svgPoints: () => svgPoints,
88827     svgRelationMemberTags: () => svgRelationMemberTags,
88828     svgSegmentWay: () => svgSegmentWay,
88829     svgStreetside: () => svgStreetside,
88830     svgTagClasses: () => svgTagClasses,
88831     svgTagPattern: () => svgTagPattern,
88832     svgTouch: () => svgTouch,
88833     svgTurns: () => svgTurns,
88834     svgVegbilder: () => svgVegbilder,
88835     svgVertices: () => svgVertices,
88836     t: () => _t,
88837     uiAccount: () => uiAccount,
88838     uiAttribution: () => uiAttribution,
88839     uiChangesetEditor: () => uiChangesetEditor,
88840     uiCmd: () => uiCmd,
88841     uiCombobox: () => uiCombobox,
88842     uiCommit: () => uiCommit,
88843     uiCommitWarnings: () => uiCommitWarnings,
88844     uiConfirm: () => uiConfirm,
88845     uiConflicts: () => uiConflicts,
88846     uiContributors: () => uiContributors,
88847     uiCurtain: () => uiCurtain,
88848     uiDataEditor: () => uiDataEditor,
88849     uiDataHeader: () => uiDataHeader,
88850     uiDisclosure: () => uiDisclosure,
88851     uiEditMenu: () => uiEditMenu,
88852     uiEntityEditor: () => uiEntityEditor,
88853     uiFeatureInfo: () => uiFeatureInfo,
88854     uiFeatureList: () => uiFeatureList,
88855     uiField: () => uiField,
88856     uiFieldAccess: () => uiFieldAccess,
88857     uiFieldAddress: () => uiFieldAddress,
88858     uiFieldCheck: () => uiFieldCheck,
88859     uiFieldColour: () => uiFieldText,
88860     uiFieldCombo: () => uiFieldCombo,
88861     uiFieldDefaultCheck: () => uiFieldCheck,
88862     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
88863     uiFieldEmail: () => uiFieldText,
88864     uiFieldHelp: () => uiFieldHelp,
88865     uiFieldIdentifier: () => uiFieldText,
88866     uiFieldLanes: () => uiFieldLanes,
88867     uiFieldLocalized: () => uiFieldLocalized,
88868     uiFieldManyCombo: () => uiFieldCombo,
88869     uiFieldMultiCombo: () => uiFieldCombo,
88870     uiFieldNetworkCombo: () => uiFieldCombo,
88871     uiFieldNumber: () => uiFieldText,
88872     uiFieldOnewayCheck: () => uiFieldCheck,
88873     uiFieldRadio: () => uiFieldRadio,
88874     uiFieldRestrictions: () => uiFieldRestrictions,
88875     uiFieldRoadheight: () => uiFieldRoadheight,
88876     uiFieldRoadspeed: () => uiFieldRoadspeed,
88877     uiFieldSemiCombo: () => uiFieldCombo,
88878     uiFieldStructureRadio: () => uiFieldRadio,
88879     uiFieldTel: () => uiFieldText,
88880     uiFieldText: () => uiFieldText,
88881     uiFieldTextarea: () => uiFieldTextarea,
88882     uiFieldTypeCombo: () => uiFieldCombo,
88883     uiFieldUrl: () => uiFieldText,
88884     uiFieldWikidata: () => uiFieldWikidata,
88885     uiFieldWikipedia: () => uiFieldWikipedia,
88886     uiFields: () => uiFields,
88887     uiFlash: () => uiFlash,
88888     uiFormFields: () => uiFormFields,
88889     uiFullScreen: () => uiFullScreen,
88890     uiGeolocate: () => uiGeolocate,
88891     uiInfo: () => uiInfo,
88892     uiInfoPanels: () => uiInfoPanels,
88893     uiInit: () => uiInit,
88894     uiInspector: () => uiInspector,
88895     uiIntro: () => uiIntro,
88896     uiIssuesInfo: () => uiIssuesInfo,
88897     uiKeepRightDetails: () => uiKeepRightDetails,
88898     uiKeepRightEditor: () => uiKeepRightEditor,
88899     uiKeepRightHeader: () => uiKeepRightHeader,
88900     uiLasso: () => uiLasso,
88901     uiLengthIndicator: () => uiLengthIndicator,
88902     uiLoading: () => uiLoading,
88903     uiMapInMap: () => uiMapInMap,
88904     uiModal: () => uiModal,
88905     uiNoteComments: () => uiNoteComments,
88906     uiNoteEditor: () => uiNoteEditor,
88907     uiNoteHeader: () => uiNoteHeader,
88908     uiNoteReport: () => uiNoteReport,
88909     uiNotice: () => uiNotice,
88910     uiPaneBackground: () => uiPaneBackground,
88911     uiPaneHelp: () => uiPaneHelp,
88912     uiPaneIssues: () => uiPaneIssues,
88913     uiPaneMapData: () => uiPaneMapData,
88914     uiPanePreferences: () => uiPanePreferences,
88915     uiPanelBackground: () => uiPanelBackground,
88916     uiPanelHistory: () => uiPanelHistory,
88917     uiPanelLocation: () => uiPanelLocation,
88918     uiPanelMeasurement: () => uiPanelMeasurement,
88919     uiPopover: () => uiPopover,
88920     uiPresetIcon: () => uiPresetIcon,
88921     uiPresetList: () => uiPresetList,
88922     uiRestore: () => uiRestore,
88923     uiScale: () => uiScale,
88924     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
88925     uiSectionBackgroundList: () => uiSectionBackgroundList,
88926     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
88927     uiSectionChanges: () => uiSectionChanges,
88928     uiSectionDataLayers: () => uiSectionDataLayers,
88929     uiSectionEntityIssues: () => uiSectionEntityIssues,
88930     uiSectionFeatureType: () => uiSectionFeatureType,
88931     uiSectionMapFeatures: () => uiSectionMapFeatures,
88932     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
88933     uiSectionOverlayList: () => uiSectionOverlayList,
88934     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
88935     uiSectionPresetFields: () => uiSectionPresetFields,
88936     uiSectionPrivacy: () => uiSectionPrivacy,
88937     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
88938     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
88939     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
88940     uiSectionSelectionList: () => uiSectionSelectionList,
88941     uiSectionValidationIssues: () => uiSectionValidationIssues,
88942     uiSectionValidationOptions: () => uiSectionValidationOptions,
88943     uiSectionValidationRules: () => uiSectionValidationRules,
88944     uiSectionValidationStatus: () => uiSectionValidationStatus,
88945     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
88946     uiSettingsCustomData: () => uiSettingsCustomData,
88947     uiSidebar: () => uiSidebar,
88948     uiSourceSwitch: () => uiSourceSwitch,
88949     uiSpinner: () => uiSpinner,
88950     uiSplash: () => uiSplash,
88951     uiStatus: () => uiStatus,
88952     uiSuccess: () => uiSuccess,
88953     uiTagReference: () => uiTagReference,
88954     uiToggle: () => uiToggle,
88955     uiTooltip: () => uiTooltip,
88956     uiVersion: () => uiVersion,
88957     uiViewOnKeepRight: () => uiViewOnKeepRight,
88958     uiViewOnOSM: () => uiViewOnOSM,
88959     uiZoom: () => uiZoom,
88960     utilAesDecrypt: () => utilAesDecrypt,
88961     utilAesEncrypt: () => utilAesEncrypt,
88962     utilArrayChunk: () => utilArrayChunk,
88963     utilArrayDifference: () => utilArrayDifference,
88964     utilArrayFlatten: () => utilArrayFlatten,
88965     utilArrayGroupBy: () => utilArrayGroupBy,
88966     utilArrayIdentical: () => utilArrayIdentical,
88967     utilArrayIntersection: () => utilArrayIntersection,
88968     utilArrayUnion: () => utilArrayUnion,
88969     utilArrayUniq: () => utilArrayUniq,
88970     utilArrayUniqBy: () => utilArrayUniqBy,
88971     utilAsyncMap: () => utilAsyncMap,
88972     utilCheckTagDictionary: () => utilCheckTagDictionary,
88973     utilCleanOsmString: () => utilCleanOsmString,
88974     utilCleanTags: () => utilCleanTags,
88975     utilCombinedTags: () => utilCombinedTags,
88976     utilCompareIDs: () => utilCompareIDs,
88977     utilDeepMemberSelector: () => utilDeepMemberSelector,
88978     utilDetect: () => utilDetect,
88979     utilDisplayName: () => utilDisplayName,
88980     utilDisplayNameForPath: () => utilDisplayNameForPath,
88981     utilDisplayType: () => utilDisplayType,
88982     utilEditDistance: () => utilEditDistance,
88983     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
88984     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
88985     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
88986     utilEntityRoot: () => utilEntityRoot,
88987     utilEntitySelector: () => utilEntitySelector,
88988     utilFastMouse: () => utilFastMouse,
88989     utilFunctor: () => utilFunctor,
88990     utilGetAllNodes: () => utilGetAllNodes,
88991     utilGetSetValue: () => utilGetSetValue,
88992     utilHashcode: () => utilHashcode,
88993     utilHighlightEntities: () => utilHighlightEntities,
88994     utilKeybinding: () => utilKeybinding,
88995     utilNoAuto: () => utilNoAuto,
88996     utilObjectOmit: () => utilObjectOmit,
88997     utilOldestID: () => utilOldestID,
88998     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
88999     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
89000     utilQsString: () => utilQsString,
89001     utilRebind: () => utilRebind,
89002     utilSafeClassName: () => utilSafeClassName,
89003     utilSessionMutex: () => utilSessionMutex,
89004     utilSetTransform: () => utilSetTransform,
89005     utilStringQs: () => utilStringQs,
89006     utilTagDiff: () => utilTagDiff,
89007     utilTagText: () => utilTagText,
89008     utilTiler: () => utilTiler,
89009     utilTotalExtent: () => utilTotalExtent,
89010     utilTriggerEvent: () => utilTriggerEvent,
89011     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
89012     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
89013     utilUniqueDomId: () => utilUniqueDomId,
89014     utilWrap: () => utilWrap,
89015     validationAlmostJunction: () => validationAlmostJunction,
89016     validationCloseNodes: () => validationCloseNodes,
89017     validationCrossingWays: () => validationCrossingWays,
89018     validationDisconnectedWay: () => validationDisconnectedWay,
89019     validationFormatting: () => validationFormatting,
89020     validationHelpRequest: () => validationHelpRequest,
89021     validationImpossibleOneway: () => validationImpossibleOneway,
89022     validationIncompatibleSource: () => validationIncompatibleSource,
89023     validationMaprules: () => validationMaprules,
89024     validationMismatchedGeometry: () => validationMismatchedGeometry,
89025     validationMissingRole: () => validationMissingRole,
89026     validationMissingTag: () => validationMissingTag,
89027     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
89028     validationOsmApiLimits: () => validationOsmApiLimits,
89029     validationOutdatedTags: () => validationOutdatedTags,
89030     validationPrivateData: () => validationPrivateData,
89031     validationSuspiciousName: () => validationSuspiciousName,
89032     validationUnsquareWay: () => validationUnsquareWay
89033   });
89034   var debug, setDebug, d3;
89035   var init_index = __esm({
89036     "modules/index.js"() {
89037       "use strict";
89038       init_actions();
89039       init_behavior();
89040       init_core();
89041       init_geo2();
89042       init_modes2();
89043       init_operations();
89044       init_osm();
89045       init_presets();
89046       init_renderer();
89047       init_services();
89048       init_svg();
89049       init_fields();
89050       init_intro2();
89051       init_panels();
89052       init_panes();
89053       init_sections();
89054       init_settings();
89055       init_ui();
89056       init_util();
89057       init_validations();
89058       init_src31();
89059       debug = false;
89060       setDebug = (newValue) => {
89061         debug = newValue;
89062       };
89063       d3 = {
89064         dispatch: dispatch_default,
89065         geoMercator: mercator_default,
89066         geoProjection: projection,
89067         polygonArea: area_default3,
89068         polygonCentroid: centroid_default2,
89069         select: select_default2,
89070         selectAll: selectAll_default2,
89071         timerFlush
89072       };
89073     }
89074   });
89075
89076   // modules/id.js
89077   var id_exports = {};
89078   var init_id2 = __esm({
89079     "modules/id.js"() {
89080       init_fetch();
89081       init_polyfill_patch_fetch();
89082       init_index();
89083       window.requestIdleCallback = window.requestIdleCallback || function(cb) {
89084         var start2 = Date.now();
89085         return window.requestAnimationFrame(function() {
89086           cb({
89087             didTimeout: false,
89088             timeRemaining: function() {
89089               return Math.max(0, 50 - (Date.now() - start2));
89090             }
89091           });
89092         });
89093       };
89094       window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
89095         window.cancelAnimationFrame(id2);
89096       };
89097       window.iD = index_exports;
89098     }
89099   });
89100   init_id2();
89101 })();
89102 //# sourceMappingURL=iD.js.map