]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Merge remote-tracking branch 'upstream/pull/6205'
[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.2",
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       if (_index > 0) {
31712         _index--;
31713         _stack.pop();
31714       }
31715       _stack = _stack.slice(0, _index + 1);
31716       var actionResult = _act(args, t2);
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       const graph = context.graph();
58270       const mouse = context.map().mouse();
58271       let bbox2;
58272       let hideIds = [];
58273       if (mouse && context.mode().id !== "browse") {
58274         const pad3 = 20;
58275         bbox2 = { minX: mouse[0] - pad3, minY: mouse[1] - pad3, maxX: mouse[0] + pad3, maxY: mouse[1] + pad3 };
58276         const nearMouse = _rdrawn.search(bbox2).map((entity) => entity.id).filter((id2) => context.mode().id !== "select" || // in select mode: hide labels of currently selected line(s)
58277         // to still allow accessing midpoints
58278         // https://github.com/openstreetmap/iD/issues/11220
58279         context.mode().selectedIDs().includes(id2) && graph.hasEntity(id2).geometry(graph) === "line");
58280         hideIds.push.apply(hideIds, nearMouse);
58281         hideIds = utilArrayUniq(hideIds);
58282       }
58283       const selected = (((_b2 = (_a4 = context.mode()) == null ? void 0 : _a4.selectedIDs) == null ? void 0 : _b2.call(_a4)) || []).filter((id2) => {
58284         var _a5;
58285         return ((_a5 = graph.hasEntity(id2)) == null ? void 0 : _a5.geometry(graph)) !== "line";
58286       });
58287       hideIds = utilArrayDifference(hideIds, selected);
58288       layers.selectAll(utilEntitySelector(hideIds)).classed("nolabel", true);
58289       var debug2 = selection2.selectAll(".labels-group.debug");
58290       var gj = [];
58291       if (context.getDebug("collision")) {
58292         gj = bbox2 ? [{
58293           type: "Polygon",
58294           coordinates: [[
58295             [bbox2.minX, bbox2.minY],
58296             [bbox2.maxX, bbox2.minY],
58297             [bbox2.maxX, bbox2.maxY],
58298             [bbox2.minX, bbox2.maxY],
58299             [bbox2.minX, bbox2.minY]
58300           ]]
58301         }] : [];
58302       }
58303       var box = debug2.selectAll(".debug-mouse").data(gj);
58304       box.exit().remove();
58305       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
58306     }
58307     var throttleFilterLabels = throttle_default(filterLabels, 100);
58308     drawLabels.observe = function(selection2) {
58309       var listener = function() {
58310         throttleFilterLabels(selection2);
58311       };
58312       selection2.on("mousemove.hidelabels", listener);
58313       context.on("enter.hidelabels", listener);
58314     };
58315     drawLabels.off = function(selection2) {
58316       throttleFilterLabels.cancel();
58317       selection2.on("mousemove.hidelabels", null);
58318       context.on("enter.hidelabels", null);
58319     };
58320     return drawLabels;
58321   }
58322   function textWidth(text, size, container) {
58323     let c2 = _textWidthCache[size];
58324     if (!c2) c2 = _textWidthCache[size] = {};
58325     if (c2[text]) {
58326       return c2[text];
58327     }
58328     const elem = document.createElementNS("http://www.w3.org/2000/svg", "text");
58329     elem.style.fontSize = `${size}px`;
58330     elem.style.fontWeight = "bold";
58331     elem.textContent = text;
58332     container.appendChild(elem);
58333     c2[text] = elem.getComputedTextLength();
58334     elem.remove();
58335     return c2[text];
58336   }
58337   function isAddressPoint(tags) {
58338     const keys2 = Object.keys(tags).filter(
58339       (key) => osmIsInterestingTag(key) && !nonPrimaryKeys.has(key) && !nonPrimaryKeysRegex.test(key)
58340     );
58341     return keys2.length > 0 && keys2.every(
58342       (key) => key.startsWith("addr:")
58343     );
58344   }
58345   var _textWidthCache, nonPrimaryKeys, nonPrimaryKeysRegex;
58346   var init_labels = __esm({
58347     "modules/svg/labels.js"() {
58348       "use strict";
58349       init_throttle();
58350       init_src2();
58351       init_rbush();
58352       init_localizer();
58353       init_geo2();
58354       init_presets();
58355       init_osm();
58356       init_detect();
58357       init_util();
58358       _textWidthCache = {};
58359       nonPrimaryKeys = /* @__PURE__ */ new Set([
58360         "check_date",
58361         "fixme",
58362         "layer",
58363         "level",
58364         "level:ref",
58365         "note"
58366       ]);
58367       nonPrimaryKeysRegex = /^(ref|survey|note):/;
58368     }
58369   });
58370
58371   // node_modules/exifr/dist/full.esm.mjs
58372   function l(e3, t2 = o) {
58373     if (n2) try {
58374       return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
58375         /* webpackIgnore: true */
58376         e3
58377       ).then(t2);
58378     } catch (t3) {
58379       console.warn(`Couldn't load ${e3}`);
58380     }
58381   }
58382   function c(e3, t2, i3) {
58383     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
58384   }
58385   function p(e3) {
58386     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
58387   }
58388   function g2(e3) {
58389     let t2 = new Error(e3);
58390     throw delete t2.stack, t2;
58391   }
58392   function m2(e3) {
58393     return "" === (e3 = function(e4) {
58394       for (; e4.endsWith("\0"); ) e4 = e4.slice(0, -1);
58395       return e4;
58396     }(e3).trim()) ? void 0 : e3;
58397   }
58398   function S2(e3) {
58399     let t2 = function(e4) {
58400       let t3 = 0;
58401       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;
58402     }(e3);
58403     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
58404   }
58405   function b2(e3) {
58406     return y ? y.decode(e3) : a3 ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C2(e3)));
58407   }
58408   function P2(e3, t2) {
58409     g2(`${e3} '${t2}' was not loaded, try using full build of exifr.`);
58410   }
58411   function D2(e3, n3) {
58412     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");
58413   }
58414   function O2(e3, i3) {
58415     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");
58416     var s2;
58417   }
58418   async function x(e3, t2, i3, n3) {
58419     return A2.has(i3) ? v2(e3, t2, i3) : n3 ? async function(e4, t3) {
58420       let i4 = await t3(e4);
58421       return new I2(i4);
58422     }(e3, n3) : void g2(`Parser ${i3} is not loaded`);
58423   }
58424   async function v2(e3, t2, i3) {
58425     let n3 = new (A2.get(i3))(e3, t2);
58426     return await n3.read(), n3;
58427   }
58428   function U2(e3, t2, i3) {
58429     let n3 = new L2();
58430     for (let [e4, t3] of i3) n3.set(e4, t3);
58431     if (Array.isArray(t2)) for (let i4 of t2) e3.set(i4, n3);
58432     else e3.set(t2, n3);
58433     return n3;
58434   }
58435   function F2(e3, t2, i3) {
58436     let n3, s2 = e3.get(t2);
58437     for (n3 of i3) s2.set(n3[0], n3[1]);
58438   }
58439   function Q2(e3, t2) {
58440     let i3, n3, s2, r2, a4 = [];
58441     for (s2 of t2) {
58442       for (r2 of (i3 = E.get(s2), n3 = [], i3)) (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
58443       n3.length && a4.push([s2, n3]);
58444     }
58445     return a4;
58446   }
58447   function Z(e3, t2) {
58448     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
58449   }
58450   function ee(e3, t2) {
58451     for (let i3 of t2) e3.add(i3);
58452   }
58453   async function ie2(e3, t2) {
58454     let i3 = new te(t2);
58455     return await i3.read(e3), i3.parse();
58456   }
58457   function ae2(e3) {
58458     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
58459   }
58460   function oe2(e3) {
58461     return e3 >= 224 && e3 <= 239;
58462   }
58463   function le2(e3, t2, i3) {
58464     for (let [n3, s2] of T2) if (s2.canHandle(e3, t2, i3)) return n3;
58465   }
58466   function de2(e3, t2, i3, n3) {
58467     var s2 = e3 + t2 / 60 + i3 / 3600;
58468     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
58469   }
58470   async function Se2(e3) {
58471     let t2 = new te(me);
58472     await t2.read(e3);
58473     let i3 = await t2.parse();
58474     if (i3 && i3.gps) {
58475       let { latitude: e4, longitude: t3 } = i3.gps;
58476       return { latitude: e4, longitude: t3 };
58477     }
58478   }
58479   async function ye2(e3) {
58480     let t2 = new te(Ce2);
58481     await t2.read(e3);
58482     let i3 = await t2.extractThumbnail();
58483     return i3 && a3 ? s.from(i3) : i3;
58484   }
58485   async function be2(e3) {
58486     let t2 = await this.thumbnail(e3);
58487     if (void 0 !== t2) {
58488       let e4 = new Blob([t2]);
58489       return URL.createObjectURL(e4);
58490     }
58491   }
58492   async function Pe2(e3) {
58493     let t2 = new te(Ie2);
58494     await t2.read(e3);
58495     let i3 = await t2.parse();
58496     if (i3 && i3.ifd0) return i3.ifd0[274];
58497   }
58498   async function Ae2(e3) {
58499     let t2 = await Pe2(e3);
58500     return Object.assign({ canvas: we2, css: Te2 }, ke2[t2]);
58501   }
58502   function xe2(e3, t2, i3) {
58503     return e3 <= t2 && t2 <= i3;
58504   }
58505   function Ge2(e3) {
58506     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
58507   }
58508   function Ve(e3) {
58509     let t2 = Array.from(e3).slice(1);
58510     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
58511   }
58512   function ze2(e3) {
58513     if ("string" == typeof e3) {
58514       var [t2, i3, n3, s2, r2, a4] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
58515       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a4) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a4)), Number.isNaN(+o2) ? e3 : o2;
58516     }
58517   }
58518   function He2(e3) {
58519     if ("string" == typeof e3) return e3;
58520     let t2 = [];
58521     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]));
58522     else for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je2(e3[i3], e3[i3 + 1]));
58523     return m2(String.fromCodePoint(...t2));
58524   }
58525   function je2(e3, t2) {
58526     return e3 << 8 | t2;
58527   }
58528   function _e2(e3, t2) {
58529     let i3 = e3.serialize();
58530     void 0 !== i3 && (t2[e3.name] = i3);
58531   }
58532   function qe2(e3, t2) {
58533     let i3, n3 = [];
58534     if (!e3) return n3;
58535     for (; null !== (i3 = t2.exec(e3)); ) n3.push(i3);
58536     return n3;
58537   }
58538   function Qe2(e3) {
58539     if (function(e4) {
58540       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
58541     }(e3)) return;
58542     let t2 = Number(e3);
58543     if (!Number.isNaN(t2)) return t2;
58544     let i3 = e3.toLowerCase();
58545     return "true" === i3 || "false" !== i3 && e3.trim();
58546   }
58547   function mt(e3, t2) {
58548     return m2(e3.getString(t2, 4));
58549   }
58550   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;
58551   var init_full_esm = __esm({
58552     "node_modules/exifr/dist/full.esm.mjs"() {
58553       e = "undefined" != typeof self ? self : global;
58554       t = "undefined" != typeof navigator;
58555       i2 = t && "undefined" == typeof HTMLImageElement;
58556       n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
58557       s = e.Buffer;
58558       r = e.BigInt;
58559       a3 = !!s;
58560       o = (e3) => e3;
58561       h2 = e.fetch;
58562       u = (e3) => h2 = e3;
58563       if (!e.fetch) {
58564         const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a4) => {
58565           let { port: o2, hostname: l2, pathname: h3, protocol: u2, search: c2 } = new URL(n3);
58566           const f2 = { method: "GET", hostname: l2, path: encodeURI(h3) + c2, headers: s2 };
58567           "" !== o2 && (f2.port = Number(o2));
58568           const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
58569             if (301 === e4.statusCode || 302 === e4.statusCode) {
58570               let t3 = new URL(e4.headers.location, n3).toString();
58571               return i3(t3, { headers: s2 }).then(r2).catch(a4);
58572             }
58573             r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
58574               let i4 = [];
58575               e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
58576             }) });
58577           });
58578           d2.on("error", a4), d2.end();
58579         });
58580         u(i3);
58581       }
58582       f = (e3) => p(e3) ? void 0 : e3;
58583       d = (e3) => void 0 !== e3;
58584       C2 = (e3) => String.fromCharCode.apply(null, e3);
58585       y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
58586       I2 = class _I {
58587         static from(e3, t2) {
58588           return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
58589         }
58590         constructor(e3, t2 = 0, i3, n3) {
58591           if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3) this.byteOffset = 0, this.byteLength = 0;
58592           else if (e3 instanceof ArrayBuffer) {
58593             void 0 === i3 && (i3 = e3.byteLength - t2);
58594             let n4 = new DataView(e3, t2, i3);
58595             this._swapDataView(n4);
58596           } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
58597             void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
58598             let n4 = new DataView(e3.buffer, t2, i3);
58599             this._swapDataView(n4);
58600           } else if ("number" == typeof e3) {
58601             let t3 = new DataView(new ArrayBuffer(e3));
58602             this._swapDataView(t3);
58603           } else g2("Invalid input argument for BufferView: " + e3);
58604         }
58605         _swapArrayBuffer(e3) {
58606           this._swapDataView(new DataView(e3));
58607         }
58608         _swapBuffer(e3) {
58609           this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
58610         }
58611         _swapDataView(e3) {
58612           this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
58613         }
58614         _lengthToEnd(e3) {
58615           return this.byteLength - e3;
58616         }
58617         set(e3, t2, i3 = _I) {
58618           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);
58619         }
58620         subarray(e3, t2) {
58621           return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
58622         }
58623         toUint8() {
58624           return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
58625         }
58626         getUint8Array(e3, t2) {
58627           return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
58628         }
58629         getString(e3 = 0, t2 = this.byteLength) {
58630           return b2(this.getUint8Array(e3, t2));
58631         }
58632         getLatin1String(e3 = 0, t2 = this.byteLength) {
58633           let i3 = this.getUint8Array(e3, t2);
58634           return C2(i3);
58635         }
58636         getUnicodeString(e3 = 0, t2 = this.byteLength) {
58637           const i3 = [];
58638           for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2) i3.push(this.getUint16(e3 + n3));
58639           return C2(i3);
58640         }
58641         getInt8(e3) {
58642           return this.dataView.getInt8(e3);
58643         }
58644         getUint8(e3) {
58645           return this.dataView.getUint8(e3);
58646         }
58647         getInt16(e3, t2 = this.le) {
58648           return this.dataView.getInt16(e3, t2);
58649         }
58650         getInt32(e3, t2 = this.le) {
58651           return this.dataView.getInt32(e3, t2);
58652         }
58653         getUint16(e3, t2 = this.le) {
58654           return this.dataView.getUint16(e3, t2);
58655         }
58656         getUint32(e3, t2 = this.le) {
58657           return this.dataView.getUint32(e3, t2);
58658         }
58659         getFloat32(e3, t2 = this.le) {
58660           return this.dataView.getFloat32(e3, t2);
58661         }
58662         getFloat64(e3, t2 = this.le) {
58663           return this.dataView.getFloat64(e3, t2);
58664         }
58665         getFloat(e3, t2 = this.le) {
58666           return this.dataView.getFloat32(e3, t2);
58667         }
58668         getDouble(e3, t2 = this.le) {
58669           return this.dataView.getFloat64(e3, t2);
58670         }
58671         getUintBytes(e3, t2, i3) {
58672           switch (t2) {
58673             case 1:
58674               return this.getUint8(e3, i3);
58675             case 2:
58676               return this.getUint16(e3, i3);
58677             case 4:
58678               return this.getUint32(e3, i3);
58679             case 8:
58680               return this.getUint64 && this.getUint64(e3, i3);
58681           }
58682         }
58683         getUint(e3, t2, i3) {
58684           switch (t2) {
58685             case 8:
58686               return this.getUint8(e3, i3);
58687             case 16:
58688               return this.getUint16(e3, i3);
58689             case 32:
58690               return this.getUint32(e3, i3);
58691             case 64:
58692               return this.getUint64 && this.getUint64(e3, i3);
58693           }
58694         }
58695         toString(e3) {
58696           return this.dataView.toString(e3, this.constructor.name);
58697         }
58698         ensureChunk() {
58699         }
58700       };
58701       k2 = class extends Map {
58702         constructor(e3) {
58703           super(), this.kind = e3;
58704         }
58705         get(e3, t2) {
58706           return this.has(e3) || P2(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
58707             g2(`Unknown ${e4} '${t3}'.`);
58708           }(this.kind, e3), t2[e3].enabled || P2(this.kind, e3)), super.get(e3);
58709         }
58710         keyList() {
58711           return Array.from(this.keys());
58712         }
58713       };
58714       w2 = new k2("file parser");
58715       T2 = new k2("segment parser");
58716       A2 = new k2("file reader");
58717       M2 = (e3) => h2(e3).then((e4) => e4.arrayBuffer());
58718       R2 = (e3) => new Promise((t2, i3) => {
58719         let n3 = new FileReader();
58720         n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
58721       });
58722       L2 = class extends Map {
58723         get tagKeys() {
58724           return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
58725         }
58726         get tagValues() {
58727           return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
58728         }
58729       };
58730       E = /* @__PURE__ */ new Map();
58731       B2 = /* @__PURE__ */ new Map();
58732       N2 = /* @__PURE__ */ new Map();
58733       G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
58734       V2 = ["jfif", "xmp", "icc", "iptc", "ihdr"];
58735       z2 = ["tiff", ...V2];
58736       H2 = ["ifd0", "ifd1", "exif", "gps", "interop"];
58737       j2 = [...z2, ...H2];
58738       W2 = ["makerNote", "userComment"];
58739       K2 = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
58740       X3 = [...K2, "sanitize", "mergeOutput", "silentErrors"];
58741       _2 = class {
58742         get translate() {
58743           return this.translateKeys || this.translateValues || this.reviveValues;
58744         }
58745       };
58746       Y = class extends _2 {
58747         get needed() {
58748           return this.enabled || this.deps.size > 0;
58749         }
58750         constructor(e3, t2, i3, n3) {
58751           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);
58752           else if ("object" == typeof i3) {
58753             if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
58754               let { pick: e4, skip: t3 } = i3;
58755               e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
58756             }
58757             this.applyInheritables(i3);
58758           } else true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2(`Invalid options argument: ${i3}`);
58759         }
58760         applyInheritables(e3) {
58761           let t2, i3;
58762           for (t2 of K2) i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
58763         }
58764         translateTagSet(e3, t2) {
58765           if (this.dict) {
58766             let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
58767             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);
58768           } else for (let i3 of e3) t2.add(i3);
58769         }
58770         finalizeFilters() {
58771           !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);
58772         }
58773       };
58774       $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 };
58775       J2 = /* @__PURE__ */ new Map();
58776       q2 = class extends _2 {
58777         static useCached(e3) {
58778           let t2 = J2.get(e3);
58779           return void 0 !== t2 || (t2 = new this(e3), J2.set(e3, t2)), t2;
58780         }
58781         constructor(e3) {
58782           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();
58783         }
58784         setupFromUndefined() {
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] = $3[e3];
58789           for (e3 of j2) this[e3] = new Y(e3, $3[e3], void 0, this);
58790         }
58791         setupFromTrue() {
58792           let e3;
58793           for (e3 of G) this[e3] = $3[e3];
58794           for (e3 of X3) this[e3] = $3[e3];
58795           for (e3 of W2) this[e3] = true;
58796           for (e3 of j2) this[e3] = new Y(e3, true, void 0, this);
58797         }
58798         setupFromArray(e3) {
58799           let t2;
58800           for (t2 of G) this[t2] = $3[t2];
58801           for (t2 of X3) this[t2] = $3[t2];
58802           for (t2 of W2) this[t2] = $3[t2];
58803           for (t2 of j2) this[t2] = new Y(t2, false, void 0, this);
58804           this.setupGlobalFilters(e3, void 0, H2);
58805         }
58806         setupFromObject(e3) {
58807           let t2;
58808           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]);
58809           for (t2 of X3) this[t2] = Z(e3[t2], $3[t2]);
58810           for (t2 of W2) this[t2] = Z(e3[t2], $3[t2]);
58811           for (t2 of z2) this[t2] = new Y(t2, $3[t2], e3[t2], this);
58812           for (t2 of H2) this[t2] = new Y(t2, $3[t2], e3[t2], this.tiff);
58813           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);
58814         }
58815         batchEnableWithBool(e3, t2) {
58816           for (let i3 of e3) this[i3].enabled = t2;
58817         }
58818         batchEnableWithUserValue(e3, t2) {
58819           for (let i3 of e3) {
58820             let e4 = t2[i3];
58821             this[i3].enabled = false !== e4 && void 0 !== e4;
58822           }
58823         }
58824         setupGlobalFilters(e3, t2, i3, n3 = i3) {
58825           if (e3 && e3.length) {
58826             for (let e4 of n3) this[e4].enabled = false;
58827             let t3 = Q2(e3, i3);
58828             for (let [e4, i4] of t3) ee(this[e4].pick, i4), this[e4].enabled = true;
58829           } else if (t2 && t2.length) {
58830             let e4 = Q2(t2, i3);
58831             for (let [t3, i4] of e4) ee(this[t3].skip, i4);
58832           }
58833         }
58834         filterNestedSegmentTags() {
58835           let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
58836           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);
58837         }
58838         traverseTiffDependencyTree() {
58839           let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
58840           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;
58841           for (let e4 of H2) this[e4].finalizeFilters();
58842         }
58843         get onlyTiff() {
58844           return !V2.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
58845         }
58846         checkLoadedPlugins() {
58847           for (let e3 of z2) this[e3].enabled && !T2.has(e3) && P2("segment parser", e3);
58848         }
58849       };
58850       c(q2, "default", $3);
58851       te = class {
58852         constructor(e3) {
58853           c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q2.useCached(e3);
58854         }
58855         async read(e3) {
58856           this.file = await D2(e3, this.options);
58857         }
58858         setup() {
58859           if (this.fileParser) return;
58860           let { file: e3 } = this, t2 = e3.getUint16(0);
58861           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;
58862           this.file.close && this.file.close(), g2("Unknown file format");
58863         }
58864         async parse() {
58865           let { output: e3, errors: t2 } = this;
58866           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);
58867         }
58868         async executeParsers() {
58869           let { output: e3 } = this;
58870           await this.fileParser.parse();
58871           let t2 = Object.values(this.parsers).map(async (t3) => {
58872             let i3 = await t3.parse();
58873             t3.assignToOutput(e3, i3);
58874           });
58875           this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
58876         }
58877         async extractThumbnail() {
58878           this.setup();
58879           let { options: e3, file: t2 } = this, i3 = T2.get("tiff", e3);
58880           var n3;
58881           if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3) return;
58882           let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a4 = await r2.extractThumbnail();
58883           return t2.close && t2.close(), a4;
58884         }
58885       };
58886       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 });
58887       se2 = class {
58888         constructor(e3, t2, i3) {
58889           c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
58890             let t3 = e4.start, i4 = e4.size || 65536;
58891             if (this.file.chunked) if (this.file.available(t3, i4)) e4.chunk = this.file.subarray(t3, i4);
58892             else try {
58893               e4.chunk = await this.file.readChunk(t3, i4);
58894             } catch (t4) {
58895               g2(`Couldn't read segment: ${JSON.stringify(e4)}. ${t4.message}`);
58896             }
58897             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));
58898             return e4.chunk;
58899           }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
58900         }
58901         injectSegment(e3, t2) {
58902           this.options[e3].enabled && this.createParser(e3, t2);
58903         }
58904         createParser(e3, t2) {
58905           let i3 = new (T2.get(e3))(t2, this.options, this.file);
58906           return this.parsers[e3] = i3;
58907         }
58908         createParsers(e3) {
58909           for (let t2 of e3) {
58910             let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
58911             if (n3 && n3.enabled) {
58912               let t3 = this.parsers[e4];
58913               t3 && t3.append || t3 || this.createParser(e4, i3);
58914             }
58915           }
58916         }
58917         async readSegments(e3) {
58918           let t2 = e3.map(this.ensureSegmentChunk);
58919           await Promise.all(t2);
58920         }
58921       };
58922       re3 = class {
58923         static findPosition(e3, t2) {
58924           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;
58925           return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
58926         }
58927         static parse(e3, t2 = {}) {
58928           return new this(e3, new q2({ [this.type]: t2 }), e3).parse();
58929         }
58930         normalizeInput(e3) {
58931           return e3 instanceof I2 ? e3 : new I2(e3);
58932         }
58933         constructor(e3, t2 = {}, i3) {
58934           c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
58935             if (!this.options.silentErrors) throw e4;
58936             this.errors.push(e4.message);
58937           }), 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;
58938         }
58939         translate() {
58940           this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
58941         }
58942         get output() {
58943           return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
58944         }
58945         translateBlock(e3, t2) {
58946           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 = {};
58947           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;
58948           return h3;
58949         }
58950         translateValue(e3, t2) {
58951           return t2[e3] || t2.DEFAULT || e3;
58952         }
58953         assignToOutput(e3, t2) {
58954           this.assignObjectToOutput(e3, this.constructor.type, t2);
58955         }
58956         assignObjectToOutput(e3, t2, i3) {
58957           if (this.globalOptions.mergeOutput) return Object.assign(e3, i3);
58958           e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
58959         }
58960       };
58961       c(re3, "headerLength", 4), c(re3, "type", void 0), c(re3, "multiSegment", false), c(re3, "canHandle", () => false);
58962       he2 = class extends se2 {
58963         constructor(...e3) {
58964           super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
58965         }
58966         static canHandle(e3, t2) {
58967           return 65496 === t2;
58968         }
58969         async parse() {
58970           await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
58971         }
58972         setupSegmentFinderArgs(e3) {
58973           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;
58974         }
58975         async findAppSegments(e3 = 0, t2) {
58976           this.setupSegmentFinderArgs(t2);
58977           let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
58978           if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
58979             let t3 = T2.get(e4), i4 = this.options[e4];
58980             return t3.multiSegment && i4.multiSegment;
58981           }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
58982             let t3 = false;
58983             for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
58984               let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
58985               if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength))) return;
58986             }
58987           }
58988         }
58989         findAppSegmentsInRange(e3, t2) {
58990           t2 -= 2;
58991           let i3, n3, s2, r2, a4, o2, { file: l2, findAll: h3, wanted: u2, remaining: c2, options: f2 } = this;
58992           for (; e3 < t2; e3++) if (255 === l2.getUint8(e3)) {
58993             if (i3 = l2.getUint8(e3 + 1), oe2(i3)) {
58994               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;
58995               f2.recordUnknownSegments && (a4 = re3.findPosition(l2, e3), a4.marker = i3, this.unknownSegments.push(a4)), e3 += n3 + 1;
58996             } else if (ae2(i3)) {
58997               if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos) return;
58998               f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
58999             }
59000           }
59001           return e3;
59002         }
59003         mergeMultiSegments() {
59004           if (!this.appSegments.some((e4) => e4.multiSegment)) return;
59005           let e3 = function(e4, t2) {
59006             let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
59007             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);
59008             return Array.from(r2);
59009           }(this.appSegments, "type");
59010           this.mergedAppSegments = e3.map(([e4, t2]) => {
59011             let i3 = T2.get(e4, this.options);
59012             if (i3.handleMultiSegments) {
59013               return { type: e4, chunk: i3.handleMultiSegments(t2) };
59014             }
59015             return t2[0];
59016           });
59017         }
59018         getSegment(e3) {
59019           return this.appSegments.find((t2) => t2.type === e3);
59020         }
59021         async getOrFindSegment(e3) {
59022           let t2 = this.getSegment(e3);
59023           return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
59024         }
59025       };
59026       c(he2, "type", "jpeg"), w2.set("jpeg", he2);
59027       ue2 = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
59028       ce2 = class extends re3 {
59029         parseHeader() {
59030           var e3 = this.chunk.getUint16();
59031           18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
59032         }
59033         parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
59034           let { pick: n3, skip: s2 } = this.options[t2];
59035           n3 = new Set(n3);
59036           let r2 = n3.size > 0, a4 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
59037           e3 += 2;
59038           for (let l2 = 0; l2 < o2; l2++) {
59039             let o3 = this.chunk.getUint16(e3);
59040             if (r2) {
59041               if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size)) break;
59042             } else !a4 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
59043             e3 += 12;
59044           }
59045           return i3;
59046         }
59047         parseTag(e3, t2, i3) {
59048           let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a4 = ue2[s2];
59049           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);
59050           if (2 === s2) return m2(n3.getString(e3, r2));
59051           if (7 === s2) return n3.getUint8Array(e3, r2);
59052           if (1 === r2) return this.parseTagValue(s2, e3);
59053           {
59054             let t3 = new (function(e4) {
59055               switch (e4) {
59056                 case 1:
59057                   return Uint8Array;
59058                 case 3:
59059                   return Uint16Array;
59060                 case 4:
59061                   return Uint32Array;
59062                 case 5:
59063                   return Array;
59064                 case 6:
59065                   return Int8Array;
59066                 case 8:
59067                   return Int16Array;
59068                 case 9:
59069                   return Int32Array;
59070                 case 10:
59071                   return Array;
59072                 case 11:
59073                   return Float32Array;
59074                 case 12:
59075                   return Float64Array;
59076                 default:
59077                   return Array;
59078               }
59079             }(s2))(r2), i4 = a4;
59080             for (let n4 = 0; n4 < r2; n4++) t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
59081             return t3;
59082           }
59083         }
59084         parseTagValue(e3, t2) {
59085           let { chunk: i3 } = this;
59086           switch (e3) {
59087             case 1:
59088               return i3.getUint8(t2);
59089             case 3:
59090               return i3.getUint16(t2);
59091             case 4:
59092               return i3.getUint32(t2);
59093             case 5:
59094               return i3.getUint32(t2) / i3.getUint32(t2 + 4);
59095             case 6:
59096               return i3.getInt8(t2);
59097             case 8:
59098               return i3.getInt16(t2);
59099             case 9:
59100               return i3.getInt32(t2);
59101             case 10:
59102               return i3.getInt32(t2) / i3.getInt32(t2 + 4);
59103             case 11:
59104               return i3.getFloat(t2);
59105             case 12:
59106               return i3.getDouble(t2);
59107             case 13:
59108               return i3.getUint32(t2);
59109             default:
59110               g2(`Invalid tiff type ${e3}`);
59111           }
59112         }
59113       };
59114       fe2 = class extends ce2 {
59115         static canHandle(e3, t2) {
59116           return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
59117         }
59118         async parse() {
59119           this.parseHeader();
59120           let { options: e3 } = this;
59121           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();
59122         }
59123         safeParse(e3) {
59124           let t2 = this[e3]();
59125           return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
59126         }
59127         findIfd0Offset() {
59128           void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
59129         }
59130         findIfd1Offset() {
59131           if (void 0 === this.ifd1Offset) {
59132             this.findIfd0Offset();
59133             let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
59134             this.ifd1Offset = this.chunk.getUint32(t2);
59135           }
59136         }
59137         parseBlock(e3, t2) {
59138           let i3 = /* @__PURE__ */ new Map();
59139           return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
59140         }
59141         async parseIfd0Block() {
59142           if (this.ifd0) return;
59143           let { file: e3 } = this;
59144           this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2(`IFD0 offset points to outside of file.
59145 this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S2(this.options));
59146           let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
59147           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;
59148         }
59149         async parseExifBlock() {
59150           if (this.exif) return;
59151           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset) return;
59152           this.file.tiff && await this.file.ensureChunk(this.exifOffset, S2(this.options));
59153           let e3 = this.parseBlock(this.exifOffset, "exif");
59154           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;
59155         }
59156         unpack(e3, t2) {
59157           let i3 = e3.get(t2);
59158           i3 && 1 === i3.length && e3.set(t2, i3[0]);
59159         }
59160         async parseGpsBlock() {
59161           if (this.gps) return;
59162           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset) return;
59163           let e3 = this.parseBlock(this.gpsOffset, "gps");
59164           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;
59165         }
59166         async parseInteropBlock() {
59167           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");
59168         }
59169         async parseThumbnailBlock(e3 = false) {
59170           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;
59171         }
59172         async extractThumbnail() {
59173           if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1) return;
59174           let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
59175           return this.chunk.getUint8Array(e3, t2);
59176         }
59177         get image() {
59178           return this.ifd0;
59179         }
59180         get thumbnail() {
59181           return this.ifd1;
59182         }
59183         createOutput() {
59184           let e3, t2, i3, n3 = {};
59185           for (t2 of H2) if (e3 = this[t2], !p(e3)) if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
59186             if ("ifd1" === t2) continue;
59187             Object.assign(n3, i3);
59188           } else n3[t2] = i3;
59189           return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
59190         }
59191         assignToOutput(e3, t2) {
59192           if (this.globalOptions.mergeOutput) Object.assign(e3, t2);
59193           else for (let [i3, n3] of Object.entries(t2)) this.assignObjectToOutput(e3, i3, n3);
59194         }
59195       };
59196       c(fe2, "type", "tiff"), c(fe2, "headerLength", 10), T2.set("tiff", fe2);
59197       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 });
59198       ge2 = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
59199       me = Object.assign({}, ge2, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
59200       Ce2 = Object.assign({}, ge2, { tiff: false, ifd1: true, mergeOutput: false });
59201       Ie2 = Object.assign({}, ge2, { firstChunkSize: 4e4, ifd0: [274] });
59202       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 } });
59203       we2 = true;
59204       Te2 = true;
59205       if ("object" == typeof navigator) {
59206         let e3 = navigator.userAgent;
59207         if (e3.includes("iPad") || e3.includes("iPhone")) {
59208           let t2 = e3.match(/OS (\d+)_(\d+)/);
59209           if (t2) {
59210             let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
59211             we2 = n3 < 13.4, Te2 = false;
59212           }
59213         } else if (e3.includes("OS X 10")) {
59214           let [, t2] = e3.match(/OS X 10[_.](\d+)/);
59215           we2 = Te2 = Number(t2) < 15;
59216         }
59217         if (e3.includes("Chrome/")) {
59218           let [, t2] = e3.match(/Chrome\/(\d+)/);
59219           we2 = Te2 = Number(t2) < 81;
59220         } else if (e3.includes("Firefox/")) {
59221           let [, t2] = e3.match(/Firefox\/(\d+)/);
59222           we2 = Te2 = Number(t2) < 77;
59223         }
59224       }
59225       De2 = class extends I2 {
59226         constructor(...e3) {
59227           super(...e3), c(this, "ranges", new Oe2()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
59228         }
59229         _tryExtend(e3, t2, i3) {
59230           if (0 === e3 && 0 === this.byteLength && i3) {
59231             let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
59232             this._swapDataView(e4);
59233           } else {
59234             let i4 = e3 + t2;
59235             if (i4 > this.byteLength) {
59236               let { dataView: e4 } = this._extend(i4);
59237               this._swapDataView(e4);
59238             }
59239           }
59240         }
59241         _extend(e3) {
59242           let t2;
59243           t2 = a3 ? s.allocUnsafe(e3) : new Uint8Array(e3);
59244           let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
59245           return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
59246         }
59247         subarray(e3, t2, i3 = false) {
59248           return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
59249         }
59250         set(e3, t2, i3 = false) {
59251           i3 && this._tryExtend(t2, e3.byteLength, e3);
59252           let n3 = super.set(e3, t2);
59253           return this.ranges.add(t2, n3.byteLength), n3;
59254         }
59255         async ensureChunk(e3, t2) {
59256           this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
59257         }
59258         available(e3, t2) {
59259           return this.ranges.available(e3, t2);
59260         }
59261       };
59262       Oe2 = class {
59263         constructor() {
59264           c(this, "list", []);
59265         }
59266         get length() {
59267           return this.list.length;
59268         }
59269         add(e3, t2, i3 = 0) {
59270           let n3 = e3 + t2, s2 = this.list.filter((t3) => xe2(e3, t3.offset, n3) || xe2(e3, t3.end, n3));
59271           if (s2.length > 0) {
59272             e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
59273             let i4 = s2.shift();
59274             i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
59275           } else this.list.push({ offset: e3, length: t2, end: n3 });
59276         }
59277         available(e3, t2) {
59278           let i3 = e3 + t2;
59279           return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
59280         }
59281       };
59282       ve2 = class extends De2 {
59283         constructor(e3, t2) {
59284           super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
59285         }
59286         async readWhole() {
59287           this.chunked = false, await this.readChunk(this.nextChunkOffset);
59288         }
59289         async readChunked() {
59290           this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
59291         }
59292         async readNextChunk(e3 = this.nextChunkOffset) {
59293           if (this.fullyRead) return this.chunksRead++, false;
59294           let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
59295           return !!i3 && i3.byteLength === t2;
59296         }
59297         async readChunk(e3, t2) {
59298           if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2))) return this._readChunk(e3, t2);
59299         }
59300         safeWrapAddress(e3, t2) {
59301           return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
59302         }
59303         get nextChunkOffset() {
59304           if (0 !== this.ranges.list.length) return this.ranges.list[0].length;
59305         }
59306         get canReadNextChunk() {
59307           return this.chunksRead < this.options.chunkLimit;
59308         }
59309         get fullyRead() {
59310           return void 0 !== this.size && this.nextChunkOffset === this.size;
59311         }
59312         read() {
59313           return this.options.chunked ? this.readChunked() : this.readWhole();
59314         }
59315         close() {
59316         }
59317       };
59318       A2.set("blob", class extends ve2 {
59319         async readWhole() {
59320           this.chunked = false;
59321           let e3 = await R2(this.input);
59322           this._swapArrayBuffer(e3);
59323         }
59324         readChunked() {
59325           return this.chunked = true, this.size = this.input.size, super.readChunked();
59326         }
59327         async _readChunk(e3, t2) {
59328           let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R2(n3);
59329           return this.set(s2, e3, true);
59330         }
59331       });
59332       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() {
59333         return we2;
59334       }, get rotateCss() {
59335         return Te2;
59336       }, rotation: Ae2 });
59337       A2.set("url", class extends ve2 {
59338         async readWhole() {
59339           this.chunked = false;
59340           let e3 = await M2(this.input);
59341           e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
59342         }
59343         async _readChunk(e3, t2) {
59344           let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
59345           (e3 || i3) && (n3.range = `bytes=${[e3, i3].join("-")}`);
59346           let s2 = await h2(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a4 = r2.byteLength;
59347           if (416 !== s2.status) return a4 !== t2 && (this.size = e3 + a4), this.set(r2, e3, true);
59348         }
59349       });
59350       I2.prototype.getUint64 = function(e3) {
59351         let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
59352         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.");
59353       };
59354       Re2 = class extends se2 {
59355         parseBoxes(e3 = 0) {
59356           let t2 = [];
59357           for (; e3 < this.file.byteLength - 4; ) {
59358             let i3 = this.parseBoxHead(e3);
59359             if (t2.push(i3), 0 === i3.length) break;
59360             e3 += i3.length;
59361           }
59362           return t2;
59363         }
59364         parseSubBoxes(e3) {
59365           e3.boxes = this.parseBoxes(e3.start);
59366         }
59367         findBox(e3, t2) {
59368           return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
59369         }
59370         parseBoxHead(e3) {
59371           let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
59372           return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
59373         }
59374         parseBoxFullHead(e3) {
59375           if (void 0 !== e3.version) return;
59376           let t2 = this.file.getUint32(e3.start);
59377           e3.version = t2 >> 24, e3.start += 4;
59378         }
59379       };
59380       Le2 = class extends Re2 {
59381         static canHandle(e3, t2) {
59382           if (0 !== t2) return false;
59383           let i3 = e3.getUint16(2);
59384           if (i3 > 50) return false;
59385           let n3 = 16, s2 = [];
59386           for (; n3 < i3; ) s2.push(e3.getString(n3, 4)), n3 += 4;
59387           return s2.includes(this.type);
59388         }
59389         async parse() {
59390           let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
59391           for (; "meta" !== t2.kind; ) e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
59392           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);
59393         }
59394         async registerSegment(e3, t2, i3) {
59395           await this.file.ensureChunk(t2, i3);
59396           let n3 = this.file.subarray(t2, i3);
59397           this.createParser(e3, n3);
59398         }
59399         async findIcc(e3) {
59400           let t2 = this.findBox(e3, "iprp");
59401           if (void 0 === t2) return;
59402           let i3 = this.findBox(t2, "ipco");
59403           if (void 0 === i3) return;
59404           let n3 = this.findBox(i3, "colr");
59405           void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
59406         }
59407         async findExif(e3) {
59408           let t2 = this.findBox(e3, "iinf");
59409           if (void 0 === t2) return;
59410           let i3 = this.findBox(e3, "iloc");
59411           if (void 0 === i3) return;
59412           let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
59413           if (void 0 === s2) return;
59414           let [r2, a4] = s2;
59415           await this.file.ensureChunk(r2, a4);
59416           let o2 = 4 + this.file.getUint32(r2);
59417           r2 += o2, a4 -= o2, await this.registerSegment("tiff", r2, a4);
59418         }
59419         findExifLocIdInIinf(e3) {
59420           this.parseBoxFullHead(e3);
59421           let t2, i3, n3, s2, r2 = e3.start, a4 = this.file.getUint16(r2);
59422           for (r2 += 2; a4--; ) {
59423             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);
59424             r2 += t2.length;
59425           }
59426         }
59427         get8bits(e3) {
59428           let t2 = this.file.getUint8(e3);
59429           return [t2 >> 4, 15 & t2];
59430         }
59431         findExtentInIloc(e3, t2) {
59432           this.parseBoxFullHead(e3);
59433           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);
59434           for (i3 += u2; c2--; ) {
59435             let e4 = this.file.getUintBytes(i3, o2);
59436             i3 += o2 + l2 + 2 + r2;
59437             let u3 = this.file.getUint16(i3);
59438             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)];
59439             i3 += u3 * h3;
59440           }
59441         }
59442       };
59443       Ue2 = class extends Le2 {
59444       };
59445       c(Ue2, "type", "heic");
59446       Fe2 = class extends Le2 {
59447       };
59448       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" }]]);
59449       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" }]]);
59450       Be2 = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
59451       Ee2.set(37392, Be2), Ee2.set(41488, Be2);
59452       Ne2 = { 0: "Normal", 1: "Low", 2: "High" };
59453       Ee2.set(41992, Ne2), Ee2.set(41993, Ne2), Ee2.set(41994, Ne2), U2(N2, ["ifd0", "ifd1"], [[50827, function(e3) {
59454         return "string" != typeof e3 ? b2(e3) : e3;
59455       }], [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(":")]]);
59456       We2 = class extends re3 {
59457         static canHandle(e3, t2) {
59458           return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
59459         }
59460         static headerLength(e3, t2) {
59461           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;
59462         }
59463         static findPosition(e3, t2) {
59464           let i3 = super.findPosition(e3, t2);
59465           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;
59466         }
59467         static handleMultiSegments(e3) {
59468           return e3.map((e4) => e4.chunk.getString()).join("");
59469         }
59470         normalizeInput(e3) {
59471           return "string" == typeof e3 ? e3 : I2.from(e3).getString();
59472         }
59473         parse(e3 = this.chunk) {
59474           if (!this.localOptions.parse) return e3;
59475           e3 = function(e4) {
59476             let t3 = {}, i4 = {};
59477             for (let e6 of Ze2) t3[e6] = [], i4[e6] = 0;
59478             return e4.replace(et, (e6, n4, s2) => {
59479               if ("<" === n4) {
59480                 let n5 = ++i4[s2];
59481                 return t3[s2].push(n5), `${e6}#${n5}`;
59482               }
59483               return `${e6}#${t3[s2].pop()}`;
59484             });
59485           }(e3);
59486           let t2 = Xe2.findAll(e3, "rdf", "Description");
59487           0 === t2.length && t2.push(new Xe2("rdf", "Description", void 0, e3));
59488           let i3, n3 = {};
59489           for (let e4 of t2) for (let t3 of e4.properties) i3 = Je2(t3.ns, n3), _e2(t3, i3);
59490           return function(e4) {
59491             let t3;
59492             for (let i4 in e4) t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
59493             return f(e4);
59494           }(n3);
59495         }
59496         assignToOutput(e3, t2) {
59497           if (this.localOptions.parse) for (let [i3, n3] of Object.entries(t2)) switch (i3) {
59498             case "tiff":
59499               this.assignObjectToOutput(e3, "ifd0", n3);
59500               break;
59501             case "exif":
59502               this.assignObjectToOutput(e3, "exif", n3);
59503               break;
59504             case "xmlns":
59505               break;
59506             default:
59507               this.assignObjectToOutput(e3, i3, n3);
59508           }
59509           else e3.xmp = t2;
59510         }
59511       };
59512       c(We2, "type", "xmp"), c(We2, "multiSegment", true), T2.set("xmp", We2);
59513       Ke2 = class _Ke {
59514         static findAll(e3) {
59515           return qe2(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
59516         }
59517         static unpackMatch(e3) {
59518           let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
59519           return n3 = Qe2(n3), new _Ke(t2, i3, n3);
59520         }
59521         constructor(e3, t2, i3) {
59522           this.ns = e3, this.name = t2, this.value = i3;
59523         }
59524         serialize() {
59525           return this.value;
59526         }
59527       };
59528       Xe2 = class _Xe {
59529         static findAll(e3, t2, i3) {
59530           if (void 0 !== t2 || void 0 !== i3) {
59531             t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
59532             var n3 = new RegExp(`<(${t2}):(${i3})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`, "gm");
59533           } else n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
59534           return qe2(e3, n3).map(_Xe.unpackMatch);
59535         }
59536         static unpackMatch(e3) {
59537           let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
59538           return new _Xe(t2, i3, n3, s2);
59539         }
59540         constructor(e3, t2, i3, n3) {
59541           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];
59542         }
59543         get isPrimitive() {
59544           return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
59545         }
59546         get isListContainer() {
59547           return 1 === this.children.length && this.children[0].isList;
59548         }
59549         get isList() {
59550           let { ns: e3, name: t2 } = this;
59551           return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
59552         }
59553         get isListItem() {
59554           return "rdf" === this.ns && "li" === this.name;
59555         }
59556         serialize() {
59557           if (0 === this.properties.length && void 0 === this.value) return;
59558           if (this.isPrimitive) return this.value;
59559           if (this.isListContainer) return this.children[0].serialize();
59560           if (this.isList) return $e2(this.children.map(Ye));
59561           if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length) return this.children[0].serialize();
59562           let e3 = {};
59563           for (let t2 of this.properties) _e2(t2, e3);
59564           return void 0 !== this.value && (e3.value = this.value), f(e3);
59565         }
59566       };
59567       Ye = (e3) => e3.serialize();
59568       $e2 = (e3) => 1 === e3.length ? e3[0] : e3;
59569       Je2 = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
59570       Ze2 = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
59571       et = new RegExp(`(<|\\/)(${Ze2.join("|")})`, "g");
59572       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() {
59573         return we2;
59574       }, get rotateCss() {
59575         return Te2;
59576       }, rotation: Ae2 });
59577       at = l("fs", (e3) => e3.promises);
59578       A2.set("fs", class extends ve2 {
59579         async readWhole() {
59580           this.chunked = false, this.fs = await at;
59581           let e3 = await this.fs.readFile(this.input);
59582           this._swapBuffer(e3);
59583         }
59584         async readChunked() {
59585           this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
59586         }
59587         async open() {
59588           void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
59589         }
59590         async _readChunk(e3, t2) {
59591           void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
59592           var i3 = this.subarray(e3, t2, true);
59593           return await this.fh.read(i3.dataView, 0, t2, e3), i3;
59594         }
59595         async close() {
59596           if (this.fh) {
59597             let e3 = this.fh;
59598             this.fh = void 0, await e3.close();
59599           }
59600         }
59601       });
59602       A2.set("base64", class extends ve2 {
59603         constructor(...e3) {
59604           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);
59605         }
59606         async _readChunk(e3, t2) {
59607           let i3, n3, r2 = this.input;
59608           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);
59609           let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
59610           r2 = r2.slice(i3, l2);
59611           let h3 = Math.min(t2, this.size - e3);
59612           if (a3) {
59613             let t3 = s.from(r2, "base64").slice(n3, n3 + h3);
59614             return this.set(t3, e3, true);
59615           }
59616           {
59617             let t3 = this.subarray(e3, h3, true), i4 = atob(r2), s2 = t3.toUint8();
59618             for (let e4 = 0; e4 < h3; e4++) s2[e4] = i4.charCodeAt(n3 + e4);
59619             return t3;
59620           }
59621         }
59622       });
59623       ot = class extends se2 {
59624         static canHandle(e3, t2) {
59625           return 18761 === t2 || 19789 === t2;
59626         }
59627         extendOptions(e3) {
59628           let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
59629           i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
59630         }
59631         async parse() {
59632           let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
59633           if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
59634             let e4 = Math.max(S2(this.options), this.options.chunkSize);
59635             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");
59636           }
59637         }
59638         adaptTiffPropAsSegment(e3) {
59639           if (this.parsers.tiff[e3]) {
59640             let t2 = this.parsers.tiff[e3];
59641             this.injectSegment(e3, t2);
59642           }
59643         }
59644       };
59645       c(ot, "type", "tiff"), w2.set("tiff", ot);
59646       lt = l("zlib");
59647       ht = ["ihdr", "iccp", "text", "itxt", "exif"];
59648       ut = class extends se2 {
59649         constructor(...e3) {
59650           super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
59651         }
59652         static canHandle(e3, t2) {
59653           return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
59654         }
59655         async parse() {
59656           let { file: e3 } = this;
59657           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);
59658         }
59659         async findPngChunksInRange(e3, t2) {
59660           let { file: i3 } = this;
59661           for (; e3 < t2; ) {
59662             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 };
59663             ht.includes(s2) ? this.metaChunks.push(a4) : this.unknownChunks.push(a4), e3 += r2;
59664           }
59665         }
59666         parseTextChunks() {
59667           let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
59668           for (let t2 of e3) {
59669             let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
59670             this.injectKeyValToIhdr(e4, i3);
59671           }
59672         }
59673         injectKeyValToIhdr(e3, t2) {
59674           let i3 = this.parsers.ihdr;
59675           i3 && i3.raw.set(e3, t2);
59676         }
59677         findIhdr() {
59678           let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
59679           e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
59680         }
59681         async findExif() {
59682           let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
59683           e3 && this.injectSegment("tiff", e3.chunk);
59684         }
59685         async findXmp() {
59686           let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
59687           for (let t2 of e3) {
59688             "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
59689           }
59690         }
59691         async findIcc() {
59692           let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
59693           if (!e3) return;
59694           let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
59695           for (; s2 < 80 && 0 !== i3[s2]; ) s2++;
59696           let r2 = s2 + 2, a4 = t2.getString(0, s2);
59697           if (this.injectKeyValToIhdr("ProfileName", a4), n2) {
59698             let e4 = await lt, i4 = t2.getUint8Array(r2);
59699             i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
59700           }
59701         }
59702       };
59703       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"]]);
59704       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"]];
59705       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" }]]);
59706       ft = class extends re3 {
59707         static canHandle(e3, t2) {
59708           return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
59709         }
59710         parse() {
59711           return this.parseTags(), this.translate(), this.output;
59712         }
59713         parseTags() {
59714           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)]]);
59715         }
59716       };
59717       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"]]);
59718       dt = class extends re3 {
59719         parse() {
59720           return this.parseTags(), this.translate(), this.output;
59721         }
59722         parseTags() {
59723           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)]);
59724         }
59725       };
59726       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" }]]);
59727       pt = class extends re3 {
59728         static canHandle(e3, t2) {
59729           return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
59730         }
59731         static findPosition(e3, t2) {
59732           let i3 = super.findPosition(e3, t2);
59733           return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
59734         }
59735         static handleMultiSegments(e3) {
59736           return function(e4) {
59737             let t2 = function(e6) {
59738               let t3 = e6[0].constructor, i3 = 0;
59739               for (let t4 of e6) i3 += t4.length;
59740               let n3 = new t3(i3), s2 = 0;
59741               for (let t4 of e6) n3.set(t4, s2), s2 += t4.length;
59742               return n3;
59743             }(e4.map((e6) => e6.chunk.toUint8()));
59744             return new I2(t2);
59745           }(e3);
59746         }
59747         parse() {
59748           return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
59749         }
59750         parseHeader() {
59751           let { raw: e3 } = this;
59752           this.chunk.byteLength < 84 && g2("ICC header is too short");
59753           for (let [t2, i3] of Object.entries(gt)) {
59754             t2 = parseInt(t2, 10);
59755             let n3 = i3(this.chunk, t2);
59756             "\0\0\0\0" !== n3 && e3.set(t2, n3);
59757           }
59758         }
59759         parseTags() {
59760           let e3, t2, i3, n3, s2, { raw: r2 } = this, a4 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
59761           for (; a4--; ) {
59762             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.");
59763             s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
59764           }
59765         }
59766         parseTag(e3, t2, i3) {
59767           switch (e3) {
59768             case "desc":
59769               return this.parseDesc(t2);
59770             case "mluc":
59771               return this.parseMluc(t2);
59772             case "text":
59773               return this.parseText(t2, i3);
59774             case "sig ":
59775               return this.parseSig(t2);
59776           }
59777           if (!(t2 + i3 > this.chunk.byteLength)) return this.chunk.getUint8Array(t2, i3);
59778         }
59779         parseDesc(e3) {
59780           let t2 = this.chunk.getUint32(e3 + 8) - 1;
59781           return m2(this.chunk.getString(e3 + 12, t2));
59782         }
59783         parseText(e3, t2) {
59784           return m2(this.chunk.getString(e3 + 8, t2 - 8));
59785         }
59786         parseSig(e3) {
59787           return m2(this.chunk.getString(e3 + 8, 4));
59788         }
59789         parseMluc(e3) {
59790           let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
59791           for (let a4 = 0; a4 < i3; a4++) {
59792             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));
59793             r2.push({ lang: i4, country: a5, text: h3 }), s2 += n3;
59794           }
59795           return 1 === i3 ? r2[0].text : r2;
59796         }
59797         translateValue(e3, t2) {
59798           return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
59799         }
59800       };
59801       c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
59802       gt = { 4: mt, 8: function(e3, t2) {
59803         return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
59804       }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
59805         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);
59806         return new Date(Date.UTC(i3, n3, s2, r2, a4, o2));
59807       }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
59808       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"]]);
59809       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" };
59810       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!)" };
59811       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" }]]);
59812       yt = class extends re3 {
59813         static canHandle(e3, t2, i3) {
59814           return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
59815         }
59816         static headerLength(e3, t2, i3) {
59817           let n3, s2 = this.containsIptc8bim(e3, t2, i3);
59818           if (void 0 !== s2) return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
59819         }
59820         static containsIptc8bim(e3, t2, i3) {
59821           for (let n3 = 0; n3 < i3; n3++) if (this.isIptcSegmentHead(e3, t2 + n3)) return n3;
59822         }
59823         static isIptcSegmentHead(e3, t2) {
59824           return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
59825         }
59826         parse() {
59827           let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
59828           for (let n3 = 0; n3 < t2; n3++) if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
59829             i3 = true;
59830             let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
59831             e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
59832           } else if (i3) break;
59833           return this.translate(), this.output;
59834         }
59835         pluralizeValue(e3, t2) {
59836           return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
59837         }
59838       };
59839       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" }]]);
59840       full_esm_default = tt;
59841     }
59842   });
59843
59844   // modules/svg/local_photos.js
59845   var local_photos_exports = {};
59846   __export(local_photos_exports, {
59847     svgLocalPhotos: () => svgLocalPhotos
59848   });
59849   function svgLocalPhotos(projection2, context, dispatch14) {
59850     const detected = utilDetect();
59851     let layer = select_default2(null);
59852     let _fileList;
59853     let _photos = [];
59854     let _idAutoinc = 0;
59855     let _photoFrame;
59856     let _activePhotoIdx;
59857     function init2() {
59858       if (_initialized2) return;
59859       _enabled2 = true;
59860       function over(d3_event) {
59861         d3_event.stopPropagation();
59862         d3_event.preventDefault();
59863         d3_event.dataTransfer.dropEffect = "copy";
59864       }
59865       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
59866         d3_event.stopPropagation();
59867         d3_event.preventDefault();
59868         if (!detected.filedrop) return;
59869         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
59870           if (loaded.length > 0) {
59871             drawPhotos.fitZoom(false);
59872           }
59873         });
59874       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
59875       _initialized2 = true;
59876     }
59877     function ensureViewerLoaded(context2) {
59878       if (_photoFrame) {
59879         return Promise.resolve(_photoFrame);
59880       }
59881       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
59882       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
59883       viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
59884       const controlsEnter = viewerEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-local");
59885       controlsEnter.append("button").classed("back", true).on("click.back", () => stepPhotos(-1)).text("\u25C0");
59886       controlsEnter.append("button").classed("forward", true).on("click.forward", () => stepPhotos(1)).text("\u25B6");
59887       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
59888         _photoFrame = planePhotoFrame;
59889       });
59890     }
59891     function stepPhotos(stepBy) {
59892       if (!_photos || _photos.length === 0) return;
59893       if (_activePhotoIdx === void 0) _activePhotoIdx = 0;
59894       const newIndex = _activePhotoIdx + stepBy;
59895       _activePhotoIdx = Math.max(0, Math.min(_photos.length - 1, newIndex));
59896       click(null, _photos[_activePhotoIdx], false);
59897     }
59898     function click(d3_event, image, zoomTo) {
59899       _activePhotoIdx = _photos.indexOf(image);
59900       ensureViewerLoaded(context).then(() => {
59901         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
59902         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
59903         const controlsWrap = viewer.select(".photo-controls-wrap");
59904         controlsWrap.select(".back").attr("disabled", _activePhotoIdx <= 0 ? true : null);
59905         controlsWrap.select(".forward").attr("disabled", _activePhotoIdx >= _photos.length - 1 ? true : null);
59906         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
59907         if (image.date) {
59908           attribution.append("span").text(image.date.toLocaleString(_mainLocalizer.localeCode()));
59909         }
59910         if (image.name) {
59911           attribution.append("span").classed("filename", true).text(image.name);
59912         }
59913         _photoFrame.selectPhoto({ image_path: "" });
59914         image.getSrc().then((src) => {
59915           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
59916           setStyles();
59917         });
59918       });
59919       if (zoomTo) {
59920         context.map().centerEase(image.loc);
59921       }
59922     }
59923     function transform2(d2) {
59924       var svgpoint = projection2(d2.loc);
59925       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
59926     }
59927     function setStyles(hovered) {
59928       const viewer = context.container().select(".photoviewer");
59929       const selected = viewer.empty() ? void 0 : viewer.datum();
59930       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));
59931     }
59932     function display_markers(imageList) {
59933       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
59934       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
59935         return d2.id;
59936       });
59937       groups.exit().remove();
59938       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
59939       groupsEnter.append("g").attr("class", "viewfield-scale");
59940       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
59941       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
59942       const showViewfields = context.map().zoom() >= minViewfieldZoom;
59943       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
59944       viewfields.exit().remove();
59945       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
59946         var _a4;
59947         const d2 = this.parentNode.__data__;
59948         return `rotate(${Math.round((_a4 = d2.direction) != null ? _a4 : 0)},0,0),scale(1.5,1.5),translate(-8,-13)`;
59949       }).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() {
59950         const d2 = this.parentNode.__data__;
59951         return isNumber_default(d2.direction) ? "visible" : "hidden";
59952       });
59953     }
59954     function drawPhotos(selection2) {
59955       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
59956       layer.exit().remove();
59957       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
59958       layerEnter.append("g").attr("class", "markers");
59959       layer = layerEnter.merge(layer);
59960       if (_photos) {
59961         display_markers(_photos);
59962       }
59963     }
59964     function readFileAsDataURL(file) {
59965       return new Promise((resolve, reject) => {
59966         const reader = new FileReader();
59967         reader.onload = () => resolve(reader.result);
59968         reader.onerror = (error) => reject(error);
59969         reader.readAsDataURL(file);
59970       });
59971     }
59972     async function readmultifiles(files, callback) {
59973       const loaded = [];
59974       for (const file of files) {
59975         try {
59976           const exifData = await full_esm_default.parse(file);
59977           const photo = {
59978             service: "photo",
59979             id: _idAutoinc++,
59980             name: file.name,
59981             getSrc: () => readFileAsDataURL(file),
59982             file,
59983             loc: [exifData.longitude, exifData.latitude],
59984             direction: exifData.GPSImgDirection,
59985             date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
59986           };
59987           loaded.push(photo);
59988           const sameName = _photos.filter((i3) => i3.name === photo.name);
59989           if (sameName.length === 0) {
59990             _photos.push(photo);
59991           } else {
59992             const thisContent = await photo.getSrc();
59993             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
59994             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
59995               _photos.push(photo);
59996             }
59997           }
59998         } catch {
59999         }
60000       }
60001       if (typeof callback === "function") callback(loaded);
60002       dispatch14.call("change");
60003     }
60004     drawPhotos.setFiles = function(fileList, callback) {
60005       readmultifiles(Array.from(fileList), callback);
60006       return this;
60007     };
60008     drawPhotos.fileList = function(fileList, callback) {
60009       if (!arguments.length) return _fileList;
60010       _fileList = fileList;
60011       if (!fileList || !fileList.length) return this;
60012       drawPhotos.setFiles(_fileList, callback);
60013       return this;
60014     };
60015     drawPhotos.getPhotos = function() {
60016       return _photos;
60017     };
60018     drawPhotos.removePhoto = function(id2) {
60019       _photos = _photos.filter((i3) => i3.id !== id2);
60020       dispatch14.call("change");
60021       return _photos;
60022     };
60023     drawPhotos.openPhoto = click;
60024     drawPhotos.fitZoom = function(force) {
60025       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
60026       if (coords.length === 0) return;
60027       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a4, b3) => a4.extend(b3));
60028       const map2 = context.map();
60029       var viewport = map2.trimmedExtent().polygon();
60030       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
60031         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
60032       }
60033     };
60034     function showLayer() {
60035       layer.style("display", "block");
60036       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60037         dispatch14.call("change");
60038       });
60039     }
60040     function hideLayer() {
60041       layer.transition().duration(250).style("opacity", 0).on("end", () => {
60042         layer.selectAll(".viewfield-group").remove();
60043         layer.style("display", "none");
60044       });
60045     }
60046     drawPhotos.enabled = function(val) {
60047       if (!arguments.length) return _enabled2;
60048       _enabled2 = val;
60049       if (_enabled2) {
60050         showLayer();
60051       } else {
60052         hideLayer();
60053       }
60054       dispatch14.call("change");
60055       return this;
60056     };
60057     drawPhotos.hasData = function() {
60058       return isArray_default(_photos) && _photos.length > 0;
60059     };
60060     init2();
60061     return drawPhotos;
60062   }
60063   var _initialized2, _enabled2, minViewfieldZoom;
60064   var init_local_photos = __esm({
60065     "modules/svg/local_photos.js"() {
60066       "use strict";
60067       init_src5();
60068       init_full_esm();
60069       init_lodash();
60070       init_localizer();
60071       init_detect();
60072       init_geo2();
60073       init_plane_photo();
60074       _initialized2 = false;
60075       _enabled2 = false;
60076       minViewfieldZoom = 16;
60077     }
60078   });
60079
60080   // modules/svg/osmose.js
60081   var osmose_exports2 = {};
60082   __export(osmose_exports2, {
60083     svgOsmose: () => svgOsmose
60084   });
60085   function svgOsmose(projection2, context, dispatch14) {
60086     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
60087     const minZoom5 = 12;
60088     let touchLayer = select_default2(null);
60089     let drawLayer = select_default2(null);
60090     let layerVisible = false;
60091     function markerPath(selection2, klass) {
60092       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");
60093     }
60094     function getService() {
60095       if (services.osmose && !_qaService2) {
60096         _qaService2 = services.osmose;
60097         _qaService2.on("loaded", throttledRedraw);
60098       } else if (!services.osmose && _qaService2) {
60099         _qaService2 = null;
60100       }
60101       return _qaService2;
60102     }
60103     function editOn() {
60104       if (!layerVisible) {
60105         layerVisible = true;
60106         drawLayer.style("display", "block");
60107       }
60108     }
60109     function editOff() {
60110       if (layerVisible) {
60111         layerVisible = false;
60112         drawLayer.style("display", "none");
60113         drawLayer.selectAll(".qaItem.osmose").remove();
60114         touchLayer.selectAll(".qaItem.osmose").remove();
60115       }
60116     }
60117     function layerOn() {
60118       editOn();
60119       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
60120     }
60121     function layerOff() {
60122       throttledRedraw.cancel();
60123       drawLayer.interrupt();
60124       touchLayer.selectAll(".qaItem.osmose").remove();
60125       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
60126         editOff();
60127         dispatch14.call("change");
60128       });
60129     }
60130     function updateMarkers() {
60131       if (!layerVisible || !_layerEnabled2) return;
60132       const service = getService();
60133       const selectedID = context.selectedErrorID();
60134       const data = service ? service.getItems(projection2) : [];
60135       const getTransform = svgPointTransform(projection2);
60136       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
60137       markers.exit().remove();
60138       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
60139       markersEnter.append("polygon").call(markerPath, "shadow");
60140       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
60141       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
60142       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 : "");
60143       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
60144       if (touchLayer.empty()) return;
60145       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
60146       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
60147       targets.exit().remove();
60148       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);
60149       function sortY(a4, b3) {
60150         return a4.id === selectedID ? 1 : b3.id === selectedID ? -1 : b3.loc[1] - a4.loc[1];
60151       }
60152     }
60153     function drawOsmose(selection2) {
60154       const service = getService();
60155       const surface = context.surface();
60156       if (surface && !surface.empty()) {
60157         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
60158       }
60159       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
60160       drawLayer.exit().remove();
60161       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
60162       if (_layerEnabled2) {
60163         if (service && ~~context.map().zoom() >= minZoom5) {
60164           editOn();
60165           service.loadIssues(projection2);
60166           updateMarkers();
60167         } else {
60168           editOff();
60169         }
60170       }
60171     }
60172     drawOsmose.enabled = function(val) {
60173       if (!arguments.length) return _layerEnabled2;
60174       _layerEnabled2 = val;
60175       if (_layerEnabled2) {
60176         getService().loadStrings().then(layerOn).catch((err) => {
60177           console.log(err);
60178         });
60179       } else {
60180         layerOff();
60181         if (context.selectedErrorID()) {
60182           context.enter(modeBrowse(context));
60183         }
60184       }
60185       dispatch14.call("change");
60186       return this;
60187     };
60188     drawOsmose.supported = () => !!getService();
60189     return drawOsmose;
60190   }
60191   var _layerEnabled2, _qaService2;
60192   var init_osmose2 = __esm({
60193     "modules/svg/osmose.js"() {
60194       "use strict";
60195       init_throttle();
60196       init_src5();
60197       init_browse();
60198       init_helpers();
60199       init_services();
60200       _layerEnabled2 = false;
60201     }
60202   });
60203
60204   // modules/svg/streetside.js
60205   var streetside_exports2 = {};
60206   __export(streetside_exports2, {
60207     svgStreetside: () => svgStreetside
60208   });
60209   function svgStreetside(projection2, context, dispatch14) {
60210     var throttledRedraw = throttle_default(function() {
60211       dispatch14.call("change");
60212     }, 1e3);
60213     var minZoom5 = 14;
60214     var minMarkerZoom = 16;
60215     var minViewfieldZoom2 = 18;
60216     var layer = select_default2(null);
60217     var _viewerYaw = 0;
60218     var _selectedSequence = null;
60219     var _streetside;
60220     function init2() {
60221       if (svgStreetside.initialized) return;
60222       svgStreetside.enabled = false;
60223       svgStreetside.initialized = true;
60224     }
60225     function getService() {
60226       if (services.streetside && !_streetside) {
60227         _streetside = services.streetside;
60228         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
60229       } else if (!services.streetside && _streetside) {
60230         _streetside = null;
60231       }
60232       return _streetside;
60233     }
60234     function showLayer() {
60235       var service = getService();
60236       if (!service) return;
60237       editOn();
60238       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60239         dispatch14.call("change");
60240       });
60241     }
60242     function hideLayer() {
60243       throttledRedraw.cancel();
60244       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60245     }
60246     function editOn() {
60247       layer.style("display", "block");
60248     }
60249     function editOff() {
60250       layer.selectAll(".viewfield-group").remove();
60251       layer.style("display", "none");
60252     }
60253     function click(d3_event, d2) {
60254       var service = getService();
60255       if (!service) return;
60256       if (d2.sequenceKey !== _selectedSequence) {
60257         _viewerYaw = 0;
60258       }
60259       _selectedSequence = d2.sequenceKey;
60260       service.ensureViewerLoaded(context).then(function() {
60261         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
60262       });
60263       context.map().centerEase(d2.loc);
60264     }
60265     function mouseover(d3_event, d2) {
60266       var service = getService();
60267       if (service) service.setStyles(context, d2);
60268     }
60269     function mouseout() {
60270       var service = getService();
60271       if (service) service.setStyles(context, null);
60272     }
60273     function transform2(d2) {
60274       var t2 = svgPointTransform(projection2)(d2);
60275       var rot = d2.ca + _viewerYaw;
60276       if (rot) {
60277         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
60278       }
60279       return t2;
60280     }
60281     function viewerChanged() {
60282       var service = getService();
60283       if (!service) return;
60284       var viewer = service.viewer();
60285       if (!viewer) return;
60286       _viewerYaw = viewer.getYaw();
60287       if (context.map().isTransformed()) return;
60288       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
60289     }
60290     function filterBubbles(bubbles) {
60291       var fromDate = context.photos().fromDate();
60292       var toDate = context.photos().toDate();
60293       var usernames = context.photos().usernames();
60294       if (fromDate) {
60295         var fromTimestamp = new Date(fromDate).getTime();
60296         bubbles = bubbles.filter(function(bubble) {
60297           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
60298         });
60299       }
60300       if (toDate) {
60301         var toTimestamp = new Date(toDate).getTime();
60302         bubbles = bubbles.filter(function(bubble) {
60303           return new Date(bubble.captured_at).getTime() <= toTimestamp;
60304         });
60305       }
60306       if (usernames) {
60307         bubbles = bubbles.filter(function(bubble) {
60308           return usernames.indexOf(bubble.captured_by) !== -1;
60309         });
60310       }
60311       return bubbles;
60312     }
60313     function filterSequences(sequences) {
60314       var fromDate = context.photos().fromDate();
60315       var toDate = context.photos().toDate();
60316       var usernames = context.photos().usernames();
60317       if (fromDate) {
60318         var fromTimestamp = new Date(fromDate).getTime();
60319         sequences = sequences.filter(function(sequences2) {
60320           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
60321         });
60322       }
60323       if (toDate) {
60324         var toTimestamp = new Date(toDate).getTime();
60325         sequences = sequences.filter(function(sequences2) {
60326           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
60327         });
60328       }
60329       if (usernames) {
60330         sequences = sequences.filter(function(sequences2) {
60331           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
60332         });
60333       }
60334       return sequences;
60335     }
60336     function update() {
60337       var viewer = context.container().select(".photoviewer");
60338       var selected = viewer.empty() ? void 0 : viewer.datum();
60339       var z3 = ~~context.map().zoom();
60340       var showMarkers = z3 >= minMarkerZoom;
60341       var showViewfields = z3 >= minViewfieldZoom2;
60342       var service = getService();
60343       var sequences = [];
60344       var bubbles = [];
60345       if (context.photos().showsPanoramic()) {
60346         sequences = service ? service.sequences(projection2) : [];
60347         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
60348         sequences = filterSequences(sequences);
60349         bubbles = filterBubbles(bubbles);
60350       }
60351       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
60352         return d2.properties.key;
60353       });
60354       dispatch14.call("photoDatesChanged", this, "streetside", [...bubbles.map((p2) => p2.captured_at), ...sequences.map((t2) => t2.properties.vintageStart)]);
60355       traces.exit().remove();
60356       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60357       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
60358         return d2.key + (d2.sequenceKey ? "v1" : "v0");
60359       });
60360       groups.exit().remove();
60361       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60362       groupsEnter.append("g").attr("class", "viewfield-scale");
60363       var markers = groups.merge(groupsEnter).sort(function(a4, b3) {
60364         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
60365       }).attr("transform", transform2).select(".viewfield-scale");
60366       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60367       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60368       viewfields.exit().remove();
60369       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60370       function viewfieldPath() {
60371         var d2 = this.parentNode.__data__;
60372         if (d2.pano) {
60373           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60374         } else {
60375           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60376         }
60377       }
60378     }
60379     function drawImages(selection2) {
60380       var enabled = svgStreetside.enabled;
60381       var service = getService();
60382       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
60383       layer.exit().remove();
60384       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
60385       layerEnter.append("g").attr("class", "sequences");
60386       layerEnter.append("g").attr("class", "markers");
60387       layer = layerEnter.merge(layer);
60388       if (enabled) {
60389         if (service && ~~context.map().zoom() >= minZoom5) {
60390           editOn();
60391           update();
60392           service.loadBubbles(projection2);
60393         } else {
60394           dispatch14.call("photoDatesChanged", this, "streetside", []);
60395           editOff();
60396         }
60397       } else {
60398         dispatch14.call("photoDatesChanged", this, "streetside", []);
60399       }
60400     }
60401     drawImages.enabled = function(_3) {
60402       if (!arguments.length) return svgStreetside.enabled;
60403       svgStreetside.enabled = _3;
60404       if (svgStreetside.enabled) {
60405         showLayer();
60406         context.photos().on("change.streetside", update);
60407       } else {
60408         hideLayer();
60409         context.photos().on("change.streetside", null);
60410       }
60411       dispatch14.call("change");
60412       return this;
60413     };
60414     drawImages.supported = function() {
60415       return !!getService();
60416     };
60417     drawImages.rendered = function(zoom) {
60418       return zoom >= minZoom5;
60419     };
60420     init2();
60421     return drawImages;
60422   }
60423   var init_streetside2 = __esm({
60424     "modules/svg/streetside.js"() {
60425       "use strict";
60426       init_throttle();
60427       init_src5();
60428       init_helpers();
60429       init_services();
60430     }
60431   });
60432
60433   // modules/svg/vegbilder.js
60434   var vegbilder_exports2 = {};
60435   __export(vegbilder_exports2, {
60436     svgVegbilder: () => svgVegbilder
60437   });
60438   function svgVegbilder(projection2, context, dispatch14) {
60439     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
60440     const minZoom5 = 14;
60441     const minMarkerZoom = 16;
60442     const minViewfieldZoom2 = 18;
60443     let layer = select_default2(null);
60444     let _viewerYaw = 0;
60445     let _vegbilder;
60446     function init2() {
60447       if (svgVegbilder.initialized) return;
60448       svgVegbilder.enabled = false;
60449       svgVegbilder.initialized = true;
60450     }
60451     function getService() {
60452       if (services.vegbilder && !_vegbilder) {
60453         _vegbilder = services.vegbilder;
60454         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
60455       } else if (!services.vegbilder && _vegbilder) {
60456         _vegbilder = null;
60457       }
60458       return _vegbilder;
60459     }
60460     function showLayer() {
60461       const service = getService();
60462       if (!service) return;
60463       editOn();
60464       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
60465     }
60466     function hideLayer() {
60467       throttledRedraw.cancel();
60468       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60469     }
60470     function editOn() {
60471       layer.style("display", "block");
60472     }
60473     function editOff() {
60474       layer.selectAll(".viewfield-group").remove();
60475       layer.style("display", "none");
60476     }
60477     function click(d3_event, d2) {
60478       const service = getService();
60479       if (!service) return;
60480       service.ensureViewerLoaded(context).then(() => {
60481         service.selectImage(context, d2.key).showViewer(context);
60482       });
60483       context.map().centerEase(d2.loc);
60484     }
60485     function mouseover(d3_event, d2) {
60486       const service = getService();
60487       if (service) service.setStyles(context, d2);
60488     }
60489     function mouseout() {
60490       const service = getService();
60491       if (service) service.setStyles(context, null);
60492     }
60493     function transform2(d2, selected) {
60494       let t2 = svgPointTransform(projection2)(d2);
60495       let rot = d2.ca;
60496       if (d2 === selected) {
60497         rot += _viewerYaw;
60498       }
60499       if (rot) {
60500         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
60501       }
60502       return t2;
60503     }
60504     function viewerChanged() {
60505       const service = getService();
60506       if (!service) return;
60507       const frame2 = service.photoFrame();
60508       if (!frame2) return;
60509       _viewerYaw = frame2.getYaw();
60510       if (context.map().isTransformed()) return;
60511       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
60512     }
60513     function filterImages(images) {
60514       const photoContext = context.photos();
60515       const fromDateString = photoContext.fromDate();
60516       const toDateString = photoContext.toDate();
60517       const showsFlat = photoContext.showsFlat();
60518       const showsPano = photoContext.showsPanoramic();
60519       if (fromDateString) {
60520         const fromDate = new Date(fromDateString);
60521         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
60522       }
60523       if (toDateString) {
60524         const toDate = new Date(toDateString);
60525         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
60526       }
60527       if (!showsPano) {
60528         images = images.filter((image) => !image.is_sphere);
60529       }
60530       if (!showsFlat) {
60531         images = images.filter((image) => image.is_sphere);
60532       }
60533       return images;
60534     }
60535     function filterSequences(sequences) {
60536       const photoContext = context.photos();
60537       const fromDateString = photoContext.fromDate();
60538       const toDateString = photoContext.toDate();
60539       const showsFlat = photoContext.showsFlat();
60540       const showsPano = photoContext.showsPanoramic();
60541       if (fromDateString) {
60542         const fromDate = new Date(fromDateString);
60543         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
60544       }
60545       if (toDateString) {
60546         const toDate = new Date(toDateString);
60547         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
60548       }
60549       if (!showsPano) {
60550         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
60551       }
60552       if (!showsFlat) {
60553         sequences = sequences.filter(({ images }) => images[0].is_sphere);
60554       }
60555       return sequences;
60556     }
60557     function update() {
60558       const viewer = context.container().select(".photoviewer");
60559       const selected = viewer.empty() ? void 0 : viewer.datum();
60560       const z3 = ~~context.map().zoom();
60561       const showMarkers = z3 >= minMarkerZoom;
60562       const showViewfields = z3 >= minViewfieldZoom2;
60563       const service = getService();
60564       let sequences = [];
60565       let images = [];
60566       if (service) {
60567         service.loadImages(context);
60568         sequences = service.sequences(projection2);
60569         images = showMarkers ? service.images(projection2) : [];
60570         dispatch14.call("photoDatesChanged", this, "vegbilder", images.map((p2) => p2.captured_at));
60571         images = filterImages(images);
60572         sequences = filterSequences(sequences);
60573       }
60574       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
60575       traces.exit().remove();
60576       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60577       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
60578       groups.exit().remove();
60579       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60580       groupsEnter.append("g").attr("class", "viewfield-scale");
60581       const markers = groups.merge(groupsEnter).sort((a4, b3) => {
60582         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
60583       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
60584       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60585       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60586       viewfields.exit().remove();
60587       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60588       function viewfieldPath() {
60589         const d2 = this.parentNode.__data__;
60590         if (d2.is_sphere) {
60591           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60592         } else {
60593           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60594         }
60595       }
60596     }
60597     function drawImages(selection2) {
60598       const enabled = svgVegbilder.enabled;
60599       const service = getService();
60600       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
60601       layer.exit().remove();
60602       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
60603       layerEnter.append("g").attr("class", "sequences");
60604       layerEnter.append("g").attr("class", "markers");
60605       layer = layerEnter.merge(layer);
60606       if (enabled) {
60607         if (service && ~~context.map().zoom() >= minZoom5) {
60608           editOn();
60609           update();
60610           service.loadImages(context);
60611         } else {
60612           editOff();
60613         }
60614       }
60615     }
60616     drawImages.enabled = function(_3) {
60617       if (!arguments.length) return svgVegbilder.enabled;
60618       svgVegbilder.enabled = _3;
60619       if (svgVegbilder.enabled) {
60620         showLayer();
60621         context.photos().on("change.vegbilder", update);
60622       } else {
60623         hideLayer();
60624         context.photos().on("change.vegbilder", null);
60625       }
60626       dispatch14.call("change");
60627       return this;
60628     };
60629     drawImages.supported = function() {
60630       return !!getService();
60631     };
60632     drawImages.rendered = function(zoom) {
60633       return zoom >= minZoom5;
60634     };
60635     drawImages.validHere = function(extent, zoom) {
60636       return zoom >= minZoom5 - 2 && getService().validHere(extent);
60637     };
60638     init2();
60639     return drawImages;
60640   }
60641   var init_vegbilder2 = __esm({
60642     "modules/svg/vegbilder.js"() {
60643       "use strict";
60644       init_throttle();
60645       init_src5();
60646       init_helpers();
60647       init_services();
60648     }
60649   });
60650
60651   // modules/svg/mapillary_images.js
60652   var mapillary_images_exports = {};
60653   __export(mapillary_images_exports, {
60654     svgMapillaryImages: () => svgMapillaryImages
60655   });
60656   function svgMapillaryImages(projection2, context, dispatch14) {
60657     const throttledRedraw = throttle_default(function() {
60658       dispatch14.call("change");
60659     }, 1e3);
60660     const minZoom5 = 12;
60661     const minMarkerZoom = 16;
60662     const minViewfieldZoom2 = 18;
60663     let layer = select_default2(null);
60664     let _mapillary;
60665     function init2() {
60666       if (svgMapillaryImages.initialized) return;
60667       svgMapillaryImages.enabled = false;
60668       svgMapillaryImages.initialized = true;
60669     }
60670     function getService() {
60671       if (services.mapillary && !_mapillary) {
60672         _mapillary = services.mapillary;
60673         _mapillary.event.on("loadedImages", throttledRedraw);
60674       } else if (!services.mapillary && _mapillary) {
60675         _mapillary = null;
60676       }
60677       return _mapillary;
60678     }
60679     function showLayer() {
60680       const service = getService();
60681       if (!service) return;
60682       editOn();
60683       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60684         dispatch14.call("change");
60685       });
60686     }
60687     function hideLayer() {
60688       throttledRedraw.cancel();
60689       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60690     }
60691     function editOn() {
60692       layer.style("display", "block");
60693     }
60694     function editOff() {
60695       layer.selectAll(".viewfield-group").remove();
60696       layer.style("display", "none");
60697     }
60698     function click(d3_event, image) {
60699       const service = getService();
60700       if (!service) return;
60701       service.ensureViewerLoaded(context).then(function() {
60702         service.selectImage(context, image.id).showViewer(context);
60703       });
60704       context.map().centerEase(image.loc);
60705     }
60706     function mouseover(d3_event, image) {
60707       const service = getService();
60708       if (service) service.setStyles(context, image);
60709     }
60710     function mouseout() {
60711       const service = getService();
60712       if (service) service.setStyles(context, null);
60713     }
60714     function transform2(d2) {
60715       let t2 = svgPointTransform(projection2)(d2);
60716       if (d2.ca) {
60717         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
60718       }
60719       return t2;
60720     }
60721     function filterImages(images) {
60722       const showsPano = context.photos().showsPanoramic();
60723       const showsFlat = context.photos().showsFlat();
60724       const fromDate = context.photos().fromDate();
60725       const toDate = context.photos().toDate();
60726       if (!showsPano || !showsFlat) {
60727         images = images.filter(function(image) {
60728           if (image.is_pano) return showsPano;
60729           return showsFlat;
60730         });
60731       }
60732       if (fromDate) {
60733         images = images.filter(function(image) {
60734           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
60735         });
60736       }
60737       if (toDate) {
60738         images = images.filter(function(image) {
60739           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
60740         });
60741       }
60742       return images;
60743     }
60744     function filterSequences(sequences) {
60745       const showsPano = context.photos().showsPanoramic();
60746       const showsFlat = context.photos().showsFlat();
60747       const fromDate = context.photos().fromDate();
60748       const toDate = context.photos().toDate();
60749       if (!showsPano || !showsFlat) {
60750         sequences = sequences.filter(function(sequence) {
60751           if (sequence.properties.hasOwnProperty("is_pano")) {
60752             if (sequence.properties.is_pano) return showsPano;
60753             return showsFlat;
60754           }
60755           return false;
60756         });
60757       }
60758       if (fromDate) {
60759         sequences = sequences.filter(function(sequence) {
60760           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
60761         });
60762       }
60763       if (toDate) {
60764         sequences = sequences.filter(function(sequence) {
60765           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
60766         });
60767       }
60768       return sequences;
60769     }
60770     function update() {
60771       const z3 = ~~context.map().zoom();
60772       const showMarkers = z3 >= minMarkerZoom;
60773       const showViewfields = z3 >= minViewfieldZoom2;
60774       const service = getService();
60775       let sequences = service ? service.sequences(projection2) : [];
60776       let images = service && showMarkers ? service.images(projection2) : [];
60777       dispatch14.call("photoDatesChanged", this, "mapillary", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
60778       images = filterImages(images);
60779       sequences = filterSequences(sequences, service);
60780       service.filterViewer(context);
60781       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
60782         return d2.properties.id;
60783       });
60784       traces.exit().remove();
60785       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60786       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
60787         return d2.id;
60788       });
60789       groups.exit().remove();
60790       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60791       groupsEnter.append("g").attr("class", "viewfield-scale");
60792       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
60793         return b3.loc[1] - a4.loc[1];
60794       }).attr("transform", transform2).select(".viewfield-scale");
60795       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60796       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60797       viewfields.exit().remove();
60798       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
60799         return this.parentNode.__data__.is_pano;
60800       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60801       function viewfieldPath() {
60802         if (this.parentNode.__data__.is_pano) {
60803           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60804         } else {
60805           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60806         }
60807       }
60808     }
60809     function drawImages(selection2) {
60810       const enabled = svgMapillaryImages.enabled;
60811       const service = getService();
60812       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
60813       layer.exit().remove();
60814       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
60815       layerEnter.append("g").attr("class", "sequences");
60816       layerEnter.append("g").attr("class", "markers");
60817       layer = layerEnter.merge(layer);
60818       if (enabled) {
60819         if (service && ~~context.map().zoom() >= minZoom5) {
60820           editOn();
60821           update();
60822           service.loadImages(projection2);
60823         } else {
60824           dispatch14.call("photoDatesChanged", this, "mapillary", []);
60825           editOff();
60826         }
60827       } else {
60828         dispatch14.call("photoDatesChanged", this, "mapillary", []);
60829       }
60830     }
60831     drawImages.enabled = function(_3) {
60832       if (!arguments.length) return svgMapillaryImages.enabled;
60833       svgMapillaryImages.enabled = _3;
60834       if (svgMapillaryImages.enabled) {
60835         showLayer();
60836         context.photos().on("change.mapillary_images", update);
60837       } else {
60838         hideLayer();
60839         context.photos().on("change.mapillary_images", null);
60840       }
60841       dispatch14.call("change");
60842       return this;
60843     };
60844     drawImages.supported = function() {
60845       return !!getService();
60846     };
60847     drawImages.rendered = function(zoom) {
60848       return zoom >= minZoom5;
60849     };
60850     init2();
60851     return drawImages;
60852   }
60853   var init_mapillary_images = __esm({
60854     "modules/svg/mapillary_images.js"() {
60855       "use strict";
60856       init_throttle();
60857       init_src5();
60858       init_helpers();
60859       init_services();
60860     }
60861   });
60862
60863   // modules/svg/mapillary_position.js
60864   var mapillary_position_exports = {};
60865   __export(mapillary_position_exports, {
60866     svgMapillaryPosition: () => svgMapillaryPosition
60867   });
60868   function svgMapillaryPosition(projection2, context) {
60869     const throttledRedraw = throttle_default(function() {
60870       update();
60871     }, 1e3);
60872     const minZoom5 = 12;
60873     const minViewfieldZoom2 = 18;
60874     let layer = select_default2(null);
60875     let _mapillary;
60876     let viewerCompassAngle;
60877     function init2() {
60878       if (svgMapillaryPosition.initialized) return;
60879       svgMapillaryPosition.initialized = true;
60880     }
60881     function getService() {
60882       if (services.mapillary && !_mapillary) {
60883         _mapillary = services.mapillary;
60884         _mapillary.event.on("imageChanged", throttledRedraw);
60885         _mapillary.event.on("bearingChanged", function(e3) {
60886           viewerCompassAngle = e3.bearing;
60887           if (context.map().isTransformed()) return;
60888           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
60889             return d2.is_pano;
60890           }).attr("transform", transform2);
60891         });
60892       } else if (!services.mapillary && _mapillary) {
60893         _mapillary = null;
60894       }
60895       return _mapillary;
60896     }
60897     function editOn() {
60898       layer.style("display", "block");
60899     }
60900     function editOff() {
60901       layer.selectAll(".viewfield-group").remove();
60902       layer.style("display", "none");
60903     }
60904     function transform2(d2) {
60905       let t2 = svgPointTransform(projection2)(d2);
60906       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
60907         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
60908       } else if (d2.ca) {
60909         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
60910       }
60911       return t2;
60912     }
60913     function update() {
60914       const z3 = ~~context.map().zoom();
60915       const showViewfields = z3 >= minViewfieldZoom2;
60916       const service = getService();
60917       const image = service && service.getActiveImage();
60918       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
60919         return d2.id;
60920       });
60921       groups.exit().remove();
60922       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
60923       groupsEnter.append("g").attr("class", "viewfield-scale");
60924       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
60925       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60926       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60927       viewfields.exit().remove();
60928       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");
60929     }
60930     function drawImages(selection2) {
60931       const service = getService();
60932       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
60933       layer.exit().remove();
60934       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
60935       layerEnter.append("g").attr("class", "markers");
60936       layer = layerEnter.merge(layer);
60937       if (service && ~~context.map().zoom() >= minZoom5) {
60938         editOn();
60939         update();
60940       } else {
60941         editOff();
60942       }
60943     }
60944     drawImages.enabled = function() {
60945       update();
60946       return this;
60947     };
60948     drawImages.supported = function() {
60949       return !!getService();
60950     };
60951     drawImages.rendered = function(zoom) {
60952       return zoom >= minZoom5;
60953     };
60954     init2();
60955     return drawImages;
60956   }
60957   var init_mapillary_position = __esm({
60958     "modules/svg/mapillary_position.js"() {
60959       "use strict";
60960       init_throttle();
60961       init_src5();
60962       init_helpers();
60963       init_services();
60964     }
60965   });
60966
60967   // modules/svg/mapillary_signs.js
60968   var mapillary_signs_exports = {};
60969   __export(mapillary_signs_exports, {
60970     svgMapillarySigns: () => svgMapillarySigns
60971   });
60972   function svgMapillarySigns(projection2, context, dispatch14) {
60973     const throttledRedraw = throttle_default(function() {
60974       dispatch14.call("change");
60975     }, 1e3);
60976     const minZoom5 = 12;
60977     let layer = select_default2(null);
60978     let _mapillary;
60979     function init2() {
60980       if (svgMapillarySigns.initialized) return;
60981       svgMapillarySigns.enabled = false;
60982       svgMapillarySigns.initialized = true;
60983     }
60984     function getService() {
60985       if (services.mapillary && !_mapillary) {
60986         _mapillary = services.mapillary;
60987         _mapillary.event.on("loadedSigns", throttledRedraw);
60988       } else if (!services.mapillary && _mapillary) {
60989         _mapillary = null;
60990       }
60991       return _mapillary;
60992     }
60993     function showLayer() {
60994       const service = getService();
60995       if (!service) return;
60996       service.loadSignResources(context);
60997       editOn();
60998     }
60999     function hideLayer() {
61000       throttledRedraw.cancel();
61001       editOff();
61002     }
61003     function editOn() {
61004       layer.style("display", "block");
61005     }
61006     function editOff() {
61007       layer.selectAll(".icon-sign").remove();
61008       layer.style("display", "none");
61009     }
61010     function click(d3_event, d2) {
61011       const service = getService();
61012       if (!service) return;
61013       context.map().centerEase(d2.loc);
61014       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
61015       service.getDetections(d2.id).then((detections) => {
61016         if (detections.length) {
61017           const imageId = detections[0].image.id;
61018           if (imageId === selectedImageId) {
61019             service.highlightDetection(detections[0]).selectImage(context, imageId);
61020           } else {
61021             service.ensureViewerLoaded(context).then(function() {
61022               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
61023             });
61024           }
61025         }
61026       });
61027     }
61028     function filterData(detectedFeatures) {
61029       var fromDate = context.photos().fromDate();
61030       var toDate = context.photos().toDate();
61031       if (fromDate) {
61032         var fromTimestamp = new Date(fromDate).getTime();
61033         detectedFeatures = detectedFeatures.filter(function(feature3) {
61034           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
61035         });
61036       }
61037       if (toDate) {
61038         var toTimestamp = new Date(toDate).getTime();
61039         detectedFeatures = detectedFeatures.filter(function(feature3) {
61040           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
61041         });
61042       }
61043       return detectedFeatures;
61044     }
61045     function update() {
61046       const service = getService();
61047       let data = service ? service.signs(projection2) : [];
61048       data = filterData(data);
61049       const transform2 = svgPointTransform(projection2);
61050       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
61051         return d2.id;
61052       });
61053       signs.exit().remove();
61054       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
61055       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
61056         return "#" + d2.value;
61057       });
61058       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
61059       signs.merge(enter).attr("transform", transform2);
61060     }
61061     function drawSigns(selection2) {
61062       const enabled = svgMapillarySigns.enabled;
61063       const service = getService();
61064       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
61065       layer.exit().remove();
61066       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
61067       if (enabled) {
61068         if (service && ~~context.map().zoom() >= minZoom5) {
61069           editOn();
61070           update();
61071           service.loadSigns(projection2);
61072           service.showSignDetections(true);
61073         } else {
61074           editOff();
61075         }
61076       } else if (service) {
61077         service.showSignDetections(false);
61078       }
61079     }
61080     drawSigns.enabled = function(_3) {
61081       if (!arguments.length) return svgMapillarySigns.enabled;
61082       svgMapillarySigns.enabled = _3;
61083       if (svgMapillarySigns.enabled) {
61084         showLayer();
61085         context.photos().on("change.mapillary_signs", update);
61086       } else {
61087         hideLayer();
61088         context.photos().on("change.mapillary_signs", null);
61089       }
61090       dispatch14.call("change");
61091       return this;
61092     };
61093     drawSigns.supported = function() {
61094       return !!getService();
61095     };
61096     drawSigns.rendered = function(zoom) {
61097       return zoom >= minZoom5;
61098     };
61099     init2();
61100     return drawSigns;
61101   }
61102   var init_mapillary_signs = __esm({
61103     "modules/svg/mapillary_signs.js"() {
61104       "use strict";
61105       init_throttle();
61106       init_src5();
61107       init_helpers();
61108       init_services();
61109     }
61110   });
61111
61112   // modules/svg/mapillary_map_features.js
61113   var mapillary_map_features_exports = {};
61114   __export(mapillary_map_features_exports, {
61115     svgMapillaryMapFeatures: () => svgMapillaryMapFeatures
61116   });
61117   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
61118     const throttledRedraw = throttle_default(function() {
61119       dispatch14.call("change");
61120     }, 1e3);
61121     const minZoom5 = 12;
61122     let layer = select_default2(null);
61123     let _mapillary;
61124     function init2() {
61125       if (svgMapillaryMapFeatures.initialized) return;
61126       svgMapillaryMapFeatures.enabled = false;
61127       svgMapillaryMapFeatures.initialized = true;
61128     }
61129     function getService() {
61130       if (services.mapillary && !_mapillary) {
61131         _mapillary = services.mapillary;
61132         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
61133       } else if (!services.mapillary && _mapillary) {
61134         _mapillary = null;
61135       }
61136       return _mapillary;
61137     }
61138     function showLayer() {
61139       const service = getService();
61140       if (!service) return;
61141       service.loadObjectResources(context);
61142       editOn();
61143     }
61144     function hideLayer() {
61145       throttledRedraw.cancel();
61146       editOff();
61147     }
61148     function editOn() {
61149       layer.style("display", "block");
61150     }
61151     function editOff() {
61152       layer.selectAll(".icon-map-feature").remove();
61153       layer.style("display", "none");
61154     }
61155     function click(d3_event, d2) {
61156       const service = getService();
61157       if (!service) return;
61158       context.map().centerEase(d2.loc);
61159       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
61160       service.getDetections(d2.id).then((detections) => {
61161         if (detections.length) {
61162           const imageId = detections[0].image.id;
61163           if (imageId === selectedImageId) {
61164             service.highlightDetection(detections[0]).selectImage(context, imageId);
61165           } else {
61166             service.ensureViewerLoaded(context).then(function() {
61167               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
61168             });
61169           }
61170         }
61171       });
61172     }
61173     function filterData(detectedFeatures) {
61174       const fromDate = context.photos().fromDate();
61175       const toDate = context.photos().toDate();
61176       if (fromDate) {
61177         detectedFeatures = detectedFeatures.filter(function(feature3) {
61178           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
61179         });
61180       }
61181       if (toDate) {
61182         detectedFeatures = detectedFeatures.filter(function(feature3) {
61183           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
61184         });
61185       }
61186       return detectedFeatures;
61187     }
61188     function update() {
61189       const service = getService();
61190       let data = service ? service.mapFeatures(projection2) : [];
61191       data = filterData(data);
61192       const transform2 = svgPointTransform(projection2);
61193       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
61194         return d2.id;
61195       });
61196       mapFeatures.exit().remove();
61197       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
61198       enter.append("title").text(function(d2) {
61199         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
61200         return _t("mapillary_map_features." + id2);
61201       });
61202       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
61203         if (d2.value === "object--billboard") {
61204           return "#object--sign--advertisement";
61205         }
61206         return "#" + d2.value;
61207       });
61208       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
61209       mapFeatures.merge(enter).attr("transform", transform2);
61210     }
61211     function drawMapFeatures(selection2) {
61212       const enabled = svgMapillaryMapFeatures.enabled;
61213       const service = getService();
61214       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
61215       layer.exit().remove();
61216       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
61217       if (enabled) {
61218         if (service && ~~context.map().zoom() >= minZoom5) {
61219           editOn();
61220           update();
61221           service.loadMapFeatures(projection2);
61222           service.showFeatureDetections(true);
61223         } else {
61224           editOff();
61225         }
61226       } else if (service) {
61227         service.showFeatureDetections(false);
61228       }
61229     }
61230     drawMapFeatures.enabled = function(_3) {
61231       if (!arguments.length) return svgMapillaryMapFeatures.enabled;
61232       svgMapillaryMapFeatures.enabled = _3;
61233       if (svgMapillaryMapFeatures.enabled) {
61234         showLayer();
61235         context.photos().on("change.mapillary_map_features", update);
61236       } else {
61237         hideLayer();
61238         context.photos().on("change.mapillary_map_features", null);
61239       }
61240       dispatch14.call("change");
61241       return this;
61242     };
61243     drawMapFeatures.supported = function() {
61244       return !!getService();
61245     };
61246     drawMapFeatures.rendered = function(zoom) {
61247       return zoom >= minZoom5;
61248     };
61249     init2();
61250     return drawMapFeatures;
61251   }
61252   var init_mapillary_map_features = __esm({
61253     "modules/svg/mapillary_map_features.js"() {
61254       "use strict";
61255       init_throttle();
61256       init_src5();
61257       init_helpers();
61258       init_services();
61259       init_localizer();
61260     }
61261   });
61262
61263   // modules/svg/kartaview_images.js
61264   var kartaview_images_exports = {};
61265   __export(kartaview_images_exports, {
61266     svgKartaviewImages: () => svgKartaviewImages
61267   });
61268   function svgKartaviewImages(projection2, context, dispatch14) {
61269     var throttledRedraw = throttle_default(function() {
61270       dispatch14.call("change");
61271     }, 1e3);
61272     var minZoom5 = 12;
61273     var minMarkerZoom = 16;
61274     var minViewfieldZoom2 = 18;
61275     var layer = select_default2(null);
61276     var _kartaview;
61277     function init2() {
61278       if (svgKartaviewImages.initialized) return;
61279       svgKartaviewImages.enabled = false;
61280       svgKartaviewImages.initialized = true;
61281     }
61282     function getService() {
61283       if (services.kartaview && !_kartaview) {
61284         _kartaview = services.kartaview;
61285         _kartaview.event.on("loadedImages", throttledRedraw);
61286       } else if (!services.kartaview && _kartaview) {
61287         _kartaview = null;
61288       }
61289       return _kartaview;
61290     }
61291     function showLayer() {
61292       var service = getService();
61293       if (!service) return;
61294       editOn();
61295       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61296         dispatch14.call("change");
61297       });
61298     }
61299     function hideLayer() {
61300       throttledRedraw.cancel();
61301       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61302     }
61303     function editOn() {
61304       layer.style("display", "block");
61305     }
61306     function editOff() {
61307       layer.selectAll(".viewfield-group").remove();
61308       layer.style("display", "none");
61309     }
61310     function click(d3_event, d2) {
61311       var service = getService();
61312       if (!service) return;
61313       service.ensureViewerLoaded(context).then(function() {
61314         service.selectImage(context, d2.key).showViewer(context);
61315       });
61316       context.map().centerEase(d2.loc);
61317     }
61318     function mouseover(d3_event, d2) {
61319       var service = getService();
61320       if (service) service.setStyles(context, d2);
61321     }
61322     function mouseout() {
61323       var service = getService();
61324       if (service) service.setStyles(context, null);
61325     }
61326     function transform2(d2) {
61327       var t2 = svgPointTransform(projection2)(d2);
61328       if (d2.ca) {
61329         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
61330       }
61331       return t2;
61332     }
61333     function filterImages(images) {
61334       var fromDate = context.photos().fromDate();
61335       var toDate = context.photos().toDate();
61336       var usernames = context.photos().usernames();
61337       if (fromDate) {
61338         var fromTimestamp = new Date(fromDate).getTime();
61339         images = images.filter(function(item) {
61340           return new Date(item.captured_at).getTime() >= fromTimestamp;
61341         });
61342       }
61343       if (toDate) {
61344         var toTimestamp = new Date(toDate).getTime();
61345         images = images.filter(function(item) {
61346           return new Date(item.captured_at).getTime() <= toTimestamp;
61347         });
61348       }
61349       if (usernames) {
61350         images = images.filter(function(item) {
61351           return usernames.indexOf(item.captured_by) !== -1;
61352         });
61353       }
61354       return images;
61355     }
61356     function filterSequences(sequences) {
61357       var fromDate = context.photos().fromDate();
61358       var toDate = context.photos().toDate();
61359       var usernames = context.photos().usernames();
61360       if (fromDate) {
61361         var fromTimestamp = new Date(fromDate).getTime();
61362         sequences = sequences.filter(function(sequence) {
61363           return new Date(sequence.properties.captured_at).getTime() >= fromTimestamp;
61364         });
61365       }
61366       if (toDate) {
61367         var toTimestamp = new Date(toDate).getTime();
61368         sequences = sequences.filter(function(sequence) {
61369           return new Date(sequence.properties.captured_at).getTime() <= toTimestamp;
61370         });
61371       }
61372       if (usernames) {
61373         sequences = sequences.filter(function(sequence) {
61374           return usernames.indexOf(sequence.properties.captured_by) !== -1;
61375         });
61376       }
61377       return sequences;
61378     }
61379     function update() {
61380       var viewer = context.container().select(".photoviewer");
61381       var selected = viewer.empty() ? void 0 : viewer.datum();
61382       var z3 = ~~context.map().zoom();
61383       var showMarkers = z3 >= minMarkerZoom;
61384       var showViewfields = z3 >= minViewfieldZoom2;
61385       var service = getService();
61386       var sequences = [];
61387       var images = [];
61388       sequences = service ? service.sequences(projection2) : [];
61389       images = service && showMarkers ? service.images(projection2) : [];
61390       dispatch14.call("photoDatesChanged", this, "kartaview", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
61391       sequences = filterSequences(sequences);
61392       images = filterImages(images);
61393       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61394         return d2.properties.key;
61395       });
61396       traces.exit().remove();
61397       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61398       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61399         return d2.key;
61400       });
61401       groups.exit().remove();
61402       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61403       groupsEnter.append("g").attr("class", "viewfield-scale");
61404       var markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61405         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
61406       }).attr("transform", transform2).select(".viewfield-scale");
61407       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61408       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61409       viewfields.exit().remove();
61410       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");
61411     }
61412     function drawImages(selection2) {
61413       var enabled = svgKartaviewImages.enabled, service = getService();
61414       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
61415       layer.exit().remove();
61416       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
61417       layerEnter.append("g").attr("class", "sequences");
61418       layerEnter.append("g").attr("class", "markers");
61419       layer = layerEnter.merge(layer);
61420       if (enabled) {
61421         if (service && ~~context.map().zoom() >= minZoom5) {
61422           editOn();
61423           update();
61424           service.loadImages(projection2);
61425         } else {
61426           dispatch14.call("photoDatesChanged", this, "kartaview", []);
61427           editOff();
61428         }
61429       } else {
61430         dispatch14.call("photoDatesChanged", this, "kartaview", []);
61431       }
61432     }
61433     drawImages.enabled = function(_3) {
61434       if (!arguments.length) return svgKartaviewImages.enabled;
61435       svgKartaviewImages.enabled = _3;
61436       if (svgKartaviewImages.enabled) {
61437         showLayer();
61438         context.photos().on("change.kartaview_images", update);
61439       } else {
61440         hideLayer();
61441         context.photos().on("change.kartaview_images", null);
61442       }
61443       dispatch14.call("change");
61444       return this;
61445     };
61446     drawImages.supported = function() {
61447       return !!getService();
61448     };
61449     drawImages.rendered = function(zoom) {
61450       return zoom >= minZoom5;
61451     };
61452     init2();
61453     return drawImages;
61454   }
61455   var init_kartaview_images = __esm({
61456     "modules/svg/kartaview_images.js"() {
61457       "use strict";
61458       init_throttle();
61459       init_src5();
61460       init_helpers();
61461       init_services();
61462     }
61463   });
61464
61465   // modules/svg/mapilio_images.js
61466   var mapilio_images_exports = {};
61467   __export(mapilio_images_exports, {
61468     svgMapilioImages: () => svgMapilioImages
61469   });
61470   function svgMapilioImages(projection2, context, dispatch14) {
61471     const throttledRedraw = throttle_default(function() {
61472       dispatch14.call("change");
61473     }, 1e3);
61474     const imageMinZoom2 = 16;
61475     const lineMinZoom2 = 10;
61476     const viewFieldZoomLevel = 18;
61477     let layer = select_default2(null);
61478     let _mapilio;
61479     let _viewerYaw = 0;
61480     function init2() {
61481       if (svgMapilioImages.initialized) return;
61482       svgMapilioImages.enabled = false;
61483       svgMapilioImages.initialized = true;
61484     }
61485     function getService() {
61486       if (services.mapilio && !_mapilio) {
61487         _mapilio = services.mapilio;
61488         _mapilio.event.on("loadedImages", throttledRedraw).on("loadedLines", throttledRedraw);
61489       } else if (!services.mapilio && _mapilio) {
61490         _mapilio = null;
61491       }
61492       return _mapilio;
61493     }
61494     function filterImages(images) {
61495       var fromDate = context.photos().fromDate();
61496       var toDate = context.photos().toDate();
61497       if (fromDate) {
61498         images = images.filter(function(image) {
61499           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
61500         });
61501       }
61502       if (toDate) {
61503         images = images.filter(function(image) {
61504           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
61505         });
61506       }
61507       return images;
61508     }
61509     function filterSequences(sequences) {
61510       var fromDate = context.photos().fromDate();
61511       var toDate = context.photos().toDate();
61512       if (fromDate) {
61513         sequences = sequences.filter(function(sequence) {
61514           return new Date(sequence.properties.capture_time).getTime() >= new Date(fromDate).getTime().toString();
61515         });
61516       }
61517       if (toDate) {
61518         sequences = sequences.filter(function(sequence) {
61519           return new Date(sequence.properties.capture_time).getTime() <= new Date(toDate).getTime().toString();
61520         });
61521       }
61522       return sequences;
61523     }
61524     function showLayer() {
61525       const service = getService();
61526       if (!service) return;
61527       editOn();
61528       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61529         dispatch14.call("change");
61530       });
61531     }
61532     function hideLayer() {
61533       throttledRedraw.cancel();
61534       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61535     }
61536     function transform2(d2, selectedImageId) {
61537       let t2 = svgPointTransform(projection2)(d2);
61538       let rot = d2.heading || 0;
61539       if (d2.id === selectedImageId) {
61540         rot += _viewerYaw;
61541       }
61542       if (rot) {
61543         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
61544       }
61545       return t2;
61546     }
61547     function editOn() {
61548       layer.style("display", "block");
61549     }
61550     function editOff() {
61551       layer.selectAll(".viewfield-group").remove();
61552       layer.style("display", "none");
61553     }
61554     function click(d3_event, image) {
61555       const service = getService();
61556       if (!service) return;
61557       service.ensureViewerLoaded(context, image.id).then(() => {
61558         service.selectImage(context, image.id).showViewer(context);
61559       });
61560       context.map().centerEase(image.loc);
61561     }
61562     function mouseover(d3_event, image) {
61563       const service = getService();
61564       if (service) service.setStyles(context, image);
61565     }
61566     function mouseout() {
61567       const service = getService();
61568       if (service) service.setStyles(context, null);
61569     }
61570     async function update() {
61571       var _a4;
61572       const zoom = ~~context.map().zoom();
61573       const showViewfields = zoom >= viewFieldZoomLevel;
61574       const service = getService();
61575       let sequences = service ? service.sequences(projection2, zoom) : [];
61576       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
61577       dispatch14.call("photoDatesChanged", this, "mapilio", [
61578         ...images.map((p2) => p2.capture_time),
61579         ...sequences.map((s2) => s2.properties.capture_time)
61580       ]);
61581       images = await filterImages(images);
61582       sequences = await filterSequences(sequences, service);
61583       const activeImage = (_a4 = service.getActiveImage) == null ? void 0 : _a4.call(service);
61584       const activeImageId = activeImage ? activeImage.id : null;
61585       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61586         return d2.properties.id;
61587       });
61588       traces.exit().remove();
61589       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61590       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61591         return d2.id;
61592       });
61593       groups.exit().remove();
61594       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61595       groupsEnter.append("g").attr("class", "viewfield-scale");
61596       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61597         if (a4.id === activeImageId) return 1;
61598         if (b3.id === activeImageId) return -1;
61599         return a4.capture_time_parsed - b3.capture_time_parsed;
61600       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
61601       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61602       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61603       viewfields.exit().remove();
61604       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
61605       service.setStyles(context, null);
61606       function viewfieldPath() {
61607         if (this.parentNode.__data__.isPano) {
61608           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
61609         } else {
61610           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
61611         }
61612       }
61613     }
61614     function drawImages(selection2) {
61615       const enabled = svgMapilioImages.enabled;
61616       const service = getService();
61617       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
61618       layer.exit().remove();
61619       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
61620       layerEnter.append("g").attr("class", "sequences");
61621       layerEnter.append("g").attr("class", "markers");
61622       layer = layerEnter.merge(layer);
61623       if (enabled) {
61624         let zoom = ~~context.map().zoom();
61625         if (service) {
61626           if (zoom >= imageMinZoom2) {
61627             editOn();
61628             update();
61629             service.loadImages(projection2);
61630             service.loadLines(projection2, zoom);
61631           } else if (zoom >= lineMinZoom2) {
61632             editOn();
61633             update();
61634             service.loadImages(projection2);
61635             service.loadLines(projection2, zoom);
61636           } else {
61637             editOff();
61638             dispatch14.call("photoDatesChanged", this, "mapilio", []);
61639             service.selectImage(context, null);
61640           }
61641         } else {
61642           editOff();
61643         }
61644       } else {
61645         dispatch14.call("photoDatesChanged", this, "mapilio", []);
61646       }
61647     }
61648     drawImages.enabled = function(_3) {
61649       if (!arguments.length) return svgMapilioImages.enabled;
61650       svgMapilioImages.enabled = _3;
61651       if (svgMapilioImages.enabled) {
61652         showLayer();
61653         context.photos().on("change.mapilio_images", update);
61654       } else {
61655         hideLayer();
61656         context.photos().on("change.mapilio_images", null);
61657       }
61658       dispatch14.call("change");
61659       return this;
61660     };
61661     drawImages.supported = function() {
61662       return !!getService();
61663     };
61664     drawImages.rendered = function(zoom) {
61665       return zoom >= lineMinZoom2;
61666     };
61667     init2();
61668     return drawImages;
61669   }
61670   var init_mapilio_images = __esm({
61671     "modules/svg/mapilio_images.js"() {
61672       "use strict";
61673       init_throttle();
61674       init_src5();
61675       init_services();
61676       init_helpers();
61677     }
61678   });
61679
61680   // modules/svg/panoramax_images.js
61681   var panoramax_images_exports = {};
61682   __export(panoramax_images_exports, {
61683     svgPanoramaxImages: () => svgPanoramaxImages
61684   });
61685   function svgPanoramaxImages(projection2, context, dispatch14) {
61686     const throttledRedraw = throttle_default(function() {
61687       dispatch14.call("change");
61688     }, 1e3);
61689     const imageMinZoom2 = 15;
61690     const lineMinZoom2 = 10;
61691     const viewFieldZoomLevel = 18;
61692     let layer = select_default2(null);
61693     let _panoramax;
61694     let _viewerYaw = 0;
61695     let _activeUsernameFilter;
61696     let _activeIds;
61697     function init2() {
61698       if (svgPanoramaxImages.initialized) return;
61699       svgPanoramaxImages.enabled = false;
61700       svgPanoramaxImages.initialized = true;
61701     }
61702     function getService() {
61703       if (services.panoramax && !_panoramax) {
61704         _panoramax = services.panoramax;
61705         _panoramax.event.on("viewerChanged", viewerChanged).on("loadedLines", throttledRedraw).on("loadedImages", throttledRedraw);
61706       } else if (!services.panoramax && _panoramax) {
61707         _panoramax = null;
61708       }
61709       return _panoramax;
61710     }
61711     async function filterImages(images) {
61712       const showsPano = context.photos().showsPanoramic();
61713       const showsFlat = context.photos().showsFlat();
61714       const fromDate = context.photos().fromDate();
61715       const toDate = context.photos().toDate();
61716       const username = context.photos().usernames();
61717       const service = getService();
61718       if (!showsPano || !showsFlat) {
61719         images = images.filter(function(image) {
61720           if (image.isPano) return showsPano;
61721           return showsFlat;
61722         });
61723       }
61724       if (fromDate) {
61725         images = images.filter(function(image) {
61726           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
61727         });
61728       }
61729       if (toDate) {
61730         images = images.filter(function(image) {
61731           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
61732         });
61733       }
61734       if (username && service) {
61735         if (_activeUsernameFilter !== username) {
61736           _activeUsernameFilter = username;
61737           const tempIds = await service.getUserIds(username);
61738           _activeIds = {};
61739           tempIds.forEach((id2) => {
61740             _activeIds[id2] = true;
61741           });
61742         }
61743         images = images.filter(function(image) {
61744           return _activeIds[image.account_id];
61745         });
61746       }
61747       return images;
61748     }
61749     async function filterSequences(sequences) {
61750       const showsPano = context.photos().showsPanoramic();
61751       const showsFlat = context.photos().showsFlat();
61752       const fromDate = context.photos().fromDate();
61753       const toDate = context.photos().toDate();
61754       const username = context.photos().usernames();
61755       const service = getService();
61756       if (!showsPano || !showsFlat) {
61757         sequences = sequences.filter(function(sequence) {
61758           if (sequence.properties.type === "equirectangular") return showsPano;
61759           return showsFlat;
61760         });
61761       }
61762       if (fromDate) {
61763         sequences = sequences.filter(function(sequence) {
61764           return new Date(sequence.properties.date).getTime() >= new Date(fromDate).getTime().toString();
61765         });
61766       }
61767       if (toDate) {
61768         sequences = sequences.filter(function(sequence) {
61769           return new Date(sequence.properties.date).getTime() <= new Date(toDate).getTime().toString();
61770         });
61771       }
61772       if (username && service) {
61773         if (_activeUsernameFilter !== username) {
61774           _activeUsernameFilter = username;
61775           const tempIds = await service.getUserIds(username);
61776           _activeIds = {};
61777           tempIds.forEach((id2) => {
61778             _activeIds[id2] = true;
61779           });
61780         }
61781         sequences = sequences.filter(function(sequence) {
61782           return _activeIds[sequence.properties.account_id];
61783         });
61784       }
61785       return sequences;
61786     }
61787     function showLayer() {
61788       const service = getService();
61789       if (!service) return;
61790       editOn();
61791       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61792         dispatch14.call("change");
61793       });
61794     }
61795     function hideLayer() {
61796       throttledRedraw.cancel();
61797       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61798     }
61799     function transform2(d2, selectedImageId) {
61800       let t2 = svgPointTransform(projection2)(d2);
61801       let rot = d2.heading;
61802       if (d2.id === selectedImageId) {
61803         rot += _viewerYaw;
61804       }
61805       if (rot) {
61806         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
61807       }
61808       return t2;
61809     }
61810     function editOn() {
61811       layer.style("display", "block");
61812     }
61813     function editOff() {
61814       layer.selectAll(".viewfield-group").remove();
61815       layer.style("display", "none");
61816     }
61817     function click(d3_event, image) {
61818       const service = getService();
61819       if (!service) return;
61820       service.ensureViewerLoaded(context).then(function() {
61821         service.selectImage(context, image.id).showViewer(context);
61822       });
61823       context.map().centerEase(image.loc);
61824     }
61825     function mouseover(d3_event, image) {
61826       const service = getService();
61827       if (service) service.setStyles(context, image);
61828     }
61829     function mouseout() {
61830       const service = getService();
61831       if (service) service.setStyles(context, null);
61832     }
61833     async function update() {
61834       var _a4;
61835       const zoom = ~~context.map().zoom();
61836       const showViewfields = zoom >= viewFieldZoomLevel;
61837       const service = getService();
61838       let sequences = service ? service.sequences(projection2, zoom) : [];
61839       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
61840       dispatch14.call("photoDatesChanged", this, "panoramax", [...images.map((p2) => p2.capture_time), ...sequences.map((s2) => s2.properties.date)]);
61841       images = await filterImages(images);
61842       sequences = await filterSequences(sequences, service);
61843       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61844         return d2.properties.id;
61845       });
61846       traces.exit().remove();
61847       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61848       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61849         return d2.id;
61850       });
61851       groups.exit().remove();
61852       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61853       groupsEnter.append("g").attr("class", "viewfield-scale");
61854       const activeImageId = (_a4 = service.getActiveImage()) == null ? void 0 : _a4.id;
61855       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61856         if (a4.id === activeImageId) return 1;
61857         if (b3.id === activeImageId) return -1;
61858         return a4.capture_time_parsed - b3.capture_time_parsed;
61859       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
61860       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61861       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61862       viewfields.exit().remove();
61863       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
61864       service.setStyles(context, null);
61865       function viewfieldPath() {
61866         if (this.parentNode.__data__.isPano) {
61867           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
61868         } else {
61869           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
61870         }
61871       }
61872     }
61873     function viewerChanged() {
61874       const service = getService();
61875       if (!service) return;
61876       const frame2 = service.photoFrame();
61877       if (!frame2) return;
61878       _viewerYaw = frame2.getYaw();
61879       if (context.map().isTransformed()) return;
61880       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2.id));
61881     }
61882     function drawImages(selection2) {
61883       const enabled = svgPanoramaxImages.enabled;
61884       const service = getService();
61885       layer = selection2.selectAll(".layer-panoramax").data(service ? [0] : []);
61886       layer.exit().remove();
61887       const layerEnter = layer.enter().append("g").attr("class", "layer-panoramax").style("display", enabled ? "block" : "none");
61888       layerEnter.append("g").attr("class", "sequences");
61889       layerEnter.append("g").attr("class", "markers");
61890       layer = layerEnter.merge(layer);
61891       if (enabled) {
61892         let zoom = ~~context.map().zoom();
61893         if (service) {
61894           if (zoom >= imageMinZoom2) {
61895             editOn();
61896             update();
61897             service.loadImages(projection2);
61898           } else if (zoom >= lineMinZoom2) {
61899             editOn();
61900             update();
61901             service.loadLines(projection2, zoom);
61902           } else {
61903             editOff();
61904             dispatch14.call("photoDatesChanged", this, "panoramax", []);
61905           }
61906         } else {
61907           editOff();
61908         }
61909       } else {
61910         dispatch14.call("photoDatesChanged", this, "panoramax", []);
61911       }
61912     }
61913     drawImages.enabled = function(_3) {
61914       if (!arguments.length) return svgPanoramaxImages.enabled;
61915       svgPanoramaxImages.enabled = _3;
61916       if (svgPanoramaxImages.enabled) {
61917         showLayer();
61918         context.photos().on("change.panoramax_images", update);
61919       } else {
61920         hideLayer();
61921         context.photos().on("change.panoramax_images", null);
61922       }
61923       dispatch14.call("change");
61924       return this;
61925     };
61926     drawImages.supported = function() {
61927       return !!getService();
61928     };
61929     drawImages.rendered = function(zoom) {
61930       return zoom >= lineMinZoom2;
61931     };
61932     init2();
61933     return drawImages;
61934   }
61935   var init_panoramax_images = __esm({
61936     "modules/svg/panoramax_images.js"() {
61937       "use strict";
61938       init_throttle();
61939       init_src5();
61940       init_services();
61941       init_helpers();
61942     }
61943   });
61944
61945   // modules/svg/osm.js
61946   var osm_exports3 = {};
61947   __export(osm_exports3, {
61948     svgOsm: () => svgOsm
61949   });
61950   function svgOsm(projection2, context, dispatch14) {
61951     var enabled = true;
61952     function drawOsm(selection2) {
61953       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
61954         return "layer-osm " + d2;
61955       });
61956       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["vertices", "midpoints", "points", "turns"]).enter().append("g").attr("class", function(d2) {
61957         return "points-group " + d2;
61958       });
61959     }
61960     function showLayer() {
61961       var layer = context.surface().selectAll(".data-layer.osm");
61962       layer.interrupt();
61963       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
61964         dispatch14.call("change");
61965       });
61966     }
61967     function hideLayer() {
61968       var layer = context.surface().selectAll(".data-layer.osm");
61969       layer.interrupt();
61970       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
61971         layer.classed("disabled", true);
61972         dispatch14.call("change");
61973       });
61974     }
61975     drawOsm.enabled = function(val) {
61976       if (!arguments.length) return enabled;
61977       enabled = val;
61978       if (enabled) {
61979         showLayer();
61980       } else {
61981         hideLayer();
61982       }
61983       dispatch14.call("change");
61984       return this;
61985     };
61986     return drawOsm;
61987   }
61988   var init_osm3 = __esm({
61989     "modules/svg/osm.js"() {
61990       "use strict";
61991     }
61992   });
61993
61994   // modules/svg/notes.js
61995   var notes_exports = {};
61996   __export(notes_exports, {
61997     svgNotes: () => svgNotes
61998   });
61999   function svgNotes(projection2, context, dispatch14) {
62000     if (!dispatch14) {
62001       dispatch14 = dispatch_default("change");
62002     }
62003     var throttledRedraw = throttle_default(function() {
62004       dispatch14.call("change");
62005     }, 1e3);
62006     var minZoom5 = 12;
62007     var touchLayer = select_default2(null);
62008     var drawLayer = select_default2(null);
62009     var _notesVisible = false;
62010     function markerPath(selection2, klass) {
62011       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");
62012     }
62013     function getService() {
62014       if (services.osm && !_osmService) {
62015         _osmService = services.osm;
62016         _osmService.on("loadedNotes", throttledRedraw);
62017       } else if (!services.osm && _osmService) {
62018         _osmService = null;
62019       }
62020       return _osmService;
62021     }
62022     function editOn() {
62023       if (!_notesVisible) {
62024         _notesVisible = true;
62025         drawLayer.style("display", "block");
62026       }
62027     }
62028     function editOff() {
62029       if (_notesVisible) {
62030         _notesVisible = false;
62031         drawLayer.style("display", "none");
62032         drawLayer.selectAll(".note").remove();
62033         touchLayer.selectAll(".note").remove();
62034       }
62035     }
62036     function layerOn() {
62037       editOn();
62038       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
62039         dispatch14.call("change");
62040       });
62041     }
62042     function layerOff() {
62043       throttledRedraw.cancel();
62044       drawLayer.interrupt();
62045       touchLayer.selectAll(".note").remove();
62046       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
62047         editOff();
62048         dispatch14.call("change");
62049       });
62050     }
62051     function updateMarkers() {
62052       if (!_notesVisible || !_notesEnabled) return;
62053       var service = getService();
62054       var selectedID = context.selectedNoteID();
62055       var data = service ? service.notes(projection2) : [];
62056       var getTransform = svgPointTransform(projection2);
62057       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
62058         return d2.status + d2.id;
62059       });
62060       notes.exit().remove();
62061       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
62062         return "note note-" + d2.id + " " + d2.status;
62063       }).classed("new", function(d2) {
62064         return d2.id < 0;
62065       });
62066       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
62067       notesEnter.append("path").call(markerPath, "shadow");
62068       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");
62069       notesEnter.selectAll(".icon-annotation").data(function(d2) {
62070         return [d2];
62071       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
62072         if (d2.id < 0) return "#iD-icon-plus";
62073         if (d2.status === "open") return "#iD-icon-close";
62074         return "#iD-icon-apply";
62075       });
62076       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
62077         var mode = context.mode();
62078         var isMoving = mode && mode.id === "drag-note";
62079         return !isMoving && d2.id === selectedID;
62080       }).attr("transform", getTransform);
62081       if (touchLayer.empty()) return;
62082       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62083       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
62084         return d2.id;
62085       });
62086       targets.exit().remove();
62087       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
62088         var newClass = d2.id < 0 ? "new" : "";
62089         return "note target note-" + d2.id + " " + fillClass + newClass;
62090       }).attr("transform", getTransform);
62091       function sortY(a4, b3) {
62092         if (a4.id === selectedID) return 1;
62093         if (b3.id === selectedID) return -1;
62094         return b3.loc[1] - a4.loc[1];
62095       }
62096     }
62097     function drawNotes(selection2) {
62098       var service = getService();
62099       var surface = context.surface();
62100       if (surface && !surface.empty()) {
62101         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
62102       }
62103       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
62104       drawLayer.exit().remove();
62105       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
62106       if (_notesEnabled) {
62107         if (service && ~~context.map().zoom() >= minZoom5) {
62108           editOn();
62109           service.loadNotes(projection2);
62110           updateMarkers();
62111         } else {
62112           editOff();
62113         }
62114       }
62115     }
62116     drawNotes.enabled = function(val) {
62117       if (!arguments.length) return _notesEnabled;
62118       _notesEnabled = val;
62119       if (_notesEnabled) {
62120         layerOn();
62121       } else {
62122         layerOff();
62123         if (context.selectedNoteID()) {
62124           context.enter(modeBrowse(context));
62125         }
62126       }
62127       dispatch14.call("change");
62128       return this;
62129     };
62130     return drawNotes;
62131   }
62132   var hash, _notesEnabled, _osmService;
62133   var init_notes = __esm({
62134     "modules/svg/notes.js"() {
62135       "use strict";
62136       init_throttle();
62137       init_src5();
62138       init_src4();
62139       init_browse();
62140       init_helpers();
62141       init_services();
62142       init_util();
62143       hash = utilStringQs(window.location.hash);
62144       _notesEnabled = !!hash.notes;
62145     }
62146   });
62147
62148   // modules/svg/touch.js
62149   var touch_exports = {};
62150   __export(touch_exports, {
62151     svgTouch: () => svgTouch
62152   });
62153   function svgTouch() {
62154     function drawTouch(selection2) {
62155       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
62156         return "layer-touch " + d2;
62157       });
62158     }
62159     return drawTouch;
62160   }
62161   var init_touch = __esm({
62162     "modules/svg/touch.js"() {
62163       "use strict";
62164     }
62165   });
62166
62167   // modules/util/dimensions.js
62168   var dimensions_exports = {};
62169   __export(dimensions_exports, {
62170     utilGetDimensions: () => utilGetDimensions,
62171     utilSetDimensions: () => utilSetDimensions
62172   });
62173   function refresh(selection2, node) {
62174     var cr = node.getBoundingClientRect();
62175     var prop = [cr.width, cr.height];
62176     selection2.property("__dimensions__", prop);
62177     return prop;
62178   }
62179   function utilGetDimensions(selection2, force) {
62180     if (!selection2 || selection2.empty()) {
62181       return [0, 0];
62182     }
62183     var node = selection2.node(), cached = selection2.property("__dimensions__");
62184     return !cached || force ? refresh(selection2, node) : cached;
62185   }
62186   function utilSetDimensions(selection2, dimensions) {
62187     if (!selection2 || selection2.empty()) {
62188       return selection2;
62189     }
62190     var node = selection2.node();
62191     if (dimensions === null) {
62192       refresh(selection2, node);
62193       return selection2;
62194     }
62195     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
62196   }
62197   var init_dimensions = __esm({
62198     "modules/util/dimensions.js"() {
62199       "use strict";
62200     }
62201   });
62202
62203   // modules/svg/layers.js
62204   var layers_exports = {};
62205   __export(layers_exports, {
62206     svgLayers: () => svgLayers
62207   });
62208   function svgLayers(projection2, context) {
62209     var dispatch14 = dispatch_default("change", "photoDatesChanged");
62210     var svg2 = select_default2(null);
62211     var _layers = [
62212       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
62213       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
62214       { id: "data", layer: svgData(projection2, context, dispatch14) },
62215       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
62216       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
62217       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
62218       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
62219       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
62220       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
62221       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
62222       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
62223       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
62224       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
62225       { id: "panoramax", layer: svgPanoramaxImages(projection2, context, dispatch14) },
62226       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
62227       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
62228       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
62229       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
62230     ];
62231     function drawLayers(selection2) {
62232       svg2 = selection2.selectAll(".surface").data([0]);
62233       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
62234       var defs = svg2.selectAll(".surface-defs").data([0]);
62235       defs.enter().append("defs").attr("class", "surface-defs");
62236       var groups = svg2.selectAll(".data-layer").data(_layers);
62237       groups.exit().remove();
62238       groups.enter().append("g").attr("class", function(d2) {
62239         return "data-layer " + d2.id;
62240       }).merge(groups).each(function(d2) {
62241         select_default2(this).call(d2.layer);
62242       });
62243     }
62244     drawLayers.all = function() {
62245       return _layers;
62246     };
62247     drawLayers.layer = function(id2) {
62248       var obj = _layers.find(function(o2) {
62249         return o2.id === id2;
62250       });
62251       return obj && obj.layer;
62252     };
62253     drawLayers.only = function(what) {
62254       var arr = [].concat(what);
62255       var all = _layers.map(function(layer) {
62256         return layer.id;
62257       });
62258       return drawLayers.remove(utilArrayDifference(all, arr));
62259     };
62260     drawLayers.remove = function(what) {
62261       var arr = [].concat(what);
62262       arr.forEach(function(id2) {
62263         _layers = _layers.filter(function(o2) {
62264           return o2.id !== id2;
62265         });
62266       });
62267       dispatch14.call("change");
62268       return this;
62269     };
62270     drawLayers.add = function(what) {
62271       var arr = [].concat(what);
62272       arr.forEach(function(obj) {
62273         if ("id" in obj && "layer" in obj) {
62274           _layers.push(obj);
62275         }
62276       });
62277       dispatch14.call("change");
62278       return this;
62279     };
62280     drawLayers.dimensions = function(val) {
62281       if (!arguments.length) return utilGetDimensions(svg2);
62282       utilSetDimensions(svg2, val);
62283       return this;
62284     };
62285     return utilRebind(drawLayers, dispatch14, "on");
62286   }
62287   var init_layers = __esm({
62288     "modules/svg/layers.js"() {
62289       "use strict";
62290       init_src4();
62291       init_src5();
62292       init_data2();
62293       init_local_photos();
62294       init_debug();
62295       init_geolocate();
62296       init_keepRight2();
62297       init_osmose2();
62298       init_streetside2();
62299       init_vegbilder2();
62300       init_mapillary_images();
62301       init_mapillary_position();
62302       init_mapillary_signs();
62303       init_mapillary_map_features();
62304       init_kartaview_images();
62305       init_mapilio_images();
62306       init_panoramax_images();
62307       init_osm3();
62308       init_notes();
62309       init_touch();
62310       init_util();
62311       init_dimensions();
62312     }
62313   });
62314
62315   // modules/svg/lines.js
62316   var lines_exports = {};
62317   __export(lines_exports, {
62318     svgLines: () => svgLines
62319   });
62320   function onewayArrowColour(tags) {
62321     if (tags.highway === "construction" && tags.bridge) return "white";
62322     if (tags.highway === "pedestrian") return "gray";
62323     if (tags.railway && !tags.highway) return "gray";
62324     if (tags.aeroway === "runway") return "white";
62325     return "black";
62326   }
62327   function svgLines(projection2, context) {
62328     var detected = utilDetect();
62329     var highway_stack = {
62330       motorway: 0,
62331       motorway_link: 1,
62332       trunk: 2,
62333       trunk_link: 3,
62334       primary: 4,
62335       primary_link: 5,
62336       secondary: 6,
62337       tertiary: 7,
62338       unclassified: 8,
62339       residential: 9,
62340       service: 10,
62341       busway: 11,
62342       footway: 12
62343     };
62344     function drawTargets(selection2, graph, entities, filter2) {
62345       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
62346       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
62347       var getPath = svgPath(projection2).geojson;
62348       var activeID = context.activeID();
62349       var base = context.history().base();
62350       var data = { targets: [], nopes: [] };
62351       entities.forEach(function(way) {
62352         var features = svgSegmentWay(way, graph, activeID);
62353         data.targets.push.apply(data.targets, features.passive);
62354         data.nopes.push.apply(data.nopes, features.active);
62355       });
62356       var targetData = data.targets.filter(getPath);
62357       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
62358         return filter2(d2.properties.entity);
62359       }).data(targetData, function key(d2) {
62360         return d2.id;
62361       });
62362       targets.exit().remove();
62363       var segmentWasEdited = function(d2) {
62364         var wayID = d2.properties.entity.id;
62365         if (!base.entities[wayID] || !(0, import_fast_deep_equal7.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
62366           return false;
62367         }
62368         return d2.properties.nodes.some(function(n3) {
62369           return !base.entities[n3.id] || !(0, import_fast_deep_equal7.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
62370         });
62371       };
62372       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
62373         return "way line target target-allowed " + targetClass + d2.id;
62374       }).classed("segment-edited", segmentWasEdited);
62375       var nopeData = data.nopes.filter(getPath);
62376       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
62377         return filter2(d2.properties.entity);
62378       }).data(nopeData, function key(d2) {
62379         return d2.id;
62380       });
62381       nopes.exit().remove();
62382       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
62383         return "way line target target-nope " + nopeClass + d2.id;
62384       }).classed("segment-edited", segmentWasEdited);
62385     }
62386     function drawLines(selection2, graph, entities, filter2) {
62387       var base = context.history().base();
62388       function waystack(a4, b3) {
62389         var selected = context.selectedIDs();
62390         var scoreA = selected.indexOf(a4.id) !== -1 ? 20 : 0;
62391         var scoreB = selected.indexOf(b3.id) !== -1 ? 20 : 0;
62392         if (a4.tags.highway) {
62393           scoreA -= highway_stack[a4.tags.highway];
62394         }
62395         if (b3.tags.highway) {
62396           scoreB -= highway_stack[b3.tags.highway];
62397         }
62398         return scoreA - scoreB;
62399       }
62400       function drawLineGroup(selection3, klass, isSelected) {
62401         var mode = context.mode();
62402         var isDrawing = mode && /^draw/.test(mode.id);
62403         var selectedClass = !isDrawing && isSelected ? "selected " : "";
62404         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
62405         lines.exit().remove();
62406         lines.enter().append("path").attr("class", function(d2) {
62407           var prefix = "way line";
62408           if (!d2.hasInterestingTags()) {
62409             var parentRelations = graph.parentRelations(d2);
62410             var parentMultipolygons = parentRelations.filter(function(relation) {
62411               return relation.isMultipolygon();
62412             });
62413             if (parentMultipolygons.length > 0 && // and only multipolygon relations
62414             parentRelations.length === parentMultipolygons.length) {
62415               prefix = "relation area";
62416             }
62417           }
62418           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
62419           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
62420         }).classed("added", function(d2) {
62421           return !base.entities[d2.id];
62422         }).classed("geometry-edited", function(d2) {
62423           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);
62424         }).classed("retagged", function(d2) {
62425           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);
62426         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
62427         return selection3;
62428       }
62429       function getPathData(isSelected) {
62430         return function() {
62431           var layer = this.parentNode.__data__;
62432           var data = pathdata[layer] || [];
62433           return data.filter(function(d2) {
62434             if (isSelected) {
62435               return context.selectedIDs().indexOf(d2.id) !== -1;
62436             } else {
62437               return context.selectedIDs().indexOf(d2.id) === -1;
62438             }
62439           });
62440         };
62441       }
62442       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
62443         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
62444         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
62445         var markers = markergroup.selectAll("path").filter(filter2).data(
62446           function data() {
62447             return groupdata[this.parentNode.__data__] || [];
62448           },
62449           function key(d2) {
62450             return [d2.id, d2.index];
62451           }
62452         );
62453         markers.exit().remove();
62454         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
62455           return d2.d;
62456         });
62457         if (detected.ie) {
62458           markers.each(function() {
62459             this.parentNode.insertBefore(this, this);
62460           });
62461         }
62462       }
62463       var getPath = svgPath(projection2, graph);
62464       var ways = [];
62465       var onewaydata = {};
62466       var sideddata = {};
62467       var oldMultiPolygonOuters = {};
62468       for (var i3 = 0; i3 < entities.length; i3++) {
62469         var entity = entities[i3];
62470         if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
62471           ways.push(entity);
62472         }
62473       }
62474       ways = ways.filter(getPath);
62475       const pathdata = utilArrayGroupBy(ways, (way) => Math.trunc(way.layer()));
62476       Object.keys(pathdata).forEach(function(k3) {
62477         var v3 = pathdata[k3];
62478         var onewayArr = v3.filter(function(d2) {
62479           return d2.isOneWay();
62480         });
62481         var onewaySegments = svgMarkerSegments(
62482           projection2,
62483           graph,
62484           36,
62485           (entity2) => entity2.isOneWayBackwards(),
62486           (entity2) => entity2.isBiDirectional()
62487         );
62488         onewaydata[k3] = utilArrayFlatten(onewayArr.map(onewaySegments));
62489         var sidedArr = v3.filter(function(d2) {
62490           return d2.isSided();
62491         });
62492         var sidedSegments = svgMarkerSegments(
62493           projection2,
62494           graph,
62495           30
62496         );
62497         sideddata[k3] = utilArrayFlatten(sidedArr.map(sidedSegments));
62498       });
62499       var covered = selection2.selectAll(".layer-osm.covered");
62500       var uncovered = selection2.selectAll(".layer-osm.lines");
62501       var touchLayer = selection2.selectAll(".layer-touch.lines");
62502       [covered, uncovered].forEach(function(selection3) {
62503         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
62504         var layergroup = selection3.selectAll("g.layergroup").data(range3);
62505         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
62506           return "layergroup layer" + String(d2);
62507         }).merge(layergroup);
62508         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
62509           return "linegroup line-" + d2;
62510         });
62511         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
62512         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
62513         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
62514         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
62515         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
62516         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
62517         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, (d2) => {
62518           const category = onewayArrowColour(graph.entity(d2.id).tags);
62519           return `url(#ideditor-oneway-marker-${category})`;
62520         });
62521         addMarkers(
62522           layergroup,
62523           "sided",
62524           "sidedgroup",
62525           sideddata,
62526           function marker(d2) {
62527             var category = graph.entity(d2.id).sidednessIdentifier();
62528             return "url(#ideditor-sided-marker-" + category + ")";
62529           }
62530         );
62531       });
62532       touchLayer.call(drawTargets, graph, ways, filter2);
62533     }
62534     return drawLines;
62535   }
62536   var import_fast_deep_equal7;
62537   var init_lines = __esm({
62538     "modules/svg/lines.js"() {
62539       "use strict";
62540       import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
62541       init_src();
62542       init_helpers();
62543       init_tag_classes();
62544       init_osm();
62545       init_util();
62546       init_detect();
62547     }
62548   });
62549
62550   // modules/svg/midpoints.js
62551   var midpoints_exports = {};
62552   __export(midpoints_exports, {
62553     svgMidpoints: () => svgMidpoints
62554   });
62555   function svgMidpoints(projection2, context) {
62556     var targetRadius = 8;
62557     function drawTargets(selection2, graph, entities, filter2) {
62558       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62559       var getTransform = svgPointTransform(projection2).geojson;
62560       var data = entities.map(function(midpoint) {
62561         return {
62562           type: "Feature",
62563           id: midpoint.id,
62564           properties: {
62565             target: true,
62566             entity: midpoint
62567           },
62568           geometry: {
62569             type: "Point",
62570             coordinates: midpoint.loc
62571           }
62572         };
62573       });
62574       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
62575         return filter2(d2.properties.entity);
62576       }).data(data, function key(d2) {
62577         return d2.id;
62578       });
62579       targets.exit().remove();
62580       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
62581         return "node midpoint target " + fillClass + d2.id;
62582       }).attr("transform", getTransform);
62583     }
62584     function drawMidpoints(selection2, graph, entities, filter2, extent) {
62585       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
62586       var touchLayer = selection2.selectAll(".layer-touch.points");
62587       var mode = context.mode();
62588       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
62589         drawLayer.selectAll(".midpoint").remove();
62590         touchLayer.selectAll(".midpoint.target").remove();
62591         return;
62592       }
62593       var poly = extent.polygon();
62594       var midpoints = {};
62595       for (var i3 = 0; i3 < entities.length; i3++) {
62596         var entity = entities[i3];
62597         if (entity.type !== "way") continue;
62598         if (!filter2(entity)) continue;
62599         if (context.selectedIDs().indexOf(entity.id) < 0) continue;
62600         var nodes = graph.childNodes(entity);
62601         for (var j3 = 0; j3 < nodes.length - 1; j3++) {
62602           var a4 = nodes[j3];
62603           var b3 = nodes[j3 + 1];
62604           var id2 = [a4.id, b3.id].sort().join("-");
62605           if (midpoints[id2]) {
62606             midpoints[id2].parents.push(entity);
62607           } else if (geoVecLength(projection2(a4.loc), projection2(b3.loc)) > 40) {
62608             var point = geoVecInterp(a4.loc, b3.loc, 0.5);
62609             var loc = null;
62610             if (extent.intersects(point)) {
62611               loc = point;
62612             } else {
62613               for (var k3 = 0; k3 < 4; k3++) {
62614                 point = geoLineIntersection([a4.loc, b3.loc], [poly[k3], poly[k3 + 1]]);
62615                 if (point && geoVecLength(projection2(a4.loc), projection2(point)) > 20 && geoVecLength(projection2(b3.loc), projection2(point)) > 20) {
62616                   loc = point;
62617                   break;
62618                 }
62619               }
62620             }
62621             if (loc) {
62622               midpoints[id2] = {
62623                 type: "midpoint",
62624                 id: id2,
62625                 loc,
62626                 edge: [a4.id, b3.id],
62627                 parents: [entity]
62628               };
62629             }
62630           }
62631         }
62632       }
62633       function midpointFilter(d2) {
62634         if (midpoints[d2.id]) return true;
62635         for (var i4 = 0; i4 < d2.parents.length; i4++) {
62636           if (filter2(d2.parents[i4])) {
62637             return true;
62638           }
62639         }
62640         return false;
62641       }
62642       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
62643         return d2.id;
62644       });
62645       groups.exit().remove();
62646       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
62647       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
62648       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
62649       groups = groups.merge(enter).attr("transform", function(d2) {
62650         var translate = svgPointTransform(projection2);
62651         var a5 = graph.entity(d2.edge[0]);
62652         var b4 = graph.entity(d2.edge[1]);
62653         var angle2 = geoAngle(a5, b4, projection2) * (180 / Math.PI);
62654         return translate(d2) + " rotate(" + angle2 + ")";
62655       }).call(svgTagClasses().tags(
62656         function(d2) {
62657           return d2.parents[0].tags;
62658         }
62659       ));
62660       groups.select("polygon.shadow");
62661       groups.select("polygon.fill");
62662       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
62663     }
62664     return drawMidpoints;
62665   }
62666   var init_midpoints = __esm({
62667     "modules/svg/midpoints.js"() {
62668       "use strict";
62669       init_helpers();
62670       init_tag_classes();
62671       init_geo2();
62672     }
62673   });
62674
62675   // node_modules/d3-axis/src/index.js
62676   var init_src19 = __esm({
62677     "node_modules/d3-axis/src/index.js"() {
62678     }
62679   });
62680
62681   // node_modules/d3-brush/src/constant.js
62682   var init_constant7 = __esm({
62683     "node_modules/d3-brush/src/constant.js"() {
62684     }
62685   });
62686
62687   // node_modules/d3-brush/src/event.js
62688   var init_event3 = __esm({
62689     "node_modules/d3-brush/src/event.js"() {
62690     }
62691   });
62692
62693   // node_modules/d3-brush/src/noevent.js
62694   var init_noevent3 = __esm({
62695     "node_modules/d3-brush/src/noevent.js"() {
62696     }
62697   });
62698
62699   // node_modules/d3-brush/src/brush.js
62700   function number1(e3) {
62701     return [+e3[0], +e3[1]];
62702   }
62703   function number22(e3) {
62704     return [number1(e3[0]), number1(e3[1])];
62705   }
62706   function type(t2) {
62707     return { type: t2 };
62708   }
62709   var abs2, max2, min2, X4, Y3, XY;
62710   var init_brush = __esm({
62711     "node_modules/d3-brush/src/brush.js"() {
62712       init_src11();
62713       init_constant7();
62714       init_event3();
62715       init_noevent3();
62716       ({ abs: abs2, max: max2, min: min2 } = Math);
62717       X4 = {
62718         name: "x",
62719         handles: ["w", "e"].map(type),
62720         input: function(x2, e3) {
62721           return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
62722         },
62723         output: function(xy) {
62724           return xy && [xy[0][0], xy[1][0]];
62725         }
62726       };
62727       Y3 = {
62728         name: "y",
62729         handles: ["n", "s"].map(type),
62730         input: function(y2, e3) {
62731           return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
62732         },
62733         output: function(xy) {
62734           return xy && [xy[0][1], xy[1][1]];
62735         }
62736       };
62737       XY = {
62738         name: "xy",
62739         handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
62740         input: function(xy) {
62741           return xy == null ? null : number22(xy);
62742         },
62743         output: function(xy) {
62744           return xy;
62745         }
62746       };
62747     }
62748   });
62749
62750   // node_modules/d3-brush/src/index.js
62751   var init_src20 = __esm({
62752     "node_modules/d3-brush/src/index.js"() {
62753       init_brush();
62754     }
62755   });
62756
62757   // node_modules/d3-path/src/index.js
62758   var init_src21 = __esm({
62759     "node_modules/d3-path/src/index.js"() {
62760     }
62761   });
62762
62763   // node_modules/d3-chord/src/index.js
62764   var init_src22 = __esm({
62765     "node_modules/d3-chord/src/index.js"() {
62766     }
62767   });
62768
62769   // node_modules/d3-contour/src/index.js
62770   var init_src23 = __esm({
62771     "node_modules/d3-contour/src/index.js"() {
62772     }
62773   });
62774
62775   // node_modules/d3-delaunay/src/index.js
62776   var init_src24 = __esm({
62777     "node_modules/d3-delaunay/src/index.js"() {
62778     }
62779   });
62780
62781   // node_modules/d3-quadtree/src/index.js
62782   var init_src25 = __esm({
62783     "node_modules/d3-quadtree/src/index.js"() {
62784     }
62785   });
62786
62787   // node_modules/d3-force/src/index.js
62788   var init_src26 = __esm({
62789     "node_modules/d3-force/src/index.js"() {
62790     }
62791   });
62792
62793   // node_modules/d3-hierarchy/src/index.js
62794   var init_src27 = __esm({
62795     "node_modules/d3-hierarchy/src/index.js"() {
62796     }
62797   });
62798
62799   // node_modules/d3-random/src/index.js
62800   var init_src28 = __esm({
62801     "node_modules/d3-random/src/index.js"() {
62802     }
62803   });
62804
62805   // node_modules/d3-scale-chromatic/src/index.js
62806   var init_src29 = __esm({
62807     "node_modules/d3-scale-chromatic/src/index.js"() {
62808     }
62809   });
62810
62811   // node_modules/d3-shape/src/index.js
62812   var init_src30 = __esm({
62813     "node_modules/d3-shape/src/index.js"() {
62814     }
62815   });
62816
62817   // node_modules/d3/src/index.js
62818   var init_src31 = __esm({
62819     "node_modules/d3/src/index.js"() {
62820       init_src();
62821       init_src19();
62822       init_src20();
62823       init_src22();
62824       init_src7();
62825       init_src23();
62826       init_src24();
62827       init_src4();
62828       init_src6();
62829       init_src17();
62830       init_src10();
62831       init_src18();
62832       init_src26();
62833       init_src13();
62834       init_src2();
62835       init_src27();
62836       init_src8();
62837       init_src21();
62838       init_src3();
62839       init_src25();
62840       init_src28();
62841       init_src16();
62842       init_src29();
62843       init_src5();
62844       init_src30();
62845       init_src14();
62846       init_src15();
62847       init_src9();
62848       init_src11();
62849       init_src12();
62850     }
62851   });
62852
62853   // modules/svg/points.js
62854   var points_exports = {};
62855   __export(points_exports, {
62856     svgPoints: () => svgPoints
62857   });
62858   function svgPoints(projection2, context) {
62859     function markerPath(selection2, klass) {
62860       selection2.attr("class", klass).attr("transform", (d2) => isAddressPoint(d2.tags) ? `translate(-${addressShieldWidth(d2, selection2) / 2}, -8)` : "translate(-8, -23)").attr("d", (d2) => {
62861         if (!isAddressPoint(d2.tags)) {
62862           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";
62863         }
62864         const w3 = addressShieldWidth(d2, selection2);
62865         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`;
62866       });
62867     }
62868     function sortY(a4, b3) {
62869       return b3.loc[1] - a4.loc[1];
62870     }
62871     function addressShieldWidth(d2, selection2) {
62872       const width = textWidth(d2.tags["addr:housenumber"] || d2.tags["addr:housename"] || "", 10, selection2.node().parentElement);
62873       return clamp_default(width, 10, 34) + 8;
62874     }
62875     ;
62876     function fastEntityKey(d2) {
62877       const mode = context.mode();
62878       const isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
62879       return isMoving ? d2.id : osmEntity.key(d2);
62880     }
62881     function drawTargets(selection2, graph, entities, filter2) {
62882       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62883       var getTransform = svgPointTransform(projection2).geojson;
62884       var activeID = context.activeID();
62885       var data = [];
62886       entities.forEach(function(node) {
62887         if (activeID === node.id) return;
62888         data.push({
62889           type: "Feature",
62890           id: node.id,
62891           properties: {
62892             target: true,
62893             entity: node,
62894             isAddr: isAddressPoint(node.tags)
62895           },
62896           geometry: node.asGeoJSON()
62897         });
62898       });
62899       var targets = selection2.selectAll(".point.target").filter((d2) => filter2(d2.properties.entity)).data(data, (d2) => fastEntityKey(d2.properties.entity));
62900       targets.exit().remove();
62901       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) {
62902         return "node point target " + fillClass + d2.id;
62903       }).merge(targets).attr("transform", getTransform);
62904     }
62905     function drawPoints(selection2, graph, entities, filter2) {
62906       var wireframe = context.surface().classed("fill-wireframe");
62907       var zoom = geoScaleToZoom(projection2.scale());
62908       var base = context.history().base();
62909       function renderAsPoint(entity) {
62910         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
62911       }
62912       var points = wireframe ? [] : entities.filter(renderAsPoint);
62913       points.sort(sortY);
62914       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
62915       var touchLayer = selection2.selectAll(".layer-touch.points");
62916       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
62917       groups.exit().remove();
62918       var enter = groups.enter().append("g").attr("class", function(d2) {
62919         return "node point " + d2.id;
62920       }).order();
62921       enter.append("path").call(markerPath, "shadow");
62922       enter.each(function(d2) {
62923         if (isAddressPoint(d2.tags)) return;
62924         select_default2(this).append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
62925       });
62926       enter.append("path").call(markerPath, "stroke");
62927       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
62928       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
62929         return !base.entities[d2.id];
62930       }).classed("moved", function(d2) {
62931         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
62932       }).classed("retagged", function(d2) {
62933         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
62934       }).call(svgTagClasses());
62935       groups.select(".shadow");
62936       groups.select(".stroke");
62937       groups.select(".icon").attr("xlink:href", function(entity) {
62938         var preset = _mainPresetIndex.match(entity, graph);
62939         var picon = preset && preset.icon;
62940         return picon ? "#" + picon : "";
62941       });
62942       touchLayer.call(drawTargets, graph, points, filter2);
62943     }
62944     return drawPoints;
62945   }
62946   var import_fast_deep_equal8;
62947   var init_points = __esm({
62948     "modules/svg/points.js"() {
62949       "use strict";
62950       import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
62951       init_lodash();
62952       init_src31();
62953       init_geo2();
62954       init_osm();
62955       init_helpers();
62956       init_tag_classes();
62957       init_presets();
62958       init_labels();
62959     }
62960   });
62961
62962   // modules/svg/turns.js
62963   var turns_exports = {};
62964   __export(turns_exports, {
62965     svgTurns: () => svgTurns
62966   });
62967   function svgTurns(projection2, context) {
62968     function icon2(turn) {
62969       var u2 = turn.u ? "-u" : "";
62970       if (turn.no) return "#iD-turn-no" + u2;
62971       if (turn.only) return "#iD-turn-only" + u2;
62972       return "#iD-turn-yes" + u2;
62973     }
62974     function drawTurns(selection2, graph, turns) {
62975       function turnTransform(d2) {
62976         var pxRadius = 50;
62977         var toWay = graph.entity(d2.to.way);
62978         var toPoints = graph.childNodes(toWay).map(function(n3) {
62979           return n3.loc;
62980         }).map(projection2);
62981         var toLength = geoPathLength(toPoints);
62982         var mid = toLength / 2;
62983         var toNode = graph.entity(d2.to.node);
62984         var toVertex = graph.entity(d2.to.vertex);
62985         var a4 = geoAngle(toVertex, toNode, projection2);
62986         var o2 = projection2(toVertex.loc);
62987         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
62988         return "translate(" + (r2 * Math.cos(a4) + o2[0]) + "," + (r2 * Math.sin(a4) + o2[1]) + ") rotate(" + a4 * 180 / Math.PI + ")";
62989       }
62990       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
62991       var touchLayer = selection2.selectAll(".layer-touch.turns");
62992       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
62993         return d2.key;
62994       });
62995       groups.exit().remove();
62996       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
62997         return "turn " + d2.key;
62998       });
62999       var turnsEnter = groupsEnter.filter(function(d2) {
63000         return !d2.u;
63001       });
63002       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
63003       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
63004       var uEnter = groupsEnter.filter(function(d2) {
63005         return d2.u;
63006       });
63007       uEnter.append("circle").attr("r", "16");
63008       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
63009       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
63010         return d2.direct === false ? "0.7" : null;
63011       }).attr("transform", turnTransform);
63012       groups.select("use").attr("xlink:href", icon2);
63013       groups.select("rect");
63014       groups.select("circle");
63015       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
63016       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
63017         return d2.key;
63018       });
63019       groups.exit().remove();
63020       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
63021         return "turn " + d2.key;
63022       });
63023       turnsEnter = groupsEnter.filter(function(d2) {
63024         return !d2.u;
63025       });
63026       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
63027       uEnter = groupsEnter.filter(function(d2) {
63028         return d2.u;
63029       });
63030       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
63031       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
63032       groups.select("rect");
63033       groups.select("circle");
63034       return this;
63035     }
63036     return drawTurns;
63037   }
63038   var init_turns = __esm({
63039     "modules/svg/turns.js"() {
63040       "use strict";
63041       init_geo2();
63042     }
63043   });
63044
63045   // modules/svg/vertices.js
63046   var vertices_exports = {};
63047   __export(vertices_exports, {
63048     svgVertices: () => svgVertices
63049   });
63050   function svgVertices(projection2, context) {
63051     var radiuses = {
63052       //       z16-, z17,   z18+,  w/icon
63053       shadow: [6, 7.5, 7.5, 12],
63054       stroke: [2.5, 3.5, 3.5, 8],
63055       fill: [1, 1.5, 1.5, 1.5]
63056     };
63057     var _currHoverTarget;
63058     var _currPersistent = {};
63059     var _currHover = {};
63060     var _prevHover = {};
63061     var _currSelected = {};
63062     var _prevSelected = {};
63063     var _radii = {};
63064     function sortY(a4, b3) {
63065       return b3.loc[1] - a4.loc[1];
63066     }
63067     function fastEntityKey(d2) {
63068       var mode = context.mode();
63069       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
63070       return isMoving ? d2.id : osmEntity.key(d2);
63071     }
63072     function draw(selection2, graph, vertices, sets2, filter2) {
63073       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
63074       var icons = {};
63075       var directions = {};
63076       var wireframe = context.surface().classed("fill-wireframe");
63077       var zoom = geoScaleToZoom(projection2.scale());
63078       var z3 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
63079       var activeID = context.activeID();
63080       var base = context.history().base();
63081       function getIcon(d2) {
63082         var entity = graph.entity(d2.id);
63083         if (entity.id in icons) return icons[entity.id];
63084         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
63085         return icons[entity.id];
63086       }
63087       function getDirections(entity) {
63088         if (entity.id in directions) return directions[entity.id];
63089         var angles = entity.directions(graph, projection2);
63090         directions[entity.id] = angles.length ? angles : false;
63091         return angles;
63092       }
63093       function updateAttributes(selection3) {
63094         ["shadow", "stroke", "fill"].forEach(function(klass) {
63095           var rads = radiuses[klass];
63096           selection3.selectAll("." + klass).each(function(entity) {
63097             var i3 = z3 && getIcon(entity);
63098             var r2 = rads[i3 ? 3 : z3];
63099             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
63100               r2 += 1.5;
63101             }
63102             if (klass === "shadow") {
63103               _radii[entity.id] = r2;
63104             }
63105             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
63106           });
63107         });
63108       }
63109       vertices.sort(sortY);
63110       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
63111       groups.exit().remove();
63112       var enter = groups.enter().append("g").attr("class", function(d2) {
63113         return "node vertex " + d2.id;
63114       }).order();
63115       enter.append("circle").attr("class", "shadow");
63116       enter.append("circle").attr("class", "stroke");
63117       enter.filter(function(d2) {
63118         return d2.hasInterestingTags();
63119       }).append("circle").attr("class", "fill");
63120       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
63121         return d2.id in sets2.selected;
63122       }).classed("shared", function(d2) {
63123         return graph.isShared(d2);
63124       }).classed("endpoint", function(d2) {
63125         return d2.isEndpoint(graph);
63126       }).classed("added", function(d2) {
63127         return !base.entities[d2.id];
63128       }).classed("moved", function(d2) {
63129         return base.entities[d2.id] && !(0, import_fast_deep_equal9.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
63130       }).classed("retagged", function(d2) {
63131         return base.entities[d2.id] && !(0, import_fast_deep_equal9.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
63132       }).call(svgTagClasses()).call(updateAttributes);
63133       var iconUse = groups.selectAll(".icon").data(function data(d2) {
63134         return zoom >= 17 && getIcon(d2) ? [d2] : [];
63135       }, fastEntityKey);
63136       iconUse.exit().remove();
63137       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
63138         var picon = getIcon(d2);
63139         return picon ? "#" + picon : "";
63140       });
63141       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
63142         return zoom >= 18 && getDirections(d2) ? [d2] : [];
63143       }, fastEntityKey);
63144       dgroups.exit().remove();
63145       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
63146       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
63147         return osmEntity.key(d2);
63148       });
63149       viewfields.exit().remove();
63150       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) {
63151         return "rotate(" + d2 + ")";
63152       });
63153     }
63154     function drawTargets(selection2, graph, entities, filter2) {
63155       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
63156       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
63157       var getTransform = svgPointTransform(projection2).geojson;
63158       var activeID = context.activeID();
63159       var data = { targets: [], nopes: [] };
63160       entities.forEach(function(node) {
63161         if (activeID === node.id) return;
63162         var vertexType = svgPassiveVertex(node, graph, activeID);
63163         if (vertexType !== 0) {
63164           data.targets.push({
63165             type: "Feature",
63166             id: node.id,
63167             properties: {
63168               target: true,
63169               entity: node
63170             },
63171             geometry: node.asGeoJSON()
63172           });
63173         } else {
63174           data.nopes.push({
63175             type: "Feature",
63176             id: node.id + "-nope",
63177             properties: {
63178               nope: true,
63179               target: true,
63180               entity: node
63181             },
63182             geometry: node.asGeoJSON()
63183           });
63184         }
63185       });
63186       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
63187         return filter2(d2.properties.entity);
63188       }).data(data.targets, function key(d2) {
63189         return d2.id;
63190       });
63191       targets.exit().remove();
63192       targets.enter().append("circle").attr("r", function(d2) {
63193         return _radii[d2.id] || radiuses.shadow[3];
63194       }).merge(targets).attr("class", function(d2) {
63195         return "node vertex target target-allowed " + targetClass + d2.id;
63196       }).attr("transform", getTransform);
63197       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
63198         return filter2(d2.properties.entity);
63199       }).data(data.nopes, function key(d2) {
63200         return d2.id;
63201       });
63202       nopes.exit().remove();
63203       nopes.enter().append("circle").attr("r", function(d2) {
63204         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
63205       }).merge(nopes).attr("class", function(d2) {
63206         return "node vertex target target-nope " + nopeClass + d2.id;
63207       }).attr("transform", getTransform);
63208     }
63209     function renderAsVertex(entity, graph, wireframe, zoom) {
63210       var geometry = entity.geometry(graph);
63211       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
63212     }
63213     function isEditedNode(node, base, head) {
63214       var baseNode = base.entities[node.id];
63215       var headNode = head.entities[node.id];
63216       return !headNode || !baseNode || !(0, import_fast_deep_equal9.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal9.default)(headNode.loc, baseNode.loc);
63217     }
63218     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
63219       var results = {};
63220       var seenIds = {};
63221       function addChildVertices(entity) {
63222         if (seenIds[entity.id]) return;
63223         seenIds[entity.id] = true;
63224         var geometry = entity.geometry(graph);
63225         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
63226           var i3;
63227           if (entity.type === "way") {
63228             for (i3 = 0; i3 < entity.nodes.length; i3++) {
63229               var child = graph.hasEntity(entity.nodes[i3]);
63230               if (child) {
63231                 addChildVertices(child);
63232               }
63233             }
63234           } else if (entity.type === "relation") {
63235             for (i3 = 0; i3 < entity.members.length; i3++) {
63236               var member = graph.hasEntity(entity.members[i3].id);
63237               if (member) {
63238                 addChildVertices(member);
63239               }
63240             }
63241           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
63242             results[entity.id] = entity;
63243           }
63244         }
63245       }
63246       ids.forEach(function(id2) {
63247         var entity = graph.hasEntity(id2);
63248         if (!entity) return;
63249         if (entity.type === "node") {
63250           if (renderAsVertex(entity, graph, wireframe, zoom)) {
63251             results[entity.id] = entity;
63252             graph.parentWays(entity).forEach(function(entity2) {
63253               addChildVertices(entity2);
63254             });
63255           }
63256         } else {
63257           addChildVertices(entity);
63258         }
63259       });
63260       return results;
63261     }
63262     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
63263       var wireframe = context.surface().classed("fill-wireframe");
63264       var visualDiff = context.surface().classed("highlight-edited");
63265       var zoom = geoScaleToZoom(projection2.scale());
63266       var mode = context.mode();
63267       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
63268       var base = context.history().base();
63269       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
63270       var touchLayer = selection2.selectAll(".layer-touch.points");
63271       if (fullRedraw) {
63272         _currPersistent = {};
63273         _radii = {};
63274       }
63275       for (var i3 = 0; i3 < entities.length; i3++) {
63276         var entity = entities[i3];
63277         var geometry = entity.geometry(graph);
63278         var keep = false;
63279         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
63280           _currPersistent[entity.id] = entity;
63281           keep = true;
63282         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
63283           _currPersistent[entity.id] = entity;
63284           keep = true;
63285         }
63286         if (!keep && !fullRedraw) {
63287           delete _currPersistent[entity.id];
63288         }
63289       }
63290       var sets2 = {
63291         persistent: _currPersistent,
63292         // persistent = important vertices (render always)
63293         selected: _currSelected,
63294         // selected + siblings of selected (render always)
63295         hovered: _currHover
63296         // hovered + siblings of hovered (render only in draw modes)
63297       };
63298       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
63299       var filterRendered = function(d2) {
63300         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
63301       };
63302       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
63303       var filterTouch = function(d2) {
63304         return isMoving ? true : filterRendered(d2);
63305       };
63306       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
63307       function currentVisible(which) {
63308         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
63309           return entity2 && entity2.intersects(extent, graph);
63310         });
63311       }
63312     }
63313     drawVertices.drawSelected = function(selection2, graph, extent) {
63314       var wireframe = context.surface().classed("fill-wireframe");
63315       var zoom = geoScaleToZoom(projection2.scale());
63316       _prevSelected = _currSelected || {};
63317       if (context.map().isInWideSelection()) {
63318         _currSelected = {};
63319         context.selectedIDs().forEach(function(id2) {
63320           var entity = graph.hasEntity(id2);
63321           if (!entity) return;
63322           if (entity.type === "node") {
63323             if (renderAsVertex(entity, graph, wireframe, zoom)) {
63324               _currSelected[entity.id] = entity;
63325             }
63326           }
63327         });
63328       } else {
63329         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
63330       }
63331       var filter2 = function(d2) {
63332         return d2.id in _prevSelected;
63333       };
63334       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
63335     };
63336     drawVertices.drawHover = function(selection2, graph, target, extent) {
63337       if (target === _currHoverTarget) return;
63338       var wireframe = context.surface().classed("fill-wireframe");
63339       var zoom = geoScaleToZoom(projection2.scale());
63340       _prevHover = _currHover || {};
63341       _currHoverTarget = target;
63342       var entity = target && target.properties && target.properties.entity;
63343       if (entity) {
63344         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
63345       } else {
63346         _currHover = {};
63347       }
63348       var filter2 = function(d2) {
63349         return d2.id in _prevHover;
63350       };
63351       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
63352     };
63353     return drawVertices;
63354   }
63355   var import_fast_deep_equal9;
63356   var init_vertices = __esm({
63357     "modules/svg/vertices.js"() {
63358       "use strict";
63359       import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
63360       init_src5();
63361       init_presets();
63362       init_geo2();
63363       init_osm();
63364       init_helpers();
63365       init_tag_classes();
63366     }
63367   });
63368
63369   // modules/svg/index.js
63370   var svg_exports = {};
63371   __export(svg_exports, {
63372     svgAreas: () => svgAreas,
63373     svgData: () => svgData,
63374     svgDebug: () => svgDebug,
63375     svgDefs: () => svgDefs,
63376     svgGeolocate: () => svgGeolocate,
63377     svgIcon: () => svgIcon,
63378     svgKartaviewImages: () => svgKartaviewImages,
63379     svgKeepRight: () => svgKeepRight,
63380     svgLabels: () => svgLabels,
63381     svgLayers: () => svgLayers,
63382     svgLines: () => svgLines,
63383     svgMapilioImages: () => svgMapilioImages,
63384     svgMapillaryImages: () => svgMapillaryImages,
63385     svgMapillarySigns: () => svgMapillarySigns,
63386     svgMarkerSegments: () => svgMarkerSegments,
63387     svgMidpoints: () => svgMidpoints,
63388     svgNotes: () => svgNotes,
63389     svgOsm: () => svgOsm,
63390     svgPanoramaxImages: () => svgPanoramaxImages,
63391     svgPassiveVertex: () => svgPassiveVertex,
63392     svgPath: () => svgPath,
63393     svgPointTransform: () => svgPointTransform,
63394     svgPoints: () => svgPoints,
63395     svgRelationMemberTags: () => svgRelationMemberTags,
63396     svgSegmentWay: () => svgSegmentWay,
63397     svgStreetside: () => svgStreetside,
63398     svgTagClasses: () => svgTagClasses,
63399     svgTagPattern: () => svgTagPattern,
63400     svgTouch: () => svgTouch,
63401     svgTurns: () => svgTurns,
63402     svgVegbilder: () => svgVegbilder,
63403     svgVertices: () => svgVertices
63404   });
63405   var init_svg = __esm({
63406     "modules/svg/index.js"() {
63407       "use strict";
63408       init_areas();
63409       init_data2();
63410       init_debug();
63411       init_defs();
63412       init_keepRight2();
63413       init_icon();
63414       init_geolocate();
63415       init_labels();
63416       init_layers();
63417       init_lines();
63418       init_mapillary_images();
63419       init_mapillary_signs();
63420       init_midpoints();
63421       init_notes();
63422       init_helpers();
63423       init_kartaview_images();
63424       init_osm3();
63425       init_helpers();
63426       init_helpers();
63427       init_helpers();
63428       init_points();
63429       init_helpers();
63430       init_helpers();
63431       init_streetside2();
63432       init_vegbilder2();
63433       init_tag_classes();
63434       init_tag_pattern();
63435       init_touch();
63436       init_turns();
63437       init_vertices();
63438       init_mapilio_images();
63439       init_panoramax_images();
63440     }
63441   });
63442
63443   // modules/ui/length_indicator.js
63444   var length_indicator_exports = {};
63445   __export(length_indicator_exports, {
63446     uiLengthIndicator: () => uiLengthIndicator
63447   });
63448   function uiLengthIndicator(maxChars) {
63449     var _wrap = select_default2(null);
63450     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
63451       selection2.text("");
63452       selection2.call(svgIcon("#iD-icon-alert", "inline"));
63453       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
63454     });
63455     var _silent = false;
63456     var lengthIndicator = function(selection2) {
63457       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
63458       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
63459       selection2.call(_tooltip);
63460     };
63461     lengthIndicator.update = function(val) {
63462       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
63463       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
63464       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");
63465       if (_silent) return;
63466       if (strLen > maxChars) {
63467         _tooltip.show();
63468       } else {
63469         _tooltip.hide();
63470       }
63471     };
63472     lengthIndicator.silent = function(val) {
63473       if (!arguments.length) return _silent;
63474       _silent = val;
63475       return lengthIndicator;
63476     };
63477     return lengthIndicator;
63478   }
63479   var init_length_indicator = __esm({
63480     "modules/ui/length_indicator.js"() {
63481       "use strict";
63482       init_src5();
63483       init_localizer();
63484       init_svg();
63485       init_util();
63486       init_popover();
63487     }
63488   });
63489
63490   // modules/ui/fields/combo.js
63491   var combo_exports = {};
63492   __export(combo_exports, {
63493     uiFieldCombo: () => uiFieldCombo,
63494     uiFieldManyCombo: () => uiFieldCombo,
63495     uiFieldMultiCombo: () => uiFieldCombo,
63496     uiFieldNetworkCombo: () => uiFieldCombo,
63497     uiFieldSemiCombo: () => uiFieldCombo,
63498     uiFieldTypeCombo: () => uiFieldCombo
63499   });
63500   function uiFieldCombo(field, context) {
63501     var dispatch14 = dispatch_default("change");
63502     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
63503     var _isNetwork = field.type === "networkCombo";
63504     var _isSemi = field.type === "semiCombo";
63505     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
63506     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
63507     var _snake_case = field.snake_case || field.snake_case === void 0;
63508     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
63509     var _container = select_default2(null);
63510     var _inputWrap = select_default2(null);
63511     var _input = select_default2(null);
63512     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
63513     var _comboData = [];
63514     var _multiData = [];
63515     var _entityIDs = [];
63516     var _tags;
63517     var _countryCode;
63518     var _staticPlaceholder;
63519     var _customOptions = [];
63520     var _dataDeprecated = [];
63521     _mainFileFetcher.get("deprecated").then(function(d2) {
63522       _dataDeprecated = d2;
63523     }).catch(function() {
63524     });
63525     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
63526       field.key += ":";
63527     }
63528     function snake(s2) {
63529       return s2.replace(/\s+/g, "_");
63530     }
63531     function clean2(s2) {
63532       return s2.split(";").map(function(s3) {
63533         return s3.trim();
63534       }).join(";");
63535     }
63536     function tagValue(dval) {
63537       dval = clean2(dval || "");
63538       var found = getOptions(true).find(function(o2) {
63539         return o2.key && clean2(o2.value) === dval;
63540       });
63541       if (found) return found.key;
63542       if (field.type === "typeCombo" && !dval) {
63543         return "yes";
63544       }
63545       return restrictTagValueSpelling(dval) || void 0;
63546     }
63547     function restrictTagValueSpelling(dval) {
63548       if (_snake_case) {
63549         dval = snake(dval);
63550       }
63551       if (!field.caseSensitive) {
63552         dval = dval.toLowerCase();
63553       }
63554       return dval;
63555     }
63556     function getLabelId(field2, v3) {
63557       return field2.hasTextForStringId(`options.${v3}.title`) ? `options.${v3}.title` : `options.${v3}`;
63558     }
63559     function displayValue(tval) {
63560       tval = tval || "";
63561       var stringsField = field.resolveReference("stringsCrossReference");
63562       const labelId = getLabelId(stringsField, tval);
63563       if (stringsField.hasTextForStringId(labelId)) {
63564         return stringsField.t(labelId, { default: tval });
63565       }
63566       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
63567         return "";
63568       }
63569       return tval;
63570     }
63571     function renderValue(tval) {
63572       tval = tval || "";
63573       var stringsField = field.resolveReference("stringsCrossReference");
63574       const labelId = getLabelId(stringsField, tval);
63575       if (stringsField.hasTextForStringId(labelId)) {
63576         return stringsField.t.append(labelId, { default: tval });
63577       }
63578       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
63579         tval = "";
63580       }
63581       return (selection2) => selection2.text(tval);
63582     }
63583     function objectDifference(a4, b3) {
63584       return a4.filter(function(d1) {
63585         return !b3.some(function(d2) {
63586           return d1.value === d2.value;
63587         });
63588       });
63589     }
63590     function initCombo(selection2, attachTo) {
63591       if (!_allowCustomValues) {
63592         selection2.attr("readonly", "readonly");
63593       }
63594       if (_showTagInfoSuggestions && services.taginfo) {
63595         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
63596         setTaginfoValues("", setPlaceholder);
63597       } else {
63598         selection2.call(_combobox, attachTo);
63599         setTimeout(() => setStaticValues(setPlaceholder), 0);
63600       }
63601     }
63602     function getOptions(allOptions) {
63603       var stringsField = field.resolveReference("stringsCrossReference");
63604       if (!(field.options || stringsField.options)) return [];
63605       let options;
63606       if (allOptions !== true) {
63607         options = field.options || stringsField.options;
63608       } else {
63609         options = [].concat(field.options, stringsField.options).filter(Boolean);
63610       }
63611       const result = options.map(function(v3) {
63612         const labelId = getLabelId(stringsField, v3);
63613         return {
63614           key: v3,
63615           value: stringsField.t(labelId, { default: v3 }),
63616           title: stringsField.t(`options.${v3}.description`, { default: v3 }),
63617           display: addComboboxIcons(stringsField.t.append(labelId, { default: v3 }), v3),
63618           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
63619         };
63620       });
63621       return [...result, ..._customOptions];
63622     }
63623     function hasStaticValues() {
63624       return getOptions().length > 0;
63625     }
63626     function setStaticValues(callback, filter2) {
63627       _comboData = getOptions();
63628       if (filter2 !== void 0) {
63629         _comboData = _comboData.filter(filter2);
63630       }
63631       _comboData = objectDifference(_comboData, _multiData);
63632       _combobox.data(_comboData);
63633       _container.classed("empty-combobox", _comboData.length === 0);
63634       if (callback) callback(_comboData);
63635     }
63636     function setTaginfoValues(q3, callback) {
63637       var queryFilter = (d2) => d2.value.toLowerCase().includes(q3.toLowerCase()) || d2.key.toLowerCase().includes(q3.toLowerCase());
63638       if (hasStaticValues()) {
63639         setStaticValues(callback, queryFilter);
63640       }
63641       var stringsField = field.resolveReference("stringsCrossReference");
63642       var fn = _isMulti ? "multikeys" : "values";
63643       var query = (_isMulti ? field.key : "") + q3;
63644       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q3.toLowerCase()) === 0;
63645       if (hasCountryPrefix) {
63646         query = _countryCode + ":";
63647       }
63648       var params = {
63649         debounce: q3 !== "",
63650         key: field.key,
63651         query
63652       };
63653       if (_entityIDs.length) {
63654         params.geometry = context.graph().geometry(_entityIDs[0]);
63655       }
63656       services.taginfo[fn](params, function(err, data) {
63657         if (err) return;
63658         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
63659         data = data.filter((d2) => {
63660           var value = d2.value;
63661           if (_isMulti) {
63662             value = value.slice(field.key.length);
63663           }
63664           return value === restrictTagValueSpelling(value);
63665         });
63666         var deprecatedValues = deprecatedTagValuesByKey(_dataDeprecated)[field.key];
63667         if (deprecatedValues) {
63668           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
63669         }
63670         if (hasCountryPrefix) {
63671           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
63672         }
63673         const additionalOptions = (field.options || stringsField.options || []).filter((v3) => !data.some((dv) => dv.value === (_isMulti ? field.key + v3 : v3))).map((v3) => ({ value: v3 }));
63674         _container.classed("empty-combobox", data.length === 0);
63675         _comboData = data.concat(additionalOptions).map(function(d2) {
63676           var v3 = d2.value;
63677           if (_isMulti) v3 = v3.replace(field.key, "");
63678           const labelId = getLabelId(stringsField, v3);
63679           var isLocalizable = stringsField.hasTextForStringId(labelId);
63680           var label = stringsField.t(labelId, { default: v3 });
63681           return {
63682             key: v3,
63683             value: label,
63684             title: stringsField.t(`options.${v3}.description`, { default: isLocalizable ? v3 : d2.title !== label ? d2.title : "" }),
63685             display: addComboboxIcons(stringsField.t.append(labelId, { default: v3 }), v3),
63686             klass: isLocalizable ? "" : "raw-option"
63687           };
63688         });
63689         _comboData = _comboData.filter(queryFilter);
63690         _comboData = objectDifference(_comboData, _multiData);
63691         if (callback) callback(_comboData, hasStaticValues());
63692       });
63693     }
63694     function addComboboxIcons(disp, value) {
63695       const iconsField = field.resolveReference("iconsCrossReference");
63696       if (iconsField.icons) {
63697         return function(selection2) {
63698           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
63699           if (iconsField.icons[value]) {
63700             span.call(svgIcon(`#${iconsField.icons[value]}`));
63701           }
63702           disp.call(this, selection2);
63703         };
63704       }
63705       return disp;
63706     }
63707     function setPlaceholder(values) {
63708       if (_isMulti || _isSemi) {
63709         _staticPlaceholder = field.placeholder() || _t("inspector.add");
63710       } else {
63711         var vals = values.map(function(d2) {
63712           return d2.value;
63713         }).filter(function(s2) {
63714           return s2.length < 20;
63715         });
63716         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
63717           return d2.key;
63718         });
63719         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
63720       }
63721       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
63722         _staticPlaceholder += "\u2026";
63723       }
63724       var ph;
63725       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
63726         ph = _t("inspector.multiple_values");
63727       } else {
63728         ph = _staticPlaceholder;
63729       }
63730       _container.selectAll("input").attr("placeholder", ph);
63731       var hideAdd = !_allowCustomValues && !values.length;
63732       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
63733     }
63734     function change() {
63735       var t2 = {};
63736       var val;
63737       if (_isMulti || _isSemi) {
63738         var vals;
63739         if (_isMulti) {
63740           vals = [tagValue(utilGetSetValue(_input))];
63741         } else if (_isSemi) {
63742           val = tagValue(utilGetSetValue(_input)) || "";
63743           val = val.replace(/,/g, ";");
63744           vals = val.split(";");
63745         }
63746         vals = vals.filter(Boolean);
63747         if (!vals.length) return;
63748         _container.classed("active", false);
63749         utilGetSetValue(_input, "");
63750         if (_isMulti) {
63751           utilArrayUniq(vals).forEach(function(v3) {
63752             var key = (field.key || "") + v3;
63753             if (_tags) {
63754               var old = _tags[key];
63755               if (typeof old === "string" && old.toLowerCase() !== "no") return;
63756             }
63757             key = context.cleanTagKey(key);
63758             field.keys.push(key);
63759             t2[key] = "yes";
63760           });
63761         } else if (_isSemi) {
63762           var arr = _multiData.map(function(d2) {
63763             return d2.key;
63764           });
63765           arr = arr.concat(vals);
63766           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
63767         }
63768         window.setTimeout(function() {
63769           _input.node().focus();
63770         }, 10);
63771       } else {
63772         var rawValue = utilGetSetValue(_input);
63773         if (!rawValue && Array.isArray(_tags[field.key])) return;
63774         val = context.cleanTagValue(tagValue(rawValue));
63775         t2[field.key] = val || void 0;
63776       }
63777       dispatch14.call("change", this, t2);
63778     }
63779     function removeMultikey(d3_event, d2) {
63780       d3_event.preventDefault();
63781       d3_event.stopPropagation();
63782       var t2 = {};
63783       if (_isMulti) {
63784         t2[d2.key] = void 0;
63785       } else if (_isSemi) {
63786         var arr = _multiData.map(function(md) {
63787           return md.key === d2.key ? null : md.key;
63788         }).filter(Boolean);
63789         arr = utilArrayUniq(arr);
63790         t2[field.key] = arr.length ? arr.join(";") : void 0;
63791         _lengthIndicator.update(t2[field.key]);
63792       }
63793       dispatch14.call("change", this, t2);
63794     }
63795     function invertMultikey(d3_event, d2) {
63796       d3_event.preventDefault();
63797       d3_event.stopPropagation();
63798       var t2 = {};
63799       if (_isMulti) {
63800         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
63801       }
63802       dispatch14.call("change", this, t2);
63803     }
63804     function combo(selection2) {
63805       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
63806       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
63807       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
63808       if (_isMulti || _isSemi) {
63809         _container = _container.selectAll(".chiplist").data([0]);
63810         var listClass = "chiplist";
63811         if (field.key === "destination" || field.key === "via") {
63812           listClass += " full-line-chips";
63813         }
63814         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
63815           window.setTimeout(function() {
63816             _input.node().focus();
63817           }, 10);
63818         }).merge(_container);
63819         _inputWrap = _container.selectAll(".input-wrap").data([0]);
63820         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
63821         var hideAdd = !_allowCustomValues && !_comboData.length;
63822         _inputWrap.style("display", hideAdd ? "none" : null);
63823         _input = _inputWrap.selectAll("input").data([0]);
63824       } else {
63825         _input = _container.selectAll("input").data([0]);
63826       }
63827       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
63828       if (_isSemi) {
63829         _inputWrap.call(_lengthIndicator);
63830       } else if (!_isMulti) {
63831         _container.call(_lengthIndicator);
63832       }
63833       if (_isNetwork) {
63834         var extent = combinedEntityExtent();
63835         var countryCode = extent && iso1A2Code(extent.center());
63836         _countryCode = countryCode && countryCode.toLowerCase();
63837       }
63838       _input.on("change", change).on("blur", change).on("input", function() {
63839         let val = utilGetSetValue(_input);
63840         updateIcon(val);
63841         if (_isSemi && _tags[field.key]) {
63842           val += ";" + _tags[field.key];
63843         }
63844         _lengthIndicator.update(val);
63845       });
63846       _input.on("keydown.field", function(d3_event) {
63847         switch (d3_event.keyCode) {
63848           case 13:
63849             _input.node().blur();
63850             d3_event.stopPropagation();
63851             break;
63852         }
63853       });
63854       if (_isMulti || _isSemi) {
63855         _combobox.on("accept", function() {
63856           _input.node().blur();
63857           _input.node().focus();
63858         });
63859         _input.on("focus", function() {
63860           _container.classed("active", true);
63861         });
63862       }
63863       _combobox.on("cancel", function() {
63864         _input.node().blur();
63865       }).on("update", function() {
63866         updateIcon(utilGetSetValue(_input));
63867       });
63868     }
63869     function updateIcon(value) {
63870       value = tagValue(value);
63871       let container = _container;
63872       if (field.type === "multiCombo" || field.type === "semiCombo") {
63873         container = _container.select(".input-wrap");
63874       }
63875       const iconsField = field.resolveReference("iconsCrossReference");
63876       if (iconsField.icons) {
63877         container.selectAll(".tag-value-icon").remove();
63878         if (iconsField.icons[value]) {
63879           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
63880         }
63881       }
63882     }
63883     combo.tags = function(tags) {
63884       _tags = tags;
63885       var stringsField = field.resolveReference("stringsCrossReference");
63886       var isMixed = Array.isArray(tags[field.key]);
63887       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
63888       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
63889       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
63890       var isReadOnly = !_allowCustomValues;
63891       if (_isMulti || _isSemi) {
63892         _multiData = [];
63893         var maxLength;
63894         if (_isMulti) {
63895           for (var k3 in tags) {
63896             if (field.key && k3.indexOf(field.key) !== 0) continue;
63897             if (!field.key && field.keys.indexOf(k3) === -1) continue;
63898             var v3 = tags[k3];
63899             var suffix = field.key ? k3.slice(field.key.length) : k3;
63900             _multiData.push({
63901               key: k3,
63902               value: displayValue(suffix),
63903               display: addComboboxIcons(renderValue(suffix), suffix),
63904               state: typeof v3 === "string" ? v3.toLowerCase() : "",
63905               isMixed: Array.isArray(v3)
63906             });
63907           }
63908           if (field.key) {
63909             field.keys = _multiData.map(function(d2) {
63910               return d2.key;
63911             });
63912             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
63913           } else {
63914             maxLength = context.maxCharsForTagKey();
63915           }
63916         } else if (_isSemi) {
63917           var allValues = [];
63918           var commonValues;
63919           if (Array.isArray(tags[field.key])) {
63920             tags[field.key].forEach(function(tagVal) {
63921               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
63922               allValues = allValues.concat(thisVals);
63923               if (!commonValues) {
63924                 commonValues = thisVals;
63925               } else {
63926                 commonValues = commonValues.filter((value) => thisVals.includes(value));
63927               }
63928             });
63929             allValues = utilArrayUniq(allValues).filter(Boolean);
63930           } else {
63931             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
63932             commonValues = allValues;
63933           }
63934           _multiData = allValues.map(function(v4) {
63935             return {
63936               key: v4,
63937               value: displayValue(v4),
63938               display: addComboboxIcons(renderValue(v4), v4),
63939               isMixed: !commonValues.includes(v4)
63940             };
63941           });
63942           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
63943           maxLength = context.maxCharsForTagValue() - currLength;
63944           if (currLength > 0) {
63945             maxLength -= 1;
63946           }
63947         }
63948         maxLength = Math.max(0, maxLength);
63949         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
63950         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
63951         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
63952         var chips = _container.selectAll(".chip").data(_multiData);
63953         chips.exit().remove();
63954         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
63955         enter.append("span");
63956         const field_buttons = enter.append("div").attr("class", "field_buttons");
63957         field_buttons.append("a").attr("class", "remove");
63958         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
63959           var k4 = d2.key;
63960           if (_isMulti) k4 = k4.replace(field.key, "");
63961           return !stringsField.hasTextForStringId("options." + k4);
63962         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
63963           return d2.isMixed;
63964         }).attr("title", function(d2) {
63965           if (d2.isMixed) {
63966             return _t("inspector.unshared_value_tooltip");
63967           }
63968           if (!["yes", "no"].includes(d2.state)) {
63969             return d2.state;
63970           }
63971           return null;
63972         }).classed("negated", (d2) => d2.state === "no");
63973         if (!_isSemi) {
63974           chips.selectAll("input[type=checkbox]").remove();
63975           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);
63976         }
63977         if (allowDragAndDrop) {
63978           registerDragAndDrop(chips);
63979         }
63980         chips.each(function(d2) {
63981           const selection2 = select_default2(this);
63982           const text_span = selection2.select("span");
63983           const field_buttons2 = selection2.select(".field_buttons");
63984           const clean_value = d2.value.trim();
63985           text_span.text("");
63986           if (!field_buttons2.select("button").empty()) {
63987             field_buttons2.select("button").remove();
63988           }
63989           if (clean_value.startsWith("https://")) {
63990             text_span.text(clean_value);
63991             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) {
63992               d3_event.preventDefault();
63993               window.open(clean_value, "_blank");
63994             });
63995             return;
63996           }
63997           if (d2.display) {
63998             d2.display(text_span);
63999             return;
64000           }
64001           text_span.text(d2.value);
64002         });
64003         chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
64004         updateIcon("");
64005       } else {
64006         var mixedValues = isMixed && tags[field.key].map(function(val) {
64007           return displayValue(val);
64008         }).filter(Boolean);
64009         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) {
64010           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
64011             d3_event.preventDefault();
64012             d3_event.stopPropagation();
64013             var t2 = {};
64014             t2[field.key] = void 0;
64015             dispatch14.call("change", this, t2);
64016           }
64017         });
64018         if (!Array.isArray(tags[field.key])) {
64019           updateIcon(tags[field.key]);
64020         }
64021         if (!isMixed) {
64022           _lengthIndicator.update(tags[field.key]);
64023         }
64024       }
64025       const refreshStyles = () => {
64026         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
64027       };
64028       _input.on("input.refreshStyles", refreshStyles);
64029       _combobox.on("update.refreshStyles", refreshStyles);
64030       refreshStyles();
64031     };
64032     function registerDragAndDrop(selection2) {
64033       var dragOrigin, targetIndex;
64034       selection2.call(
64035         drag_default().on("start", function(d3_event) {
64036           dragOrigin = {
64037             x: d3_event.x,
64038             y: d3_event.y
64039           };
64040           targetIndex = null;
64041         }).on("drag", function(d3_event) {
64042           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
64043           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
64044           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
64045           var index = selection2.nodes().indexOf(this);
64046           select_default2(this).classed("dragging", true);
64047           targetIndex = null;
64048           var targetIndexOffsetTop = null;
64049           var draggedTagWidth = select_default2(this).node().offsetWidth;
64050           if (field.key === "destination" || field.key === "via") {
64051             _container.selectAll(".chip").style("transform", function(d2, index2) {
64052               var node = select_default2(this).node();
64053               if (index === index2) {
64054                 return "translate(" + x2 + "px, " + y2 + "px)";
64055               } else if (index2 > index && d3_event.y > node.offsetTop) {
64056                 if (targetIndex === null || index2 > targetIndex) {
64057                   targetIndex = index2;
64058                 }
64059                 return "translateY(-100%)";
64060               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
64061                 if (targetIndex === null || index2 < targetIndex) {
64062                   targetIndex = index2;
64063                 }
64064                 return "translateY(100%)";
64065               }
64066               return null;
64067             });
64068           } else {
64069             _container.selectAll(".chip").each(function(d2, index2) {
64070               var node = select_default2(this).node();
64071               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) {
64072                 targetIndex = index2;
64073                 targetIndexOffsetTop = node.offsetTop;
64074               }
64075             }).style("transform", function(d2, index2) {
64076               var node = select_default2(this).node();
64077               if (index === index2) {
64078                 return "translate(" + x2 + "px, " + y2 + "px)";
64079               }
64080               if (node.offsetTop === targetIndexOffsetTop) {
64081                 if (index2 < index && index2 >= targetIndex) {
64082                   return "translateX(" + draggedTagWidth + "px)";
64083                 } else if (index2 > index && index2 <= targetIndex) {
64084                   return "translateX(-" + draggedTagWidth + "px)";
64085                 }
64086               }
64087               return null;
64088             });
64089           }
64090         }).on("end", function() {
64091           if (!select_default2(this).classed("dragging")) {
64092             return;
64093           }
64094           var index = selection2.nodes().indexOf(this);
64095           select_default2(this).classed("dragging", false);
64096           _container.selectAll(".chip").style("transform", null);
64097           if (typeof targetIndex === "number") {
64098             var element = _multiData[index];
64099             _multiData.splice(index, 1);
64100             _multiData.splice(targetIndex, 0, element);
64101             var t2 = {};
64102             if (_multiData.length) {
64103               t2[field.key] = _multiData.map(function(element2) {
64104                 return element2.key;
64105               }).join(";");
64106             } else {
64107               t2[field.key] = void 0;
64108             }
64109             dispatch14.call("change", this, t2);
64110           }
64111           dragOrigin = void 0;
64112           targetIndex = void 0;
64113         })
64114       );
64115     }
64116     combo.setCustomOptions = (newValue) => {
64117       _customOptions = newValue;
64118     };
64119     combo.focus = function() {
64120       _input.node().focus();
64121     };
64122     combo.entityIDs = function(val) {
64123       if (!arguments.length) return _entityIDs;
64124       _entityIDs = val;
64125       return combo;
64126     };
64127     function combinedEntityExtent() {
64128       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64129     }
64130     return utilRebind(combo, dispatch14, "on");
64131   }
64132   var init_combo = __esm({
64133     "modules/ui/fields/combo.js"() {
64134       "use strict";
64135       init_src4();
64136       init_src5();
64137       init_src6();
64138       init_country_coder();
64139       init_file_fetcher();
64140       init_localizer();
64141       init_services();
64142       init_combobox();
64143       init_icon();
64144       init_keybinding();
64145       init_util();
64146       init_length_indicator();
64147       init_deprecated();
64148     }
64149   });
64150
64151   // modules/behavior/hash.js
64152   var hash_exports = {};
64153   __export(hash_exports, {
64154     behaviorHash: () => behaviorHash
64155   });
64156   function behaviorHash(context) {
64157     var _cachedHash = null;
64158     var _latitudeLimit = 90 - 1e-8;
64159     function computedHashParameters() {
64160       var map2 = context.map();
64161       var center = map2.center();
64162       var zoom = map2.zoom();
64163       var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
64164       var oldParams = utilObjectOmit(
64165         utilStringQs(window.location.hash),
64166         ["comment", "source", "hashtags", "walkthrough"]
64167       );
64168       var newParams = {};
64169       delete oldParams.id;
64170       var selected = context.selectedIDs().filter(function(id2) {
64171         return context.hasEntity(id2);
64172       });
64173       if (selected.length) {
64174         newParams.id = selected.join(",");
64175       } else if (context.selectedNoteID()) {
64176         newParams.id = `note/${context.selectedNoteID()}`;
64177       }
64178       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
64179       return Object.assign(oldParams, newParams);
64180     }
64181     function computedHash() {
64182       return "#" + utilQsString(computedHashParameters(), true);
64183     }
64184     function computedTitle(includeChangeCount) {
64185       var baseTitle = context.documentTitleBase() || "iD";
64186       var contextual;
64187       var changeCount;
64188       var titleID;
64189       var selected = context.selectedIDs().filter(function(id2) {
64190         return context.hasEntity(id2);
64191       });
64192       if (selected.length) {
64193         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
64194         if (selected.length > 1) {
64195           contextual = _t("title.labeled_and_more", {
64196             labeled: firstLabel,
64197             count: selected.length - 1
64198           });
64199         } else {
64200           contextual = firstLabel;
64201         }
64202         titleID = "context";
64203       }
64204       if (includeChangeCount) {
64205         changeCount = context.history().difference().summary().length;
64206         if (changeCount > 0) {
64207           titleID = contextual ? "changes_context" : "changes";
64208         }
64209       }
64210       if (titleID) {
64211         return _t("title.format." + titleID, {
64212           changes: changeCount,
64213           base: baseTitle,
64214           context: contextual
64215         });
64216       }
64217       return baseTitle;
64218     }
64219     function updateTitle(includeChangeCount) {
64220       if (!context.setsDocumentTitle()) return;
64221       var newTitle = computedTitle(includeChangeCount);
64222       if (document.title !== newTitle) {
64223         document.title = newTitle;
64224       }
64225     }
64226     function updateHashIfNeeded() {
64227       if (context.inIntro()) return;
64228       var latestHash = computedHash();
64229       if (_cachedHash !== latestHash) {
64230         _cachedHash = latestHash;
64231         window.history.replaceState(null, "", latestHash);
64232         updateTitle(
64233           true
64234           /* includeChangeCount */
64235         );
64236         const q3 = utilStringQs(latestHash);
64237         if (q3.map) {
64238           corePreferences("map-location", q3.map);
64239         }
64240       }
64241     }
64242     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
64243     var _throttledUpdateTitle = throttle_default(function() {
64244       updateTitle(
64245         true
64246         /* includeChangeCount */
64247       );
64248     }, 500);
64249     function hashchange() {
64250       if (window.location.hash === _cachedHash) return;
64251       _cachedHash = window.location.hash;
64252       var q3 = utilStringQs(_cachedHash);
64253       var mapArgs = (q3.map || "").split("/").map(Number);
64254       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
64255         updateHashIfNeeded();
64256       } else {
64257         if (_cachedHash === computedHash()) return;
64258         var mode = context.mode();
64259         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
64260         if (q3.id && mode) {
64261           var ids = q3.id.split(",").filter(function(id2) {
64262             return context.hasEntity(id2) || id2.startsWith("note/");
64263           });
64264           if (ids.length && ["browse", "select-note", "select"].includes(mode.id)) {
64265             if (ids.length === 1 && ids[0].startsWith("note/")) {
64266               context.enter(modeSelectNote(context, ids[0]));
64267             } else if (!utilArrayIdentical(mode.selectedIDs(), ids)) {
64268               context.enter(modeSelect(context, ids));
64269             }
64270             return;
64271           }
64272         }
64273         var center = context.map().center();
64274         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
64275         var maxdist = 500;
64276         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
64277           context.enter(modeBrowse(context));
64278           return;
64279         }
64280       }
64281     }
64282     function behavior() {
64283       context.map().on("move.behaviorHash", _throttledUpdate);
64284       context.history().on("change.behaviorHash", _throttledUpdateTitle);
64285       context.on("enter.behaviorHash", _throttledUpdate);
64286       select_default2(window).on("hashchange.behaviorHash", hashchange);
64287       var q3 = utilStringQs(window.location.hash);
64288       if (q3.id) {
64289         const selectIds = q3.id.split(",");
64290         if (selectIds.length === 1 && selectIds[0].startsWith("note/")) {
64291           const noteId = selectIds[0].split("/")[1];
64292           context.moveToNote(noteId, !q3.map);
64293         } else {
64294           context.zoomToEntities(
64295             // convert ids to short form id: node/123 -> n123
64296             selectIds.map((id2) => id2.replace(/([nwr])[^/]*\//, "$1")),
64297             !q3.map
64298           );
64299         }
64300       }
64301       if (q3.walkthrough === "true") {
64302         behavior.startWalkthrough = true;
64303       }
64304       if (q3.map) {
64305         behavior.hadLocation = true;
64306       } else if (!q3.id && corePreferences("map-location")) {
64307         const mapArgs = corePreferences("map-location").split("/").map(Number);
64308         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
64309         updateHashIfNeeded();
64310         behavior.hadLocation = true;
64311       }
64312       hashchange();
64313       updateTitle(false);
64314     }
64315     behavior.off = function() {
64316       _throttledUpdate.cancel();
64317       _throttledUpdateTitle.cancel();
64318       context.map().on("move.behaviorHash", null);
64319       context.on("enter.behaviorHash", null);
64320       select_default2(window).on("hashchange.behaviorHash", null);
64321       window.location.hash = "";
64322     };
64323     return behavior;
64324   }
64325   var init_hash = __esm({
64326     "modules/behavior/hash.js"() {
64327       "use strict";
64328       init_throttle();
64329       init_src5();
64330       init_geo2();
64331       init_browse();
64332       init_modes2();
64333       init_util();
64334       init_array3();
64335       init_utilDisplayLabel();
64336       init_localizer();
64337       init_preferences();
64338     }
64339   });
64340
64341   // modules/behavior/index.js
64342   var behavior_exports = {};
64343   __export(behavior_exports, {
64344     behaviorAddWay: () => behaviorAddWay,
64345     behaviorBreathe: () => behaviorBreathe,
64346     behaviorDrag: () => behaviorDrag,
64347     behaviorDraw: () => behaviorDraw,
64348     behaviorDrawWay: () => behaviorDrawWay,
64349     behaviorEdit: () => behaviorEdit,
64350     behaviorHash: () => behaviorHash,
64351     behaviorHover: () => behaviorHover,
64352     behaviorLasso: () => behaviorLasso,
64353     behaviorOperation: () => behaviorOperation,
64354     behaviorPaste: () => behaviorPaste,
64355     behaviorSelect: () => behaviorSelect
64356   });
64357   var init_behavior = __esm({
64358     "modules/behavior/index.js"() {
64359       "use strict";
64360       init_add_way();
64361       init_breathe();
64362       init_drag2();
64363       init_draw_way();
64364       init_draw();
64365       init_edit();
64366       init_hash();
64367       init_hover();
64368       init_lasso2();
64369       init_operation();
64370       init_paste();
64371       init_select4();
64372     }
64373   });
64374
64375   // modules/ui/account.js
64376   var account_exports = {};
64377   __export(account_exports, {
64378     uiAccount: () => uiAccount
64379   });
64380   function uiAccount(context) {
64381     const osm = context.connection();
64382     function updateUserDetails(selection2) {
64383       if (!osm) return;
64384       if (!osm.authenticated()) {
64385         render(selection2, null);
64386       } else {
64387         osm.userDetails((err, user) => {
64388           if (err && err.status === 401) {
64389             osm.logout();
64390           }
64391           render(selection2, user);
64392         });
64393       }
64394     }
64395     function render(selection2, user) {
64396       let userInfo = selection2.select(".userInfo");
64397       let loginLogout = selection2.select(".loginLogout");
64398       if (user) {
64399         userInfo.html("").classed("hide", false);
64400         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
64401         if (user.image_url) {
64402           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
64403         } else {
64404           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
64405         }
64406         userLink.append("span").attr("class", "label").text(user.display_name);
64407         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
64408           e3.preventDefault();
64409           osm.logout();
64410           osm.authenticate(void 0, { switchUser: true });
64411         });
64412       } else {
64413         userInfo.html("").classed("hide", true);
64414         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
64415           e3.preventDefault();
64416           osm.authenticate();
64417         });
64418       }
64419     }
64420     return function(selection2) {
64421       if (!osm) return;
64422       selection2.append("li").attr("class", "userInfo").classed("hide", true);
64423       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
64424       osm.on("change.account", () => updateUserDetails(selection2));
64425       updateUserDetails(selection2);
64426     };
64427   }
64428   var init_account = __esm({
64429     "modules/ui/account.js"() {
64430       "use strict";
64431       init_localizer();
64432       init_icon();
64433     }
64434   });
64435
64436   // modules/ui/attribution.js
64437   var attribution_exports = {};
64438   __export(attribution_exports, {
64439     uiAttribution: () => uiAttribution
64440   });
64441   function uiAttribution(context) {
64442     let _selection = select_default2(null);
64443     function render(selection2, data, klass) {
64444       let div = selection2.selectAll(`.${klass}`).data([0]);
64445       div = div.enter().append("div").attr("class", klass).merge(div);
64446       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
64447       attributions.exit().remove();
64448       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
64449         let attribution = select_default2(nodes[i3]);
64450         if (d2.terms_html) {
64451           attribution.html(d2.terms_html);
64452           return;
64453         }
64454         if (d2.terms_url) {
64455           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
64456         }
64457         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
64458         const terms_text = _t(
64459           `imagery.${sourceID}.attribution.text`,
64460           { default: d2.terms_text || d2.id || d2.name() }
64461         );
64462         if (d2.icon && !d2.overlay) {
64463           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
64464         }
64465         attribution.append("span").attr("class", "attribution-text").text(terms_text);
64466       }).merge(attributions);
64467       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
64468         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
64469         return notice ? [notice] : [];
64470       });
64471       copyright.exit().remove();
64472       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
64473       copyright.text(String);
64474     }
64475     function update() {
64476       let baselayer = context.background().baseLayerSource();
64477       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
64478       const z3 = context.map().zoom();
64479       let overlays = context.background().overlayLayerSources() || [];
64480       _selection.call(render, overlays.filter((s2) => s2.validZoom(z3)), "overlay-layer-attribution");
64481     }
64482     return function(selection2) {
64483       _selection = selection2;
64484       context.background().on("change.attribution", update);
64485       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
64486       update();
64487     };
64488   }
64489   var init_attribution = __esm({
64490     "modules/ui/attribution.js"() {
64491       "use strict";
64492       init_throttle();
64493       init_src5();
64494       init_localizer();
64495     }
64496   });
64497
64498   // modules/ui/contributors.js
64499   var contributors_exports = {};
64500   __export(contributors_exports, {
64501     uiContributors: () => uiContributors
64502   });
64503   function uiContributors(context) {
64504     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
64505       update();
64506     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
64507     function update() {
64508       if (!osm) return;
64509       var users = {}, entities = context.history().intersects(context.map().extent());
64510       entities.forEach(function(entity) {
64511         if (entity && entity.user) users[entity.user] = true;
64512       });
64513       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
64514       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
64515       var userList = select_default2(document.createElement("span"));
64516       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
64517         return osm.userURL(d2);
64518       }).attr("target", "_blank").text(String);
64519       if (u2.length > limit) {
64520         var count = select_default2(document.createElement("span"));
64521         var othersNum = u2.length - limit + 1;
64522         count.append("a").attr("target", "_blank").attr("href", function() {
64523           return osm.changesetsURL(context.map().center(), context.map().zoom());
64524         }).text(othersNum);
64525         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
64526       } else {
64527         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
64528       }
64529       if (!u2.length) {
64530         hidden = true;
64531         wrap2.transition().style("opacity", 0);
64532       } else if (hidden) {
64533         wrap2.transition().style("opacity", 1);
64534       }
64535     }
64536     return function(selection2) {
64537       if (!osm) return;
64538       wrap2 = selection2;
64539       update();
64540       osm.on("loaded.contributors", debouncedUpdate);
64541       context.map().on("move.contributors", debouncedUpdate);
64542     };
64543   }
64544   var init_contributors = __esm({
64545     "modules/ui/contributors.js"() {
64546       "use strict";
64547       init_debounce();
64548       init_src5();
64549       init_localizer();
64550       init_svg();
64551     }
64552   });
64553
64554   // modules/ui/edit_menu.js
64555   var edit_menu_exports = {};
64556   __export(edit_menu_exports, {
64557     uiEditMenu: () => uiEditMenu
64558   });
64559   function uiEditMenu(context) {
64560     var dispatch14 = dispatch_default("toggled");
64561     var _menu = select_default2(null);
64562     var _operations = [];
64563     var _anchorLoc = [0, 0];
64564     var _anchorLocLonLat = [0, 0];
64565     var _triggerType = "";
64566     var _vpTopMargin = 85;
64567     var _vpBottomMargin = 45;
64568     var _vpSideMargin = 35;
64569     var _menuTop = false;
64570     var _menuHeight;
64571     var _menuWidth;
64572     var _verticalPadding = 4;
64573     var _tooltipWidth = 210;
64574     var _menuSideMargin = 10;
64575     var _tooltips = [];
64576     var editMenu = function(selection2) {
64577       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
64578       var ops = _operations.filter(function(op) {
64579         return !isTouchMenu || !op.mouseOnly;
64580       });
64581       if (!ops.length) return;
64582       _tooltips = [];
64583       _menuTop = isTouchMenu;
64584       var showLabels = isTouchMenu;
64585       var buttonHeight = showLabels ? 32 : 34;
64586       if (showLabels) {
64587         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
64588           return op.title.length;
64589         })));
64590       } else {
64591         _menuWidth = 44;
64592       }
64593       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
64594       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
64595       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
64596       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
64597         return "edit-menu-item edit-menu-item-" + d2.id;
64598       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
64599         d3_event.stopPropagation();
64600       }).on("mouseenter.highlight", function(d3_event, d2) {
64601         if (!d2.relatedEntityIds || select_default2(this).classed("disabled")) return;
64602         utilHighlightEntities(d2.relatedEntityIds(), true, context);
64603       }).on("mouseleave.highlight", function(d3_event, d2) {
64604         if (!d2.relatedEntityIds) return;
64605         utilHighlightEntities(d2.relatedEntityIds(), false, context);
64606       });
64607       buttonsEnter.each(function(d2) {
64608         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
64609         _tooltips.push(tooltip);
64610         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
64611       });
64612       if (showLabels) {
64613         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
64614           select_default2(this).call(d2.title);
64615         });
64616       }
64617       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
64618         return d2.disabled();
64619       });
64620       updatePosition();
64621       var initialScale = context.projection.scale();
64622       context.map().on("move.edit-menu", function() {
64623         if (initialScale !== context.projection.scale()) {
64624           editMenu.close();
64625         }
64626       }).on("drawn.edit-menu", function(info) {
64627         if (info.full) updatePosition();
64628       });
64629       var lastPointerUpType;
64630       function pointerup(d3_event) {
64631         lastPointerUpType = d3_event.pointerType;
64632       }
64633       function click(d3_event, operation2) {
64634         d3_event.stopPropagation();
64635         if (operation2.relatedEntityIds) {
64636           utilHighlightEntities(operation2.relatedEntityIds(), false, context);
64637         }
64638         if (operation2.disabled()) {
64639           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64640             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
64641           }
64642         } else {
64643           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64644             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
64645           }
64646           operation2();
64647           editMenu.close();
64648         }
64649         lastPointerUpType = null;
64650       }
64651       dispatch14.call("toggled", this, true);
64652     };
64653     function updatePosition() {
64654       if (!_menu || _menu.empty()) return;
64655       var anchorLoc = context.projection(_anchorLocLonLat);
64656       var viewport = context.surfaceRect();
64657       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
64658         editMenu.close();
64659         return;
64660       }
64661       var menuLeft = displayOnLeft(viewport);
64662       var offset = [0, 0];
64663       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
64664       if (_menuTop) {
64665         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
64666           offset[1] = -anchorLoc[1] + _vpTopMargin;
64667         } else {
64668           offset[1] = -_menuHeight;
64669         }
64670       } else {
64671         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
64672           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
64673         } else {
64674           offset[1] = 0;
64675         }
64676       }
64677       var origin = geoVecAdd(anchorLoc, offset);
64678       var _verticalOffset = parseFloat(utilGetDimensions(select_default2(".top-toolbar-wrap"))[1]);
64679       origin[1] -= _verticalOffset;
64680       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
64681       var tooltipSide = tooltipPosition(viewport, menuLeft);
64682       _tooltips.forEach(function(tooltip) {
64683         tooltip.placement(tooltipSide);
64684       });
64685       function displayOnLeft(viewport2) {
64686         if (_mainLocalizer.textDirection() === "ltr") {
64687           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
64688             return true;
64689           }
64690           return false;
64691         } else {
64692           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
64693             return false;
64694           }
64695           return true;
64696         }
64697       }
64698       function tooltipPosition(viewport2, menuLeft2) {
64699         if (_mainLocalizer.textDirection() === "ltr") {
64700           if (menuLeft2) {
64701             return "left";
64702           }
64703           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
64704             return "left";
64705           }
64706           return "right";
64707         } else {
64708           if (!menuLeft2) {
64709             return "right";
64710           }
64711           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
64712             return "right";
64713           }
64714           return "left";
64715         }
64716       }
64717     }
64718     editMenu.close = function() {
64719       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
64720       _menu.remove();
64721       _tooltips = [];
64722       dispatch14.call("toggled", this, false);
64723     };
64724     editMenu.anchorLoc = function(val) {
64725       if (!arguments.length) return _anchorLoc;
64726       _anchorLoc = val;
64727       _anchorLocLonLat = context.projection.invert(_anchorLoc);
64728       return editMenu;
64729     };
64730     editMenu.triggerType = function(val) {
64731       if (!arguments.length) return _triggerType;
64732       _triggerType = val;
64733       return editMenu;
64734     };
64735     editMenu.operations = function(val) {
64736       if (!arguments.length) return _operations;
64737       _operations = val;
64738       return editMenu;
64739     };
64740     return utilRebind(editMenu, dispatch14, "on");
64741   }
64742   var init_edit_menu = __esm({
64743     "modules/ui/edit_menu.js"() {
64744       "use strict";
64745       init_src5();
64746       init_src4();
64747       init_geo2();
64748       init_localizer();
64749       init_tooltip();
64750       init_rebind();
64751       init_util2();
64752       init_dimensions();
64753       init_icon();
64754     }
64755   });
64756
64757   // modules/ui/feature_info.js
64758   var feature_info_exports = {};
64759   __export(feature_info_exports, {
64760     uiFeatureInfo: () => uiFeatureInfo
64761   });
64762   function uiFeatureInfo(context) {
64763     function update(selection2) {
64764       var features = context.features();
64765       var stats = features.stats();
64766       var count = 0;
64767       var hiddenList = features.hidden().map(function(k3) {
64768         if (stats[k3]) {
64769           count += stats[k3];
64770           return _t.append("inspector.title_count", {
64771             title: _t("feature." + k3 + ".description"),
64772             count: stats[k3]
64773           });
64774         }
64775         return null;
64776       }).filter(Boolean);
64777       selection2.text("");
64778       if (hiddenList.length) {
64779         var tooltipBehavior = uiTooltip().placement("top").title(function() {
64780           return (selection3) => {
64781             hiddenList.forEach((hiddenFeature) => {
64782               selection3.append("div").call(hiddenFeature);
64783             });
64784           };
64785         });
64786         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
64787           tooltipBehavior.hide();
64788           d3_event.preventDefault();
64789           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
64790         });
64791       }
64792       selection2.classed("hide", !hiddenList.length);
64793     }
64794     return function(selection2) {
64795       update(selection2);
64796       context.features().on("change.feature_info", function() {
64797         update(selection2);
64798       });
64799     };
64800   }
64801   var init_feature_info = __esm({
64802     "modules/ui/feature_info.js"() {
64803       "use strict";
64804       init_localizer();
64805       init_tooltip();
64806     }
64807   });
64808
64809   // modules/ui/flash.js
64810   var flash_exports = {};
64811   __export(flash_exports, {
64812     uiFlash: () => uiFlash
64813   });
64814   function uiFlash(context) {
64815     var _flashTimer;
64816     var _duration = 2e3;
64817     var _iconName = "#iD-icon-no";
64818     var _iconClass = "disabled";
64819     var _label = (s2) => s2.text("");
64820     function flash() {
64821       if (_flashTimer) {
64822         _flashTimer.stop();
64823       }
64824       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
64825       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
64826       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
64827       var contentEnter = content.enter().append("div").attr("class", "flash-content");
64828       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
64829       iconEnter.append("circle").attr("r", 9);
64830       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
64831       contentEnter.append("div").attr("class", "flash-text");
64832       content = content.merge(contentEnter);
64833       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
64834       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
64835       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
64836       _flashTimer = timeout_default(function() {
64837         _flashTimer = null;
64838         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
64839         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
64840       }, _duration);
64841       return content;
64842     }
64843     flash.duration = function(_3) {
64844       if (!arguments.length) return _duration;
64845       _duration = _3;
64846       return flash;
64847     };
64848     flash.label = function(_3) {
64849       if (!arguments.length) return _label;
64850       if (typeof _3 !== "function") {
64851         _label = (selection2) => selection2.text(_3);
64852       } else {
64853         _label = (selection2) => selection2.text("").call(_3);
64854       }
64855       return flash;
64856     };
64857     flash.iconName = function(_3) {
64858       if (!arguments.length) return _iconName;
64859       _iconName = _3;
64860       return flash;
64861     };
64862     flash.iconClass = function(_3) {
64863       if (!arguments.length) return _iconClass;
64864       _iconClass = _3;
64865       return flash;
64866     };
64867     return flash;
64868   }
64869   var init_flash = __esm({
64870     "modules/ui/flash.js"() {
64871       "use strict";
64872       init_src9();
64873     }
64874   });
64875
64876   // modules/ui/full_screen.js
64877   var full_screen_exports = {};
64878   __export(full_screen_exports, {
64879     uiFullScreen: () => uiFullScreen
64880   });
64881   function uiFullScreen(context) {
64882     var element = context.container().node();
64883     function getFullScreenFn() {
64884       if (element.requestFullscreen) {
64885         return element.requestFullscreen;
64886       } else if (element.msRequestFullscreen) {
64887         return element.msRequestFullscreen;
64888       } else if (element.mozRequestFullScreen) {
64889         return element.mozRequestFullScreen;
64890       } else if (element.webkitRequestFullscreen) {
64891         return element.webkitRequestFullscreen;
64892       }
64893     }
64894     function getExitFullScreenFn() {
64895       if (document.exitFullscreen) {
64896         return document.exitFullscreen;
64897       } else if (document.msExitFullscreen) {
64898         return document.msExitFullscreen;
64899       } else if (document.mozCancelFullScreen) {
64900         return document.mozCancelFullScreen;
64901       } else if (document.webkitExitFullscreen) {
64902         return document.webkitExitFullscreen;
64903       }
64904     }
64905     function isFullScreen() {
64906       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
64907     }
64908     function isSupported() {
64909       return !!getFullScreenFn();
64910     }
64911     function fullScreen(d3_event) {
64912       d3_event.preventDefault();
64913       if (!isFullScreen()) {
64914         getFullScreenFn().apply(element);
64915       } else {
64916         getExitFullScreenFn().apply(document);
64917       }
64918     }
64919     return function() {
64920       if (!isSupported()) return;
64921       var detected = utilDetect();
64922       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
64923       context.keybinding().on(keys2, fullScreen);
64924     };
64925   }
64926   var init_full_screen = __esm({
64927     "modules/ui/full_screen.js"() {
64928       "use strict";
64929       init_cmd();
64930       init_detect();
64931     }
64932   });
64933
64934   // modules/ui/geolocate.js
64935   var geolocate_exports2 = {};
64936   __export(geolocate_exports2, {
64937     uiGeolocate: () => uiGeolocate
64938   });
64939   function uiGeolocate(context) {
64940     var _geolocationOptions = {
64941       // prioritize speed and power usage over precision
64942       enableHighAccuracy: false,
64943       // don't hang indefinitely getting the location
64944       timeout: 6e3
64945       // 6sec
64946     };
64947     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
64948     var _layer = context.layers().layer("geolocate");
64949     var _position;
64950     var _extent;
64951     var _timeoutID;
64952     var _button = select_default2(null);
64953     function click() {
64954       if (context.inIntro()) return;
64955       if (!_layer.enabled() && !_locating.isShown()) {
64956         _timeoutID = setTimeout(
64957           error,
64958           1e4
64959           /* 10sec */
64960         );
64961         context.container().call(_locating);
64962         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
64963       } else {
64964         _locating.close();
64965         _layer.enabled(null, false);
64966         updateButtonState();
64967       }
64968     }
64969     function zoomTo() {
64970       context.enter(modeBrowse(context));
64971       var map2 = context.map();
64972       _layer.enabled(_position, true);
64973       updateButtonState();
64974       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
64975     }
64976     function success(geolocation) {
64977       _position = geolocation;
64978       var coords = _position.coords;
64979       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
64980       zoomTo();
64981       finish();
64982     }
64983     function error() {
64984       if (_position) {
64985         zoomTo();
64986       } else {
64987         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
64988       }
64989       finish();
64990     }
64991     function finish() {
64992       _locating.close();
64993       if (_timeoutID) {
64994         clearTimeout(_timeoutID);
64995       }
64996       _timeoutID = void 0;
64997     }
64998     function updateButtonState() {
64999       _button.classed("active", _layer.enabled());
65000       _button.attr("aria-pressed", _layer.enabled());
65001     }
65002     return function(selection2) {
65003       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
65004       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
65005         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title"))
65006       );
65007     };
65008   }
65009   var init_geolocate2 = __esm({
65010     "modules/ui/geolocate.js"() {
65011       "use strict";
65012       init_src5();
65013       init_localizer();
65014       init_tooltip();
65015       init_geo2();
65016       init_browse();
65017       init_icon();
65018       init_loading();
65019     }
65020   });
65021
65022   // modules/ui/panels/background.js
65023   var background_exports = {};
65024   __export(background_exports, {
65025     uiPanelBackground: () => uiPanelBackground
65026   });
65027   function uiPanelBackground(context) {
65028     var background = context.background();
65029     var _currSourceName = null;
65030     var _metadata = {};
65031     var _metadataKeys = [
65032       "zoom",
65033       "vintage",
65034       "source",
65035       "description",
65036       "resolution",
65037       "accuracy"
65038     ];
65039     var debouncedRedraw = debounce_default(redraw, 250);
65040     function redraw(selection2) {
65041       var source = background.baseLayerSource();
65042       if (!source) return;
65043       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
65044       var sourceLabel = source.label();
65045       if (_currSourceName !== sourceLabel) {
65046         _currSourceName = sourceLabel;
65047         _metadata = {};
65048       }
65049       selection2.text("");
65050       var list = selection2.append("ul").attr("class", "background-info");
65051       list.append("li").call(_currSourceName);
65052       _metadataKeys.forEach(function(k3) {
65053         if (isDG && k3 === "vintage") return;
65054         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]);
65055       });
65056       debouncedGetMetadata(selection2);
65057       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
65058       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
65059         d3_event.preventDefault();
65060         context.setDebug("tile", !context.getDebug("tile"));
65061         selection2.call(redraw);
65062       });
65063       if (isDG) {
65064         var key = source.id + "-vintage";
65065         var sourceVintage = context.background().findSource(key);
65066         var showsVintage = context.background().showsLayer(sourceVintage);
65067         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
65068         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
65069           d3_event.preventDefault();
65070           context.background().toggleOverlayLayer(sourceVintage);
65071           selection2.call(redraw);
65072         });
65073       }
65074       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
65075         if (source.id !== layerId) {
65076           var key2 = layerId + "-vintage";
65077           var sourceVintage2 = context.background().findSource(key2);
65078           if (context.background().showsLayer(sourceVintage2)) {
65079             context.background().toggleOverlayLayer(sourceVintage2);
65080           }
65081         }
65082       });
65083     }
65084     var debouncedGetMetadata = debounce_default(getMetadata, 250);
65085     function getMetadata(selection2) {
65086       var tile = context.container().select(".layer-background img.tile-center");
65087       if (tile.empty()) return;
65088       var sourceName = _currSourceName;
65089       var d2 = tile.datum();
65090       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
65091       var center = context.map().center();
65092       _metadata.zoom = String(zoom);
65093       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
65094       if (!d2 || !d2.length >= 3) return;
65095       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
65096         if (err || _currSourceName !== sourceName) return;
65097         var vintage = result.vintage;
65098         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
65099         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
65100         _metadataKeys.forEach(function(k3) {
65101           if (k3 === "zoom" || k3 === "vintage") return;
65102           var val = result[k3];
65103           _metadata[k3] = val;
65104           selection2.selectAll(".background-info-list-" + k3).classed("hide", !val).selectAll(".background-info-span-" + k3).text(val);
65105         });
65106       });
65107     }
65108     var panel = function(selection2) {
65109       selection2.call(redraw);
65110       context.map().on("drawn.info-background", function() {
65111         selection2.call(debouncedRedraw);
65112       }).on("move.info-background", function() {
65113         selection2.call(debouncedGetMetadata);
65114       });
65115     };
65116     panel.off = function() {
65117       context.map().on("drawn.info-background", null).on("move.info-background", null);
65118     };
65119     panel.id = "background";
65120     panel.label = _t.append("info_panels.background.title");
65121     panel.key = _t("info_panels.background.key");
65122     return panel;
65123   }
65124   var init_background = __esm({
65125     "modules/ui/panels/background.js"() {
65126       "use strict";
65127       init_debounce();
65128       init_localizer();
65129     }
65130   });
65131
65132   // modules/ui/panels/history.js
65133   var history_exports2 = {};
65134   __export(history_exports2, {
65135     uiPanelHistory: () => uiPanelHistory
65136   });
65137   function uiPanelHistory(context) {
65138     var osm;
65139     function displayTimestamp(timestamp) {
65140       if (!timestamp) return _t("info_panels.history.unknown");
65141       var options = {
65142         day: "numeric",
65143         month: "short",
65144         year: "numeric",
65145         hour: "numeric",
65146         minute: "numeric",
65147         second: "numeric"
65148       };
65149       var d2 = new Date(timestamp);
65150       if (isNaN(d2.getTime())) return _t("info_panels.history.unknown");
65151       return d2.toLocaleString(_mainLocalizer.localeCode(), options);
65152     }
65153     function displayUser(selection2, userName) {
65154       if (!userName) {
65155         selection2.append("span").call(_t.append("info_panels.history.unknown"));
65156         return;
65157       }
65158       selection2.append("span").attr("class", "user-name").text(userName);
65159       var links = selection2.append("div").attr("class", "links");
65160       if (osm) {
65161         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
65162       }
65163       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
65164     }
65165     function displayChangeset(selection2, changeset) {
65166       if (!changeset) {
65167         selection2.append("span").call(_t.append("info_panels.history.unknown"));
65168         return;
65169       }
65170       selection2.append("span").attr("class", "changeset-id").text(changeset);
65171       var links = selection2.append("div").attr("class", "links");
65172       if (osm) {
65173         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
65174       }
65175       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
65176       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
65177     }
65178     function redraw(selection2) {
65179       var selectedNoteID = context.selectedNoteID();
65180       osm = context.connection();
65181       var selected, note, entity;
65182       if (selectedNoteID && osm) {
65183         selected = [_t.html("note.note") + " " + selectedNoteID];
65184         note = osm.getNote(selectedNoteID);
65185       } else {
65186         selected = context.selectedIDs().filter(function(e3) {
65187           return context.hasEntity(e3);
65188         });
65189         if (selected.length) {
65190           entity = context.entity(selected[0]);
65191         }
65192       }
65193       var singular = selected.length === 1 ? selected[0] : null;
65194       selection2.html("");
65195       if (singular) {
65196         selection2.append("h4").attr("class", "history-heading").html(singular);
65197       } else {
65198         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
65199       }
65200       if (!singular) return;
65201       if (entity) {
65202         selection2.call(redrawEntity, entity);
65203       } else if (note) {
65204         selection2.call(redrawNote, note);
65205       }
65206     }
65207     function redrawNote(selection2, note) {
65208       if (!note || note.isNew()) {
65209         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
65210         return;
65211       }
65212       var list = selection2.append("ul");
65213       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
65214       if (note.comments.length) {
65215         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
65216         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
65217       }
65218       if (osm) {
65219         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"));
65220       }
65221     }
65222     function redrawEntity(selection2, entity) {
65223       if (!entity || entity.isNew()) {
65224         selection2.append("div").call(_t.append("info_panels.history.no_history"));
65225         return;
65226       }
65227       var links = selection2.append("div").attr("class", "links");
65228       if (osm) {
65229         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"));
65230       }
65231       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");
65232       var list = selection2.append("ul");
65233       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
65234       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
65235       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
65236       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
65237     }
65238     var panel = function(selection2) {
65239       selection2.call(redraw);
65240       context.map().on("drawn.info-history", function() {
65241         selection2.call(redraw);
65242       });
65243       context.on("enter.info-history", function() {
65244         selection2.call(redraw);
65245       });
65246     };
65247     panel.off = function() {
65248       context.map().on("drawn.info-history", null);
65249       context.on("enter.info-history", null);
65250     };
65251     panel.id = "history";
65252     panel.label = _t.append("info_panels.history.title");
65253     panel.key = _t("info_panels.history.key");
65254     return panel;
65255   }
65256   var init_history2 = __esm({
65257     "modules/ui/panels/history.js"() {
65258       "use strict";
65259       init_localizer();
65260       init_svg();
65261     }
65262   });
65263
65264   // modules/ui/panels/location.js
65265   var location_exports = {};
65266   __export(location_exports, {
65267     uiPanelLocation: () => uiPanelLocation
65268   });
65269   function uiPanelLocation(context) {
65270     var currLocation = "";
65271     function redraw(selection2) {
65272       selection2.html("");
65273       var list = selection2.append("ul");
65274       var coord2 = context.map().mouseCoordinates();
65275       if (coord2.some(isNaN)) {
65276         coord2 = context.map().center();
65277       }
65278       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
65279       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
65280       debouncedGetLocation(selection2, coord2);
65281     }
65282     var debouncedGetLocation = debounce_default(getLocation, 250);
65283     function getLocation(selection2, coord2) {
65284       if (!services.geocoder) {
65285         currLocation = _t("info_panels.location.unknown_location");
65286         selection2.selectAll(".location-info").text(currLocation);
65287       } else {
65288         services.geocoder.reverse(coord2, function(err, result) {
65289           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
65290           selection2.selectAll(".location-info").text(currLocation);
65291         });
65292       }
65293     }
65294     var panel = function(selection2) {
65295       selection2.call(redraw);
65296       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
65297         selection2.call(redraw);
65298       });
65299     };
65300     panel.off = function() {
65301       context.surface().on(".info-location", null);
65302     };
65303     panel.id = "location";
65304     panel.label = _t.append("info_panels.location.title");
65305     panel.key = _t("info_panels.location.key");
65306     return panel;
65307   }
65308   var init_location = __esm({
65309     "modules/ui/panels/location.js"() {
65310       "use strict";
65311       init_debounce();
65312       init_units();
65313       init_localizer();
65314       init_services();
65315     }
65316   });
65317
65318   // modules/ui/panels/measurement.js
65319   var measurement_exports = {};
65320   __export(measurement_exports, {
65321     uiPanelMeasurement: () => uiPanelMeasurement
65322   });
65323   function uiPanelMeasurement(context) {
65324     function radiansToMeters(r2) {
65325       return r2 * 63710071809e-4;
65326     }
65327     function steradiansToSqmeters(r2) {
65328       return r2 / (4 * Math.PI) * 510065621724e3;
65329     }
65330     function toLineString(feature3) {
65331       if (feature3.type === "LineString") return feature3;
65332       var result = { type: "LineString", coordinates: [] };
65333       if (feature3.type === "Polygon") {
65334         result.coordinates = feature3.coordinates[0];
65335       } else if (feature3.type === "MultiPolygon") {
65336         result.coordinates = feature3.coordinates[0][0];
65337       }
65338       return result;
65339     }
65340     var _isImperial = !_mainLocalizer.usesMetric();
65341     function redraw(selection2) {
65342       var graph = context.graph();
65343       var selectedNoteID = context.selectedNoteID();
65344       var osm = services.osm;
65345       var localeCode = _mainLocalizer.localeCode();
65346       var heading;
65347       var center, location, centroid;
65348       var closed, geometry;
65349       var totalNodeCount, length2 = 0, area = 0, distance;
65350       if (selectedNoteID && osm) {
65351         var note = osm.getNote(selectedNoteID);
65352         heading = _t.html("note.note") + " " + selectedNoteID;
65353         location = note.loc;
65354         geometry = "note";
65355       } else {
65356         var selectedIDs = context.selectedIDs().filter(function(id2) {
65357           return context.hasEntity(id2);
65358         });
65359         var selected = selectedIDs.map(function(id2) {
65360           return context.entity(id2);
65361         });
65362         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
65363         if (selected.length) {
65364           var extent = geoExtent();
65365           for (var i3 in selected) {
65366             var entity = selected[i3];
65367             extent._extend(entity.extent(graph));
65368             geometry = entity.geometry(graph);
65369             if (geometry === "line" || geometry === "area") {
65370               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
65371               var feature3 = entity.asGeoJSON(graph);
65372               length2 += radiansToMeters(length_default(toLineString(feature3)));
65373               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
65374               centroid = centroid && context.projection.invert(centroid);
65375               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
65376                 centroid = entity.extent(graph).center();
65377               }
65378               if (closed) {
65379                 area += steradiansToSqmeters(entity.area(graph));
65380               }
65381             }
65382           }
65383           if (selected.length > 1) {
65384             geometry = null;
65385             closed = null;
65386             centroid = null;
65387           }
65388           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
65389             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
65390           }
65391           if (selected.length === 1 && selected[0].type === "node") {
65392             location = selected[0].loc;
65393           } else {
65394             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
65395           }
65396           if (!location && !centroid) {
65397             center = extent.center();
65398           }
65399         }
65400       }
65401       selection2.html("");
65402       if (heading) {
65403         selection2.append("h4").attr("class", "measurement-heading").html(heading);
65404       }
65405       var list = selection2.append("ul");
65406       var coordItem;
65407       if (geometry) {
65408         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
65409           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
65410         );
65411       }
65412       if (totalNodeCount) {
65413         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
65414       }
65415       if (area) {
65416         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
65417       }
65418       if (length2) {
65419         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
65420       }
65421       if (typeof distance === "number") {
65422         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
65423       }
65424       if (location) {
65425         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
65426         coordItem.append("span").text(dmsCoordinatePair(location));
65427         coordItem.append("span").text(decimalCoordinatePair(location));
65428       }
65429       if (centroid) {
65430         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
65431         coordItem.append("span").text(dmsCoordinatePair(centroid));
65432         coordItem.append("span").text(decimalCoordinatePair(centroid));
65433       }
65434       if (center) {
65435         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
65436         coordItem.append("span").text(dmsCoordinatePair(center));
65437         coordItem.append("span").text(decimalCoordinatePair(center));
65438       }
65439       if (length2 || area || typeof distance === "number") {
65440         var toggle = _isImperial ? "imperial" : "metric";
65441         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
65442           d3_event.preventDefault();
65443           _isImperial = !_isImperial;
65444           selection2.call(redraw);
65445         });
65446       }
65447     }
65448     var panel = function(selection2) {
65449       selection2.call(redraw);
65450       context.map().on("drawn.info-measurement", function() {
65451         selection2.call(redraw);
65452       });
65453       context.on("enter.info-measurement", function() {
65454         selection2.call(redraw);
65455       });
65456     };
65457     panel.off = function() {
65458       context.map().on("drawn.info-measurement", null);
65459       context.on("enter.info-measurement", null);
65460     };
65461     panel.id = "measurement";
65462     panel.label = _t.append("info_panels.measurement.title");
65463     panel.key = _t("info_panels.measurement.key");
65464     return panel;
65465   }
65466   var init_measurement = __esm({
65467     "modules/ui/panels/measurement.js"() {
65468       "use strict";
65469       init_src2();
65470       init_localizer();
65471       init_units();
65472       init_geo2();
65473       init_services();
65474       init_util();
65475     }
65476   });
65477
65478   // modules/ui/panels/index.js
65479   var panels_exports = {};
65480   __export(panels_exports, {
65481     uiInfoPanels: () => uiInfoPanels,
65482     uiPanelBackground: () => uiPanelBackground,
65483     uiPanelHistory: () => uiPanelHistory,
65484     uiPanelLocation: () => uiPanelLocation,
65485     uiPanelMeasurement: () => uiPanelMeasurement
65486   });
65487   var uiInfoPanels;
65488   var init_panels = __esm({
65489     "modules/ui/panels/index.js"() {
65490       "use strict";
65491       init_background();
65492       init_history2();
65493       init_location();
65494       init_measurement();
65495       init_background();
65496       init_history2();
65497       init_location();
65498       init_measurement();
65499       uiInfoPanels = {
65500         background: uiPanelBackground,
65501         history: uiPanelHistory,
65502         location: uiPanelLocation,
65503         measurement: uiPanelMeasurement
65504       };
65505     }
65506   });
65507
65508   // modules/ui/info.js
65509   var info_exports = {};
65510   __export(info_exports, {
65511     uiInfo: () => uiInfo
65512   });
65513   function uiInfo(context) {
65514     var ids = Object.keys(uiInfoPanels);
65515     var wasActive = ["measurement"];
65516     var panels = {};
65517     var active = {};
65518     ids.forEach(function(k3) {
65519       if (!panels[k3]) {
65520         panels[k3] = uiInfoPanels[k3](context);
65521         active[k3] = false;
65522       }
65523     });
65524     function info(selection2) {
65525       function redraw() {
65526         var activeids = ids.filter(function(k3) {
65527           return active[k3];
65528         }).sort();
65529         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k3) {
65530           return k3;
65531         });
65532         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
65533           select_default2(this).call(panels[d2].off).remove();
65534         });
65535         var enter = containers.enter().append("div").attr("class", function(d2) {
65536           return "fillD2 panel-container panel-container-" + d2;
65537         });
65538         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
65539         var title = enter.append("div").attr("class", "panel-title fillD2");
65540         title.append("h3").each(function(d2) {
65541           return panels[d2].label(select_default2(this));
65542         });
65543         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
65544           d3_event.stopImmediatePropagation();
65545           d3_event.preventDefault();
65546           info.toggle(d2);
65547         }).call(svgIcon("#iD-icon-close"));
65548         enter.append("div").attr("class", function(d2) {
65549           return "panel-content panel-content-" + d2;
65550         });
65551         infoPanels.selectAll(".panel-content").each(function(d2) {
65552           select_default2(this).call(panels[d2]);
65553         });
65554       }
65555       info.toggle = function(which) {
65556         var activeids = ids.filter(function(k3) {
65557           return active[k3];
65558         });
65559         if (which) {
65560           active[which] = !active[which];
65561           if (activeids.length === 1 && activeids[0] === which) {
65562             wasActive = [which];
65563           }
65564           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
65565         } else {
65566           if (activeids.length) {
65567             wasActive = activeids;
65568             activeids.forEach(function(k3) {
65569               active[k3] = false;
65570             });
65571           } else {
65572             wasActive.forEach(function(k3) {
65573               active[k3] = true;
65574             });
65575           }
65576         }
65577         redraw();
65578       };
65579       var infoPanels = selection2.selectAll(".info-panels").data([0]);
65580       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
65581       redraw();
65582       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
65583         if (d3_event.shiftKey) return;
65584         d3_event.stopImmediatePropagation();
65585         d3_event.preventDefault();
65586         info.toggle();
65587       });
65588       ids.forEach(function(k3) {
65589         var key = _t("info_panels." + k3 + ".key", { default: null });
65590         if (!key) return;
65591         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
65592           d3_event.stopImmediatePropagation();
65593           d3_event.preventDefault();
65594           info.toggle(k3);
65595         });
65596       });
65597     }
65598     return info;
65599   }
65600   var init_info = __esm({
65601     "modules/ui/info.js"() {
65602       "use strict";
65603       init_src5();
65604       init_localizer();
65605       init_icon();
65606       init_cmd();
65607       init_panels();
65608     }
65609   });
65610
65611   // modules/ui/curtain.js
65612   var curtain_exports = {};
65613   __export(curtain_exports, {
65614     uiCurtain: () => uiCurtain
65615   });
65616   function uiCurtain(containerNode) {
65617     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
65618     function curtain(selection2) {
65619       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
65620       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
65621       select_default2(window).on("resize.curtain", resize);
65622       tooltip = selection2.append("div").attr("class", "tooltip");
65623       tooltip.append("div").attr("class", "popover-arrow");
65624       tooltip.append("div").attr("class", "popover-inner");
65625       resize();
65626       function resize() {
65627         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
65628         curtain.cut(darkness.datum());
65629       }
65630     }
65631     curtain.reveal = function(box, html2, options) {
65632       options = options || {};
65633       if (typeof box === "string") {
65634         box = select_default2(box).node();
65635       }
65636       if (box && box.getBoundingClientRect) {
65637         box = copyBox(box.getBoundingClientRect());
65638       }
65639       if (box) {
65640         var containerRect = containerNode.getBoundingClientRect();
65641         box.top -= containerRect.top;
65642         box.left -= containerRect.left;
65643       }
65644       if (box && options.padding) {
65645         box.top -= options.padding;
65646         box.left -= options.padding;
65647         box.bottom += options.padding;
65648         box.right += options.padding;
65649         box.height += options.padding * 2;
65650         box.width += options.padding * 2;
65651       }
65652       var tooltipBox;
65653       if (options.tooltipBox) {
65654         tooltipBox = options.tooltipBox;
65655         if (typeof tooltipBox === "string") {
65656           tooltipBox = select_default2(tooltipBox).node();
65657         }
65658         if (tooltipBox && tooltipBox.getBoundingClientRect) {
65659           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
65660         }
65661       } else {
65662         tooltipBox = box;
65663       }
65664       if (tooltipBox && html2) {
65665         if (html2.indexOf("**") !== -1) {
65666           if (html2.indexOf("<span") === 0) {
65667             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
65668           } else {
65669             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
65670           }
65671           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
65672         }
65673         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
65674         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
65675         if (options.buttonText && options.buttonCallback) {
65676           html2 += '<div class="button-section"><button href="#" class="button action">' + options.buttonText + "</button></div>";
65677         }
65678         var classes = "curtain-tooltip popover tooltip arrowed in " + (options.tooltipClass || "");
65679         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
65680         if (options.buttonText && options.buttonCallback) {
65681           var button = tooltip.selectAll(".button-section .button.action");
65682           button.on("click", function(d3_event) {
65683             d3_event.preventDefault();
65684             options.buttonCallback();
65685           });
65686         }
65687         var tip = copyBox(tooltip.node().getBoundingClientRect()), w3 = containerNode.clientWidth, h3 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
65688         if (options.tooltipClass === "intro-mouse") {
65689           tip.height += 80;
65690         }
65691         if (tooltipBox.top + tooltipBox.height > h3) {
65692           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h3;
65693         }
65694         if (tooltipBox.left + tooltipBox.width > w3) {
65695           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w3;
65696         }
65697         const onLeftOrRightEdge = tooltipBox.left + tooltipBox.width / 2 > w3 - 100 || tooltipBox.left + tooltipBox.width / 2 < 100;
65698         if (tooltipBox.top + tooltipBox.height < 100 && !onLeftOrRightEdge) {
65699           side = "bottom";
65700           pos = [
65701             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
65702             tooltipBox.top + tooltipBox.height
65703           ];
65704         } else if (tooltipBox.top > h3 - 140 && !onLeftOrRightEdge) {
65705           side = "top";
65706           pos = [
65707             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
65708             tooltipBox.top - tip.height
65709           ];
65710         } else {
65711           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
65712           if (_mainLocalizer.textDirection() === "rtl") {
65713             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
65714               side = "right";
65715               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
65716             } else {
65717               side = "left";
65718               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
65719             }
65720           } else {
65721             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w3 - 70) {
65722               side = "left";
65723               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
65724             } else {
65725               side = "right";
65726               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
65727             }
65728           }
65729         }
65730         if (options.duration !== 0 || !tooltip.classed(side)) {
65731           tooltip.call(uiToggle(true));
65732         }
65733         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
65734         var shiftY = 0;
65735         if (side === "left" || side === "right") {
65736           if (pos[1] < 60) {
65737             shiftY = 60 - pos[1];
65738           } else if (pos[1] + tip.height > h3 - 100) {
65739             shiftY = h3 - pos[1] - tip.height - 100;
65740           }
65741         }
65742         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
65743       } else {
65744         tooltip.classed("in", false).call(uiToggle(false));
65745       }
65746       curtain.cut(box, options.duration);
65747       return tooltip;
65748     };
65749     curtain.cut = function(datum2, duration) {
65750       darkness.datum(datum2).interrupt();
65751       var selection2;
65752       if (duration === 0) {
65753         selection2 = darkness;
65754       } else {
65755         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
65756       }
65757       selection2.attr("d", function(d2) {
65758         var containerWidth = containerNode.clientWidth;
65759         var containerHeight = containerNode.clientHeight;
65760         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
65761         if (!d2) return string;
65762         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";
65763       });
65764     };
65765     curtain.remove = function() {
65766       surface.remove();
65767       tooltip.remove();
65768       select_default2(window).on("resize.curtain", null);
65769     };
65770     function copyBox(src) {
65771       return {
65772         top: src.top,
65773         right: src.right,
65774         bottom: src.bottom,
65775         left: src.left,
65776         width: src.width,
65777         height: src.height
65778       };
65779     }
65780     return curtain;
65781   }
65782   var init_curtain = __esm({
65783     "modules/ui/curtain.js"() {
65784       "use strict";
65785       init_src10();
65786       init_src5();
65787       init_localizer();
65788       init_toggle();
65789     }
65790   });
65791
65792   // modules/ui/intro/welcome.js
65793   var welcome_exports = {};
65794   __export(welcome_exports, {
65795     uiIntroWelcome: () => uiIntroWelcome
65796   });
65797   function uiIntroWelcome(context, reveal) {
65798     var dispatch14 = dispatch_default("done");
65799     var chapter = {
65800       title: "intro.welcome.title"
65801     };
65802     function welcome() {
65803       context.map().centerZoom([-85.63591, 41.94285], 19);
65804       reveal(
65805         ".intro-nav-wrap .chapter-welcome",
65806         helpHtml("intro.welcome.welcome"),
65807         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
65808       );
65809     }
65810     function practice() {
65811       reveal(
65812         ".intro-nav-wrap .chapter-welcome",
65813         helpHtml("intro.welcome.practice"),
65814         { buttonText: _t.html("intro.ok"), buttonCallback: words }
65815       );
65816     }
65817     function words() {
65818       reveal(
65819         ".intro-nav-wrap .chapter-welcome",
65820         helpHtml("intro.welcome.words"),
65821         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
65822       );
65823     }
65824     function chapters() {
65825       dispatch14.call("done");
65826       reveal(
65827         ".intro-nav-wrap .chapter-navigation",
65828         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
65829       );
65830     }
65831     chapter.enter = function() {
65832       welcome();
65833     };
65834     chapter.exit = function() {
65835       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
65836     };
65837     chapter.restart = function() {
65838       chapter.exit();
65839       chapter.enter();
65840     };
65841     return utilRebind(chapter, dispatch14, "on");
65842   }
65843   var init_welcome = __esm({
65844     "modules/ui/intro/welcome.js"() {
65845       "use strict";
65846       init_src4();
65847       init_helper();
65848       init_localizer();
65849       init_rebind();
65850     }
65851   });
65852
65853   // modules/ui/intro/navigation.js
65854   var navigation_exports = {};
65855   __export(navigation_exports, {
65856     uiIntroNavigation: () => uiIntroNavigation
65857   });
65858   function uiIntroNavigation(context, reveal) {
65859     var dispatch14 = dispatch_default("done");
65860     var timeouts = [];
65861     var hallId = "n2061";
65862     var townHall = [-85.63591, 41.94285];
65863     var springStreetId = "w397";
65864     var springStreetEndId = "n1834";
65865     var springStreet = [-85.63582, 41.94255];
65866     var onewayField = _mainPresetIndex.field("oneway");
65867     var maxspeedField = _mainPresetIndex.field("maxspeed");
65868     var chapter = {
65869       title: "intro.navigation.title"
65870     };
65871     function timeout2(f2, t2) {
65872       timeouts.push(window.setTimeout(f2, t2));
65873     }
65874     function eventCancel(d3_event) {
65875       d3_event.stopPropagation();
65876       d3_event.preventDefault();
65877     }
65878     function isTownHallSelected() {
65879       var ids = context.selectedIDs();
65880       return ids.length === 1 && ids[0] === hallId;
65881     }
65882     function dragMap() {
65883       context.enter(modeBrowse(context));
65884       context.history().reset("initial");
65885       var msec = transitionTime(townHall, context.map().center());
65886       if (msec) {
65887         reveal(null, null, { duration: 0 });
65888       }
65889       context.map().centerZoomEase(townHall, 19, msec);
65890       timeout2(function() {
65891         var centerStart = context.map().center();
65892         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
65893         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
65894         reveal(".main-map .surface", dragString);
65895         context.map().on("drawn.intro", function() {
65896           reveal(".main-map .surface", dragString, { duration: 0 });
65897         });
65898         context.map().on("move.intro", function() {
65899           var centerNow = context.map().center();
65900           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
65901             context.map().on("move.intro", null);
65902             timeout2(function() {
65903               continueTo(zoomMap);
65904             }, 3e3);
65905           }
65906         });
65907       }, msec + 100);
65908       function continueTo(nextStep) {
65909         context.map().on("move.intro drawn.intro", null);
65910         nextStep();
65911       }
65912     }
65913     function zoomMap() {
65914       var zoomStart = context.map().zoom();
65915       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
65916       var zoomString = helpHtml("intro.navigation." + textId);
65917       reveal(".main-map .surface", zoomString);
65918       context.map().on("drawn.intro", function() {
65919         reveal(".main-map .surface", zoomString, { duration: 0 });
65920       });
65921       context.map().on("move.intro", function() {
65922         if (context.map().zoom() !== zoomStart) {
65923           context.map().on("move.intro", null);
65924           timeout2(function() {
65925             continueTo(features);
65926           }, 3e3);
65927         }
65928       });
65929       function continueTo(nextStep) {
65930         context.map().on("move.intro drawn.intro", null);
65931         nextStep();
65932       }
65933     }
65934     function features() {
65935       var onClick = function() {
65936         continueTo(pointsLinesAreas);
65937       };
65938       reveal(
65939         ".main-map .surface",
65940         helpHtml("intro.navigation.features"),
65941         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65942       );
65943       context.map().on("drawn.intro", function() {
65944         reveal(
65945           ".main-map .surface",
65946           helpHtml("intro.navigation.features"),
65947           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65948         );
65949       });
65950       function continueTo(nextStep) {
65951         context.map().on("drawn.intro", null);
65952         nextStep();
65953       }
65954     }
65955     function pointsLinesAreas() {
65956       var onClick = function() {
65957         continueTo(nodesWays);
65958       };
65959       reveal(
65960         ".main-map .surface",
65961         helpHtml("intro.navigation.points_lines_areas"),
65962         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65963       );
65964       context.map().on("drawn.intro", function() {
65965         reveal(
65966           ".main-map .surface",
65967           helpHtml("intro.navigation.points_lines_areas"),
65968           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65969         );
65970       });
65971       function continueTo(nextStep) {
65972         context.map().on("drawn.intro", null);
65973         nextStep();
65974       }
65975     }
65976     function nodesWays() {
65977       var onClick = function() {
65978         continueTo(clickTownHall);
65979       };
65980       reveal(
65981         ".main-map .surface",
65982         helpHtml("intro.navigation.nodes_ways"),
65983         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65984       );
65985       context.map().on("drawn.intro", function() {
65986         reveal(
65987           ".main-map .surface",
65988           helpHtml("intro.navigation.nodes_ways"),
65989           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65990         );
65991       });
65992       function continueTo(nextStep) {
65993         context.map().on("drawn.intro", null);
65994         nextStep();
65995       }
65996     }
65997     function clickTownHall() {
65998       context.enter(modeBrowse(context));
65999       context.history().reset("initial");
66000       var entity = context.hasEntity(hallId);
66001       if (!entity) return;
66002       reveal(null, null, { duration: 0 });
66003       context.map().centerZoomEase(entity.loc, 19, 500);
66004       timeout2(function() {
66005         var entity2 = context.hasEntity(hallId);
66006         if (!entity2) return;
66007         var box = pointBox(entity2.loc, context);
66008         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
66009         reveal(box, helpHtml("intro.navigation." + textId));
66010         context.map().on("move.intro drawn.intro", function() {
66011           var entity3 = context.hasEntity(hallId);
66012           if (!entity3) return;
66013           var box2 = pointBox(entity3.loc, context);
66014           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
66015         });
66016         context.on("enter.intro", function() {
66017           if (isTownHallSelected()) continueTo(selectedTownHall);
66018         });
66019       }, 550);
66020       context.history().on("change.intro", function() {
66021         if (!context.hasEntity(hallId)) {
66022           continueTo(clickTownHall);
66023         }
66024       });
66025       function continueTo(nextStep) {
66026         context.on("enter.intro", null);
66027         context.map().on("move.intro drawn.intro", null);
66028         context.history().on("change.intro", null);
66029         nextStep();
66030       }
66031     }
66032     function selectedTownHall() {
66033       if (!isTownHallSelected()) return clickTownHall();
66034       var entity = context.hasEntity(hallId);
66035       if (!entity) return clickTownHall();
66036       var box = pointBox(entity.loc, context);
66037       var onClick = function() {
66038         continueTo(editorTownHall);
66039       };
66040       reveal(
66041         box,
66042         helpHtml("intro.navigation.selected_townhall"),
66043         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66044       );
66045       context.map().on("move.intro drawn.intro", function() {
66046         var entity2 = context.hasEntity(hallId);
66047         if (!entity2) return;
66048         var box2 = pointBox(entity2.loc, context);
66049         reveal(
66050           box2,
66051           helpHtml("intro.navigation.selected_townhall"),
66052           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66053         );
66054       });
66055       context.history().on("change.intro", function() {
66056         if (!context.hasEntity(hallId)) {
66057           continueTo(clickTownHall);
66058         }
66059       });
66060       function continueTo(nextStep) {
66061         context.map().on("move.intro drawn.intro", null);
66062         context.history().on("change.intro", null);
66063         nextStep();
66064       }
66065     }
66066     function editorTownHall() {
66067       if (!isTownHallSelected()) return clickTownHall();
66068       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66069       var onClick = function() {
66070         continueTo(presetTownHall);
66071       };
66072       reveal(
66073         ".entity-editor-pane",
66074         helpHtml("intro.navigation.editor_townhall"),
66075         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66076       );
66077       context.on("exit.intro", function() {
66078         continueTo(clickTownHall);
66079       });
66080       context.history().on("change.intro", function() {
66081         if (!context.hasEntity(hallId)) {
66082           continueTo(clickTownHall);
66083         }
66084       });
66085       function continueTo(nextStep) {
66086         context.on("exit.intro", null);
66087         context.history().on("change.intro", null);
66088         context.container().select(".inspector-wrap").on("wheel.intro", null);
66089         nextStep();
66090       }
66091     }
66092     function presetTownHall() {
66093       if (!isTownHallSelected()) return clickTownHall();
66094       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66095       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66096       var entity = context.entity(context.selectedIDs()[0]);
66097       var preset = _mainPresetIndex.match(entity, context.graph());
66098       var onClick = function() {
66099         continueTo(fieldsTownHall);
66100       };
66101       reveal(
66102         ".entity-editor-pane .section-feature-type",
66103         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
66104         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66105       );
66106       context.on("exit.intro", function() {
66107         continueTo(clickTownHall);
66108       });
66109       context.history().on("change.intro", function() {
66110         if (!context.hasEntity(hallId)) {
66111           continueTo(clickTownHall);
66112         }
66113       });
66114       function continueTo(nextStep) {
66115         context.on("exit.intro", null);
66116         context.history().on("change.intro", null);
66117         context.container().select(".inspector-wrap").on("wheel.intro", null);
66118         nextStep();
66119       }
66120     }
66121     function fieldsTownHall() {
66122       if (!isTownHallSelected()) return clickTownHall();
66123       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66124       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66125       var onClick = function() {
66126         continueTo(closeTownHall);
66127       };
66128       reveal(
66129         ".entity-editor-pane .section-preset-fields",
66130         helpHtml("intro.navigation.fields_townhall"),
66131         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66132       );
66133       context.on("exit.intro", function() {
66134         continueTo(clickTownHall);
66135       });
66136       context.history().on("change.intro", function() {
66137         if (!context.hasEntity(hallId)) {
66138           continueTo(clickTownHall);
66139         }
66140       });
66141       function continueTo(nextStep) {
66142         context.on("exit.intro", null);
66143         context.history().on("change.intro", null);
66144         context.container().select(".inspector-wrap").on("wheel.intro", null);
66145         nextStep();
66146       }
66147     }
66148     function closeTownHall() {
66149       if (!isTownHallSelected()) return clickTownHall();
66150       var selector = ".entity-editor-pane button.close svg use";
66151       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66152       reveal(
66153         ".entity-editor-pane",
66154         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
66155       );
66156       context.on("exit.intro", function() {
66157         continueTo(searchStreet);
66158       });
66159       context.history().on("change.intro", function() {
66160         var selector2 = ".entity-editor-pane button.close svg use";
66161         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
66162         reveal(
66163           ".entity-editor-pane",
66164           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
66165           { duration: 0 }
66166         );
66167       });
66168       function continueTo(nextStep) {
66169         context.on("exit.intro", null);
66170         context.history().on("change.intro", null);
66171         nextStep();
66172       }
66173     }
66174     function searchStreet() {
66175       context.enter(modeBrowse(context));
66176       context.history().reset("initial");
66177       var msec = transitionTime(springStreet, context.map().center());
66178       if (msec) {
66179         reveal(null, null, { duration: 0 });
66180       }
66181       context.map().centerZoomEase(springStreet, 19, msec);
66182       timeout2(function() {
66183         reveal(
66184           ".search-header input",
66185           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
66186         );
66187         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
66188       }, msec + 100);
66189     }
66190     function checkSearchResult() {
66191       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
66192       var firstName = first.select(".entity-name");
66193       var name = _t("intro.graph.name.spring-street");
66194       if (!firstName.empty() && firstName.html() === name) {
66195         reveal(
66196           first.node(),
66197           helpHtml("intro.navigation.choose_street", { name }),
66198           { duration: 300 }
66199         );
66200         context.on("exit.intro", function() {
66201           continueTo(selectedStreet);
66202         });
66203         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66204       }
66205       function continueTo(nextStep) {
66206         context.on("exit.intro", null);
66207         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
66208         nextStep();
66209       }
66210     }
66211     function selectedStreet() {
66212       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
66213         return searchStreet();
66214       }
66215       var onClick = function() {
66216         continueTo(editorStreet);
66217       };
66218       var entity = context.entity(springStreetEndId);
66219       var box = pointBox(entity.loc, context);
66220       box.height = 500;
66221       reveal(
66222         box,
66223         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
66224         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66225       );
66226       timeout2(function() {
66227         context.map().on("move.intro drawn.intro", function() {
66228           var entity2 = context.hasEntity(springStreetEndId);
66229           if (!entity2) return;
66230           var box2 = pointBox(entity2.loc, context);
66231           box2.height = 500;
66232           reveal(
66233             box2,
66234             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
66235             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66236           );
66237         });
66238       }, 600);
66239       context.on("enter.intro", function(mode) {
66240         if (!context.hasEntity(springStreetId)) {
66241           return continueTo(searchStreet);
66242         }
66243         var ids = context.selectedIDs();
66244         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
66245           context.enter(modeSelect(context, [springStreetId]));
66246         }
66247       });
66248       context.history().on("change.intro", function() {
66249         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
66250           timeout2(function() {
66251             continueTo(searchStreet);
66252           }, 300);
66253         }
66254       });
66255       function continueTo(nextStep) {
66256         context.map().on("move.intro drawn.intro", null);
66257         context.on("enter.intro", null);
66258         context.history().on("change.intro", null);
66259         nextStep();
66260       }
66261     }
66262     function editorStreet() {
66263       var selector = ".entity-editor-pane button.close svg use";
66264       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66265       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
66266         button: { html: icon(href, "inline") },
66267         field1: onewayField.title(),
66268         field2: maxspeedField.title()
66269       }));
66270       context.on("exit.intro", function() {
66271         continueTo(play);
66272       });
66273       context.history().on("change.intro", function() {
66274         var selector2 = ".entity-editor-pane button.close svg use";
66275         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
66276         reveal(
66277           ".entity-editor-pane",
66278           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
66279             button: { html: icon(href2, "inline") },
66280             field1: onewayField.title(),
66281             field2: maxspeedField.title()
66282           }),
66283           { duration: 0 }
66284         );
66285       });
66286       function continueTo(nextStep) {
66287         context.on("exit.intro", null);
66288         context.history().on("change.intro", null);
66289         nextStep();
66290       }
66291     }
66292     function play() {
66293       dispatch14.call("done");
66294       reveal(
66295         ".ideditor",
66296         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
66297         {
66298           tooltipBox: ".intro-nav-wrap .chapter-point",
66299           buttonText: _t.html("intro.ok"),
66300           buttonCallback: function() {
66301             reveal(".ideditor");
66302           }
66303         }
66304       );
66305     }
66306     chapter.enter = function() {
66307       dragMap();
66308     };
66309     chapter.exit = function() {
66310       timeouts.forEach(window.clearTimeout);
66311       context.on("enter.intro exit.intro", null);
66312       context.map().on("move.intro drawn.intro", null);
66313       context.history().on("change.intro", null);
66314       context.container().select(".inspector-wrap").on("wheel.intro", null);
66315       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
66316     };
66317     chapter.restart = function() {
66318       chapter.exit();
66319       chapter.enter();
66320     };
66321     return utilRebind(chapter, dispatch14, "on");
66322   }
66323   var init_navigation = __esm({
66324     "modules/ui/intro/navigation.js"() {
66325       "use strict";
66326       init_src4();
66327       init_src5();
66328       init_presets();
66329       init_localizer();
66330       init_browse();
66331       init_select5();
66332       init_rebind();
66333       init_helper();
66334     }
66335   });
66336
66337   // modules/ui/intro/point.js
66338   var point_exports = {};
66339   __export(point_exports, {
66340     uiIntroPoint: () => uiIntroPoint
66341   });
66342   function uiIntroPoint(context, reveal) {
66343     var dispatch14 = dispatch_default("done");
66344     var timeouts = [];
66345     var intersection2 = [-85.63279, 41.94394];
66346     var building = [-85.632422, 41.944045];
66347     var cafePreset = _mainPresetIndex.item("amenity/cafe");
66348     var _pointID = null;
66349     var chapter = {
66350       title: "intro.points.title"
66351     };
66352     function timeout2(f2, t2) {
66353       timeouts.push(window.setTimeout(f2, t2));
66354     }
66355     function eventCancel(d3_event) {
66356       d3_event.stopPropagation();
66357       d3_event.preventDefault();
66358     }
66359     function addPoint() {
66360       context.enter(modeBrowse(context));
66361       context.history().reset("initial");
66362       var msec = transitionTime(intersection2, context.map().center());
66363       if (msec) {
66364         reveal(null, null, { duration: 0 });
66365       }
66366       context.map().centerZoomEase(intersection2, 19, msec);
66367       timeout2(function() {
66368         var tooltip = reveal(
66369           "button.add-point",
66370           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
66371         );
66372         _pointID = null;
66373         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
66374         context.on("enter.intro", function(mode) {
66375           if (mode.id !== "add-point") return;
66376           continueTo(placePoint);
66377         });
66378       }, msec + 100);
66379       function continueTo(nextStep) {
66380         context.on("enter.intro", null);
66381         nextStep();
66382       }
66383     }
66384     function placePoint() {
66385       if (context.mode().id !== "add-point") {
66386         return chapter.restart();
66387       }
66388       var pointBox2 = pad2(building, 150, context);
66389       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
66390       reveal(pointBox2, helpHtml("intro.points." + textId));
66391       context.map().on("move.intro drawn.intro", function() {
66392         pointBox2 = pad2(building, 150, context);
66393         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
66394       });
66395       context.on("enter.intro", function(mode) {
66396         if (mode.id !== "select") return chapter.restart();
66397         _pointID = context.mode().selectedIDs()[0];
66398         if (context.graph().geometry(_pointID) === "vertex") {
66399           context.map().on("move.intro drawn.intro", null);
66400           context.on("enter.intro", null);
66401           reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
66402             buttonText: _t.html("intro.ok"),
66403             buttonCallback: function() {
66404               return chapter.restart();
66405             }
66406           });
66407         } else {
66408           continueTo(searchPreset);
66409         }
66410       });
66411       function continueTo(nextStep) {
66412         context.map().on("move.intro drawn.intro", null);
66413         context.on("enter.intro", null);
66414         nextStep();
66415       }
66416     }
66417     function searchPreset() {
66418       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66419         return addPoint();
66420       }
66421       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66422       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66423       reveal(
66424         ".preset-search-input",
66425         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
66426       );
66427       context.on("enter.intro", function(mode) {
66428         if (!_pointID || !context.hasEntity(_pointID)) {
66429           return continueTo(addPoint);
66430         }
66431         var ids = context.selectedIDs();
66432         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
66433           context.enter(modeSelect(context, [_pointID]));
66434           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66435           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66436           reveal(
66437             ".preset-search-input",
66438             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
66439           );
66440           context.history().on("change.intro", null);
66441         }
66442       });
66443       function checkPresetSearch() {
66444         var first = context.container().select(".preset-list-item:first-child");
66445         if (first.classed("preset-amenity-cafe")) {
66446           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66447           reveal(
66448             first.select(".preset-list-button").node(),
66449             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
66450             { duration: 300 }
66451           );
66452           context.history().on("change.intro", function() {
66453             continueTo(aboutFeatureEditor);
66454           });
66455         }
66456       }
66457       function continueTo(nextStep) {
66458         context.on("enter.intro", null);
66459         context.history().on("change.intro", null);
66460         context.container().select(".inspector-wrap").on("wheel.intro", null);
66461         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66462         nextStep();
66463       }
66464     }
66465     function aboutFeatureEditor() {
66466       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66467         return addPoint();
66468       }
66469       timeout2(function() {
66470         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
66471           tooltipClass: "intro-points-describe",
66472           buttonText: _t.html("intro.ok"),
66473           buttonCallback: function() {
66474             continueTo(addName);
66475           }
66476         });
66477       }, 400);
66478       context.on("exit.intro", function() {
66479         continueTo(reselectPoint);
66480       });
66481       function continueTo(nextStep) {
66482         context.on("exit.intro", null);
66483         nextStep();
66484       }
66485     }
66486     function addName() {
66487       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66488         return addPoint();
66489       }
66490       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66491       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name") + "{br}" + helpHtml("intro.points.add_reminder");
66492       timeout2(function() {
66493         var entity = context.entity(_pointID);
66494         if (entity.tags.name) {
66495           var tooltip = reveal(".entity-editor-pane", addNameString, {
66496             tooltipClass: "intro-points-describe",
66497             buttonText: _t.html("intro.ok"),
66498             buttonCallback: function() {
66499               continueTo(addCloseEditor);
66500             }
66501           });
66502           tooltip.select(".instruction").style("display", "none");
66503         } else {
66504           reveal(
66505             ".entity-editor-pane",
66506             addNameString,
66507             { tooltipClass: "intro-points-describe" }
66508           );
66509         }
66510       }, 400);
66511       context.history().on("change.intro", function() {
66512         continueTo(addCloseEditor);
66513       });
66514       context.on("exit.intro", function() {
66515         continueTo(reselectPoint);
66516       });
66517       function continueTo(nextStep) {
66518         context.on("exit.intro", null);
66519         context.history().on("change.intro", null);
66520         nextStep();
66521       }
66522     }
66523     function addCloseEditor() {
66524       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66525       var selector = ".entity-editor-pane button.close svg use";
66526       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66527       context.on("exit.intro", function() {
66528         continueTo(reselectPoint);
66529       });
66530       reveal(
66531         ".entity-editor-pane",
66532         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
66533       );
66534       function continueTo(nextStep) {
66535         context.on("exit.intro", null);
66536         nextStep();
66537       }
66538     }
66539     function reselectPoint() {
66540       if (!_pointID) return chapter.restart();
66541       var entity = context.hasEntity(_pointID);
66542       if (!entity) return chapter.restart();
66543       var oldPreset = _mainPresetIndex.match(entity, context.graph());
66544       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
66545       context.enter(modeBrowse(context));
66546       var msec = transitionTime(entity.loc, context.map().center());
66547       if (msec) {
66548         reveal(null, null, { duration: 0 });
66549       }
66550       context.map().centerEase(entity.loc, msec);
66551       timeout2(function() {
66552         var box = pointBox(entity.loc, context);
66553         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
66554         timeout2(function() {
66555           context.map().on("move.intro drawn.intro", function() {
66556             var entity2 = context.hasEntity(_pointID);
66557             if (!entity2) return chapter.restart();
66558             var box2 = pointBox(entity2.loc, context);
66559             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
66560           });
66561         }, 600);
66562         context.on("enter.intro", function(mode) {
66563           if (mode.id !== "select") return;
66564           continueTo(updatePoint);
66565         });
66566       }, msec + 100);
66567       function continueTo(nextStep) {
66568         context.map().on("move.intro drawn.intro", null);
66569         context.on("enter.intro", null);
66570         nextStep();
66571       }
66572     }
66573     function updatePoint() {
66574       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66575         return continueTo(reselectPoint);
66576       }
66577       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66578       context.on("exit.intro", function() {
66579         continueTo(reselectPoint);
66580       });
66581       context.history().on("change.intro", function() {
66582         continueTo(updateCloseEditor);
66583       });
66584       timeout2(function() {
66585         reveal(
66586           ".entity-editor-pane",
66587           helpHtml("intro.points.update"),
66588           { tooltipClass: "intro-points-describe" }
66589         );
66590       }, 400);
66591       function continueTo(nextStep) {
66592         context.on("exit.intro", null);
66593         context.history().on("change.intro", null);
66594         nextStep();
66595       }
66596     }
66597     function updateCloseEditor() {
66598       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66599         return continueTo(reselectPoint);
66600       }
66601       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66602       context.on("exit.intro", function() {
66603         continueTo(rightClickPoint);
66604       });
66605       timeout2(function() {
66606         reveal(
66607           ".entity-editor-pane",
66608           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
66609         );
66610       }, 500);
66611       function continueTo(nextStep) {
66612         context.on("exit.intro", null);
66613         nextStep();
66614       }
66615     }
66616     function rightClickPoint() {
66617       if (!_pointID) return chapter.restart();
66618       var entity = context.hasEntity(_pointID);
66619       if (!entity) return chapter.restart();
66620       context.enter(modeBrowse(context));
66621       var box = pointBox(entity.loc, context);
66622       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
66623       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
66624       timeout2(function() {
66625         context.map().on("move.intro", function() {
66626           var entity2 = context.hasEntity(_pointID);
66627           if (!entity2) return chapter.restart();
66628           var box2 = pointBox(entity2.loc, context);
66629           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
66630         });
66631       }, 600);
66632       context.on("enter.intro", function(mode) {
66633         if (mode.id !== "select") return;
66634         var ids = context.selectedIDs();
66635         if (ids.length !== 1 || ids[0] !== _pointID) return;
66636         timeout2(function() {
66637           var node = selectMenuItem(context, "delete").node();
66638           if (!node) return;
66639           continueTo(enterDelete);
66640         }, 50);
66641       });
66642       function continueTo(nextStep) {
66643         context.on("enter.intro", null);
66644         context.map().on("move.intro", null);
66645         nextStep();
66646       }
66647     }
66648     function enterDelete() {
66649       if (!_pointID) return chapter.restart();
66650       var entity = context.hasEntity(_pointID);
66651       if (!entity) return chapter.restart();
66652       var node = selectMenuItem(context, "delete").node();
66653       if (!node) {
66654         return continueTo(rightClickPoint);
66655       }
66656       reveal(
66657         ".edit-menu",
66658         helpHtml("intro.points.delete"),
66659         { padding: 50 }
66660       );
66661       timeout2(function() {
66662         context.map().on("move.intro", function() {
66663           if (selectMenuItem(context, "delete").empty()) {
66664             return continueTo(rightClickPoint);
66665           }
66666           reveal(
66667             ".edit-menu",
66668             helpHtml("intro.points.delete"),
66669             { duration: 0, padding: 50 }
66670           );
66671         });
66672       }, 300);
66673       context.on("exit.intro", function() {
66674         if (!_pointID) return chapter.restart();
66675         var entity2 = context.hasEntity(_pointID);
66676         if (entity2) return continueTo(rightClickPoint);
66677       });
66678       context.history().on("change.intro", function(changed) {
66679         if (changed.deleted().length) {
66680           continueTo(undo);
66681         }
66682       });
66683       function continueTo(nextStep) {
66684         context.map().on("move.intro", null);
66685         context.history().on("change.intro", null);
66686         context.on("exit.intro", null);
66687         nextStep();
66688       }
66689     }
66690     function undo() {
66691       context.history().on("change.intro", function() {
66692         continueTo(play);
66693       });
66694       reveal(
66695         ".top-toolbar button.undo-button",
66696         helpHtml("intro.points.undo")
66697       );
66698       function continueTo(nextStep) {
66699         context.history().on("change.intro", null);
66700         nextStep();
66701       }
66702     }
66703     function play() {
66704       dispatch14.call("done");
66705       reveal(
66706         ".ideditor",
66707         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
66708         {
66709           tooltipBox: ".intro-nav-wrap .chapter-area",
66710           buttonText: _t.html("intro.ok"),
66711           buttonCallback: function() {
66712             reveal(".ideditor");
66713           }
66714         }
66715       );
66716     }
66717     chapter.enter = function() {
66718       addPoint();
66719     };
66720     chapter.exit = function() {
66721       timeouts.forEach(window.clearTimeout);
66722       context.on("enter.intro exit.intro", null);
66723       context.map().on("move.intro drawn.intro", null);
66724       context.history().on("change.intro", null);
66725       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66726       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66727     };
66728     chapter.restart = function() {
66729       chapter.exit();
66730       chapter.enter();
66731     };
66732     return utilRebind(chapter, dispatch14, "on");
66733   }
66734   var init_point = __esm({
66735     "modules/ui/intro/point.js"() {
66736       "use strict";
66737       init_src4();
66738       init_src5();
66739       init_presets();
66740       init_localizer();
66741       init_change_preset();
66742       init_browse();
66743       init_select5();
66744       init_rebind();
66745       init_helper();
66746     }
66747   });
66748
66749   // modules/ui/intro/area.js
66750   var area_exports = {};
66751   __export(area_exports, {
66752     uiIntroArea: () => uiIntroArea
66753   });
66754   function uiIntroArea(context, reveal) {
66755     var dispatch14 = dispatch_default("done");
66756     var playground = [-85.63552, 41.94159];
66757     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
66758     var nameField = _mainPresetIndex.field("name");
66759     var descriptionField = _mainPresetIndex.field("description");
66760     var timeouts = [];
66761     var _areaID;
66762     var chapter = {
66763       title: "intro.areas.title"
66764     };
66765     function timeout2(f2, t2) {
66766       timeouts.push(window.setTimeout(f2, t2));
66767     }
66768     function eventCancel(d3_event) {
66769       d3_event.stopPropagation();
66770       d3_event.preventDefault();
66771     }
66772     function revealPlayground(center, text, options) {
66773       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
66774       var box = pad2(center, padding, context);
66775       reveal(box, text, options);
66776     }
66777     function addArea() {
66778       context.enter(modeBrowse(context));
66779       context.history().reset("initial");
66780       _areaID = null;
66781       var msec = transitionTime(playground, context.map().center());
66782       if (msec) {
66783         reveal(null, null, { duration: 0 });
66784       }
66785       context.map().centerZoomEase(playground, 19, msec);
66786       timeout2(function() {
66787         var tooltip = reveal(
66788           "button.add-area",
66789           helpHtml("intro.areas.add_playground")
66790         );
66791         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
66792         context.on("enter.intro", function(mode) {
66793           if (mode.id !== "add-area") return;
66794           continueTo(startPlayground);
66795         });
66796       }, msec + 100);
66797       function continueTo(nextStep) {
66798         context.on("enter.intro", null);
66799         nextStep();
66800       }
66801     }
66802     function startPlayground() {
66803       if (context.mode().id !== "add-area") {
66804         return chapter.restart();
66805       }
66806       _areaID = null;
66807       context.map().zoomEase(19.5, 500);
66808       timeout2(function() {
66809         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
66810         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
66811         revealPlayground(
66812           playground,
66813           startDrawString,
66814           { duration: 250 }
66815         );
66816         timeout2(function() {
66817           context.map().on("move.intro drawn.intro", function() {
66818             revealPlayground(
66819               playground,
66820               startDrawString,
66821               { duration: 0 }
66822             );
66823           });
66824           context.on("enter.intro", function(mode) {
66825             if (mode.id !== "draw-area") return chapter.restart();
66826             continueTo(continuePlayground);
66827           });
66828         }, 250);
66829       }, 550);
66830       function continueTo(nextStep) {
66831         context.map().on("move.intro drawn.intro", null);
66832         context.on("enter.intro", null);
66833         nextStep();
66834       }
66835     }
66836     function continuePlayground() {
66837       if (context.mode().id !== "draw-area") {
66838         return chapter.restart();
66839       }
66840       _areaID = null;
66841       revealPlayground(
66842         playground,
66843         helpHtml("intro.areas.continue_playground"),
66844         { duration: 250 }
66845       );
66846       timeout2(function() {
66847         context.map().on("move.intro drawn.intro", function() {
66848           revealPlayground(
66849             playground,
66850             helpHtml("intro.areas.continue_playground"),
66851             { duration: 0 }
66852           );
66853         });
66854       }, 250);
66855       context.on("enter.intro", function(mode) {
66856         if (mode.id === "draw-area") {
66857           var entity = context.hasEntity(context.selectedIDs()[0]);
66858           if (entity && entity.nodes.length >= 6) {
66859             return continueTo(finishPlayground);
66860           } else {
66861             return;
66862           }
66863         } else if (mode.id === "select") {
66864           _areaID = context.selectedIDs()[0];
66865           return continueTo(searchPresets);
66866         } else {
66867           return chapter.restart();
66868         }
66869       });
66870       function continueTo(nextStep) {
66871         context.map().on("move.intro drawn.intro", null);
66872         context.on("enter.intro", null);
66873         nextStep();
66874       }
66875     }
66876     function finishPlayground() {
66877       if (context.mode().id !== "draw-area") {
66878         return chapter.restart();
66879       }
66880       _areaID = null;
66881       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
66882       revealPlayground(
66883         playground,
66884         finishString,
66885         { duration: 250 }
66886       );
66887       timeout2(function() {
66888         context.map().on("move.intro drawn.intro", function() {
66889           revealPlayground(
66890             playground,
66891             finishString,
66892             { duration: 0 }
66893           );
66894         });
66895       }, 250);
66896       context.on("enter.intro", function(mode) {
66897         if (mode.id === "draw-area") {
66898           return;
66899         } else if (mode.id === "select") {
66900           _areaID = context.selectedIDs()[0];
66901           return continueTo(searchPresets);
66902         } else {
66903           return chapter.restart();
66904         }
66905       });
66906       function continueTo(nextStep) {
66907         context.map().on("move.intro drawn.intro", null);
66908         context.on("enter.intro", null);
66909         nextStep();
66910       }
66911     }
66912     function searchPresets() {
66913       if (!_areaID || !context.hasEntity(_areaID)) {
66914         return addArea();
66915       }
66916       var ids = context.selectedIDs();
66917       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
66918         context.enter(modeSelect(context, [_areaID]));
66919       }
66920       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66921       timeout2(function() {
66922         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
66923         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66924         reveal(
66925           ".preset-search-input",
66926           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
66927         );
66928       }, 400);
66929       context.on("enter.intro", function(mode) {
66930         if (!_areaID || !context.hasEntity(_areaID)) {
66931           return continueTo(addArea);
66932         }
66933         var ids2 = context.selectedIDs();
66934         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
66935           context.enter(modeSelect(context, [_areaID]));
66936           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
66937           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66938           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66939           reveal(
66940             ".preset-search-input",
66941             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
66942           );
66943           context.history().on("change.intro", null);
66944         }
66945       });
66946       function checkPresetSearch() {
66947         var first = context.container().select(".preset-list-item:first-child");
66948         if (first.classed("preset-leisure-playground")) {
66949           reveal(
66950             first.select(".preset-list-button").node(),
66951             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
66952             { duration: 300 }
66953           );
66954           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66955           context.history().on("change.intro", function() {
66956             continueTo(clickAddField);
66957           });
66958         }
66959       }
66960       function continueTo(nextStep) {
66961         context.container().select(".inspector-wrap").on("wheel.intro", null);
66962         context.on("enter.intro", null);
66963         context.history().on("change.intro", null);
66964         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66965         nextStep();
66966       }
66967     }
66968     function clickAddField() {
66969       if (!_areaID || !context.hasEntity(_areaID)) {
66970         return addArea();
66971       }
66972       var ids = context.selectedIDs();
66973       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
66974         return searchPresets();
66975       }
66976       if (!context.container().select(".form-field-description").empty()) {
66977         return continueTo(describePlayground);
66978       }
66979       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66980       timeout2(function() {
66981         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66982         var entity = context.entity(_areaID);
66983         if (entity.tags.description) {
66984           return continueTo(play);
66985         }
66986         var box = context.container().select(".more-fields").node().getBoundingClientRect();
66987         if (box.top > 300) {
66988           var pane = context.container().select(".entity-editor-pane .inspector-body");
66989           var start2 = pane.node().scrollTop;
66990           var end = start2 + (box.top - 300);
66991           pane.transition().duration(250).tween("scroll.inspector", function() {
66992             var node = this;
66993             var i3 = number_default(start2, end);
66994             return function(t2) {
66995               node.scrollTop = i3(t2);
66996             };
66997           });
66998         }
66999         timeout2(function() {
67000           reveal(
67001             ".more-fields .combobox-input",
67002             helpHtml("intro.areas.add_field", {
67003               name: nameField.title(),
67004               description: descriptionField.title()
67005             }),
67006             { duration: 300 }
67007           );
67008           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
67009             var watcher;
67010             watcher = window.setInterval(function() {
67011               if (!context.container().select("div.combobox").empty()) {
67012                 window.clearInterval(watcher);
67013                 continueTo(chooseDescriptionField);
67014               }
67015             }, 300);
67016           });
67017         }, 300);
67018       }, 400);
67019       context.on("exit.intro", function() {
67020         return continueTo(searchPresets);
67021       });
67022       function continueTo(nextStep) {
67023         context.container().select(".inspector-wrap").on("wheel.intro", null);
67024         context.container().select(".more-fields .combobox-input").on("click.intro", null);
67025         context.on("exit.intro", null);
67026         nextStep();
67027       }
67028     }
67029     function chooseDescriptionField() {
67030       if (!_areaID || !context.hasEntity(_areaID)) {
67031         return addArea();
67032       }
67033       var ids = context.selectedIDs();
67034       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67035         return searchPresets();
67036       }
67037       if (!context.container().select(".form-field-description").empty()) {
67038         return continueTo(describePlayground);
67039       }
67040       if (context.container().select("div.combobox").empty()) {
67041         return continueTo(clickAddField);
67042       }
67043       var watcher;
67044       watcher = window.setInterval(function() {
67045         if (context.container().select("div.combobox").empty()) {
67046           window.clearInterval(watcher);
67047           timeout2(function() {
67048             if (context.container().select(".form-field-description").empty()) {
67049               continueTo(retryChooseDescription);
67050             } else {
67051               continueTo(describePlayground);
67052             }
67053           }, 300);
67054         }
67055       }, 300);
67056       reveal(
67057         "div.combobox",
67058         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
67059         { duration: 300 }
67060       );
67061       context.on("exit.intro", function() {
67062         return continueTo(searchPresets);
67063       });
67064       function continueTo(nextStep) {
67065         if (watcher) window.clearInterval(watcher);
67066         context.on("exit.intro", null);
67067         nextStep();
67068       }
67069     }
67070     function describePlayground() {
67071       if (!_areaID || !context.hasEntity(_areaID)) {
67072         return addArea();
67073       }
67074       var ids = context.selectedIDs();
67075       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67076         return searchPresets();
67077       }
67078       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
67079       if (context.container().select(".form-field-description").empty()) {
67080         return continueTo(retryChooseDescription);
67081       }
67082       context.on("exit.intro", function() {
67083         continueTo(play);
67084       });
67085       reveal(
67086         ".entity-editor-pane",
67087         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
67088         { duration: 300 }
67089       );
67090       function continueTo(nextStep) {
67091         context.on("exit.intro", null);
67092         nextStep();
67093       }
67094     }
67095     function retryChooseDescription() {
67096       if (!_areaID || !context.hasEntity(_areaID)) {
67097         return addArea();
67098       }
67099       var ids = context.selectedIDs();
67100       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67101         return searchPresets();
67102       }
67103       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
67104       reveal(
67105         ".entity-editor-pane",
67106         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
67107         {
67108           buttonText: _t.html("intro.ok"),
67109           buttonCallback: function() {
67110             continueTo(clickAddField);
67111           }
67112         }
67113       );
67114       context.on("exit.intro", function() {
67115         return continueTo(searchPresets);
67116       });
67117       function continueTo(nextStep) {
67118         context.on("exit.intro", null);
67119         nextStep();
67120       }
67121     }
67122     function play() {
67123       dispatch14.call("done");
67124       reveal(
67125         ".ideditor",
67126         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
67127         {
67128           tooltipBox: ".intro-nav-wrap .chapter-line",
67129           buttonText: _t.html("intro.ok"),
67130           buttonCallback: function() {
67131             reveal(".ideditor");
67132           }
67133         }
67134       );
67135     }
67136     chapter.enter = function() {
67137       addArea();
67138     };
67139     chapter.exit = function() {
67140       timeouts.forEach(window.clearTimeout);
67141       context.on("enter.intro exit.intro", null);
67142       context.map().on("move.intro drawn.intro", null);
67143       context.history().on("change.intro", null);
67144       context.container().select(".inspector-wrap").on("wheel.intro", null);
67145       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
67146       context.container().select(".more-fields .combobox-input").on("click.intro", null);
67147     };
67148     chapter.restart = function() {
67149       chapter.exit();
67150       chapter.enter();
67151     };
67152     return utilRebind(chapter, dispatch14, "on");
67153   }
67154   var init_area4 = __esm({
67155     "modules/ui/intro/area.js"() {
67156       "use strict";
67157       init_src4();
67158       init_src8();
67159       init_presets();
67160       init_localizer();
67161       init_browse();
67162       init_select5();
67163       init_rebind();
67164       init_helper();
67165     }
67166   });
67167
67168   // modules/ui/intro/line.js
67169   var line_exports = {};
67170   __export(line_exports, {
67171     uiIntroLine: () => uiIntroLine
67172   });
67173   function uiIntroLine(context, reveal) {
67174     var dispatch14 = dispatch_default("done");
67175     var timeouts = [];
67176     var _tulipRoadID = null;
67177     var flowerRoadID = "w646";
67178     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
67179     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
67180     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
67181     var roadCategory = _mainPresetIndex.item("category-road_minor");
67182     var residentialPreset = _mainPresetIndex.item("highway/residential");
67183     var woodRoadID = "w525";
67184     var woodRoadEndID = "n2862";
67185     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
67186     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
67187     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
67188     var washingtonStreetID = "w522";
67189     var twelfthAvenueID = "w1";
67190     var eleventhAvenueEndID = "n3550";
67191     var twelfthAvenueEndID = "n5";
67192     var _washingtonSegmentID = null;
67193     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
67194     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
67195     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
67196     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
67197     var chapter = {
67198       title: "intro.lines.title"
67199     };
67200     function timeout2(f2, t2) {
67201       timeouts.push(window.setTimeout(f2, t2));
67202     }
67203     function eventCancel(d3_event) {
67204       d3_event.stopPropagation();
67205       d3_event.preventDefault();
67206     }
67207     function addLine() {
67208       context.enter(modeBrowse(context));
67209       context.history().reset("initial");
67210       var msec = transitionTime(tulipRoadStart, context.map().center());
67211       if (msec) {
67212         reveal(null, null, { duration: 0 });
67213       }
67214       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
67215       timeout2(function() {
67216         var tooltip = reveal(
67217           "button.add-line",
67218           helpHtml("intro.lines.add_line")
67219         );
67220         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
67221         context.on("enter.intro", function(mode) {
67222           if (mode.id !== "add-line") return;
67223           continueTo(startLine);
67224         });
67225       }, msec + 100);
67226       function continueTo(nextStep) {
67227         context.on("enter.intro", null);
67228         nextStep();
67229       }
67230     }
67231     function startLine() {
67232       if (context.mode().id !== "add-line") return chapter.restart();
67233       _tulipRoadID = null;
67234       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
67235       var box = pad2(tulipRoadStart, padding, context);
67236       box.height = box.height + 100;
67237       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
67238       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
67239       reveal(box, startLineString);
67240       context.map().on("move.intro drawn.intro", function() {
67241         padding = 70 * Math.pow(2, context.map().zoom() - 18);
67242         box = pad2(tulipRoadStart, padding, context);
67243         box.height = box.height + 100;
67244         reveal(box, startLineString, { duration: 0 });
67245       });
67246       context.on("enter.intro", function(mode) {
67247         if (mode.id !== "draw-line") return chapter.restart();
67248         continueTo(drawLine);
67249       });
67250       function continueTo(nextStep) {
67251         context.map().on("move.intro drawn.intro", null);
67252         context.on("enter.intro", null);
67253         nextStep();
67254       }
67255     }
67256     function drawLine() {
67257       if (context.mode().id !== "draw-line") return chapter.restart();
67258       _tulipRoadID = context.mode().selectedIDs()[0];
67259       context.map().centerEase(tulipRoadMidpoint, 500);
67260       timeout2(function() {
67261         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
67262         var box = pad2(tulipRoadMidpoint, padding, context);
67263         box.height = box.height * 2;
67264         reveal(
67265           box,
67266           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
67267         );
67268         context.map().on("move.intro drawn.intro", function() {
67269           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
67270           box = pad2(tulipRoadMidpoint, padding, context);
67271           box.height = box.height * 2;
67272           reveal(
67273             box,
67274             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
67275             { duration: 0 }
67276           );
67277         });
67278       }, 550);
67279       context.history().on("change.intro", function() {
67280         if (isLineConnected()) {
67281           continueTo(continueLine);
67282         }
67283       });
67284       context.on("enter.intro", function(mode) {
67285         if (mode.id === "draw-line") {
67286           return;
67287         } else if (mode.id === "select") {
67288           continueTo(retryIntersect);
67289           return;
67290         } else {
67291           return chapter.restart();
67292         }
67293       });
67294       function continueTo(nextStep) {
67295         context.map().on("move.intro drawn.intro", null);
67296         context.history().on("change.intro", null);
67297         context.on("enter.intro", null);
67298         nextStep();
67299       }
67300     }
67301     function isLineConnected() {
67302       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
67303       if (!entity) return false;
67304       var drawNodes = context.graph().childNodes(entity);
67305       return drawNodes.some(function(node) {
67306         return context.graph().parentWays(node).some(function(parent2) {
67307           return parent2.id === flowerRoadID;
67308         });
67309       });
67310     }
67311     function retryIntersect() {
67312       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
67313       var box = pad2(tulipRoadIntersection, 80, context);
67314       reveal(
67315         box,
67316         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
67317       );
67318       timeout2(chapter.restart, 3e3);
67319     }
67320     function continueLine() {
67321       if (context.mode().id !== "draw-line") return chapter.restart();
67322       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
67323       if (!entity) return chapter.restart();
67324       context.map().centerEase(tulipRoadIntersection, 500);
67325       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
67326       reveal(".main-map .surface", continueLineText);
67327       context.on("enter.intro", function(mode) {
67328         if (mode.id === "draw-line") {
67329           return;
67330         } else if (mode.id === "select") {
67331           return continueTo(chooseCategoryRoad);
67332         } else {
67333           return chapter.restart();
67334         }
67335       });
67336       function continueTo(nextStep) {
67337         context.on("enter.intro", null);
67338         nextStep();
67339       }
67340     }
67341     function chooseCategoryRoad() {
67342       if (context.mode().id !== "select") return chapter.restart();
67343       context.on("exit.intro", function() {
67344         return chapter.restart();
67345       });
67346       var button = context.container().select(".preset-category-road_minor .preset-list-button");
67347       if (button.empty()) return chapter.restart();
67348       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
67349       timeout2(function() {
67350         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
67351         reveal(
67352           button.node(),
67353           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
67354         );
67355         button.on("click.intro", function() {
67356           continueTo(choosePresetResidential);
67357         });
67358       }, 400);
67359       function continueTo(nextStep) {
67360         context.container().select(".inspector-wrap").on("wheel.intro", null);
67361         context.container().select(".preset-list-button").on("click.intro", null);
67362         context.on("exit.intro", null);
67363         nextStep();
67364       }
67365     }
67366     function choosePresetResidential() {
67367       if (context.mode().id !== "select") return chapter.restart();
67368       context.on("exit.intro", function() {
67369         return chapter.restart();
67370       });
67371       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
67372       if (subgrid.empty()) return chapter.restart();
67373       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
67374         continueTo(retryPresetResidential);
67375       });
67376       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
67377         continueTo(nameRoad);
67378       });
67379       timeout2(function() {
67380         reveal(
67381           subgrid.node(),
67382           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
67383           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
67384         );
67385       }, 300);
67386       function continueTo(nextStep) {
67387         context.container().select(".preset-list-button").on("click.intro", null);
67388         context.on("exit.intro", null);
67389         nextStep();
67390       }
67391     }
67392     function retryPresetResidential() {
67393       if (context.mode().id !== "select") return chapter.restart();
67394       context.on("exit.intro", function() {
67395         return chapter.restart();
67396       });
67397       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
67398       timeout2(function() {
67399         var button = context.container().select(".entity-editor-pane .preset-list-button");
67400         reveal(
67401           button.node(),
67402           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
67403         );
67404         button.on("click.intro", function() {
67405           continueTo(chooseCategoryRoad);
67406         });
67407       }, 500);
67408       function continueTo(nextStep) {
67409         context.container().select(".inspector-wrap").on("wheel.intro", null);
67410         context.container().select(".preset-list-button").on("click.intro", null);
67411         context.on("exit.intro", null);
67412         nextStep();
67413       }
67414     }
67415     function nameRoad() {
67416       context.on("exit.intro", function() {
67417         continueTo(didNameRoad);
67418       });
67419       timeout2(function() {
67420         reveal(
67421           ".entity-editor-pane",
67422           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
67423           { tooltipClass: "intro-lines-name_road" }
67424         );
67425       }, 500);
67426       function continueTo(nextStep) {
67427         context.on("exit.intro", null);
67428         nextStep();
67429       }
67430     }
67431     function didNameRoad() {
67432       context.history().checkpoint("doneAddLine");
67433       timeout2(function() {
67434         reveal(".main-map .surface", helpHtml("intro.lines.did_name_road"), {
67435           buttonText: _t.html("intro.ok"),
67436           buttonCallback: function() {
67437             continueTo(updateLine);
67438           }
67439         });
67440       }, 500);
67441       function continueTo(nextStep) {
67442         nextStep();
67443       }
67444     }
67445     function updateLine() {
67446       context.history().reset("doneAddLine");
67447       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67448         return chapter.restart();
67449       }
67450       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
67451       if (msec) {
67452         reveal(null, null, { duration: 0 });
67453       }
67454       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
67455       timeout2(function() {
67456         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
67457         var box = pad2(woodRoadDragMidpoint, padding, context);
67458         var advance = function() {
67459           continueTo(addNode);
67460         };
67461         reveal(
67462           box,
67463           helpHtml("intro.lines.update_line"),
67464           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67465         );
67466         context.map().on("move.intro drawn.intro", function() {
67467           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
67468           var box2 = pad2(woodRoadDragMidpoint, padding2, context);
67469           reveal(
67470             box2,
67471             helpHtml("intro.lines.update_line"),
67472             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67473           );
67474         });
67475       }, msec + 100);
67476       function continueTo(nextStep) {
67477         context.map().on("move.intro drawn.intro", null);
67478         nextStep();
67479       }
67480     }
67481     function addNode() {
67482       context.history().reset("doneAddLine");
67483       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67484         return chapter.restart();
67485       }
67486       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
67487       var box = pad2(woodRoadAddNode, padding, context);
67488       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
67489       reveal(box, addNodeString);
67490       context.map().on("move.intro drawn.intro", function() {
67491         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
67492         var box2 = pad2(woodRoadAddNode, padding2, context);
67493         reveal(box2, addNodeString, { duration: 0 });
67494       });
67495       context.history().on("change.intro", function(changed) {
67496         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67497           return continueTo(updateLine);
67498         }
67499         if (changed.created().length === 1) {
67500           timeout2(function() {
67501             continueTo(startDragEndpoint);
67502           }, 500);
67503         }
67504       });
67505       context.on("enter.intro", function(mode) {
67506         if (mode.id !== "select") {
67507           continueTo(updateLine);
67508         }
67509       });
67510       function continueTo(nextStep) {
67511         context.map().on("move.intro drawn.intro", null);
67512         context.history().on("change.intro", null);
67513         context.on("enter.intro", null);
67514         nextStep();
67515       }
67516     }
67517     function startDragEndpoint() {
67518       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67519         return continueTo(updateLine);
67520       }
67521       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67522       var box = pad2(woodRoadDragEndpoint, padding, context);
67523       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
67524       reveal(box, startDragString);
67525       context.map().on("move.intro drawn.intro", function() {
67526         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67527           return continueTo(updateLine);
67528         }
67529         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67530         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67531         reveal(box2, startDragString, { duration: 0 });
67532         var entity = context.entity(woodRoadEndID);
67533         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
67534           continueTo(finishDragEndpoint);
67535         }
67536       });
67537       function continueTo(nextStep) {
67538         context.map().on("move.intro drawn.intro", null);
67539         nextStep();
67540       }
67541     }
67542     function finishDragEndpoint() {
67543       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67544         return continueTo(updateLine);
67545       }
67546       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67547       var box = pad2(woodRoadDragEndpoint, padding, context);
67548       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
67549       reveal(box, finishDragString);
67550       context.map().on("move.intro drawn.intro", function() {
67551         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67552           return continueTo(updateLine);
67553         }
67554         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67555         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67556         reveal(box2, finishDragString, { duration: 0 });
67557         var entity = context.entity(woodRoadEndID);
67558         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
67559           continueTo(startDragEndpoint);
67560         }
67561       });
67562       context.on("enter.intro", function() {
67563         continueTo(startDragMidpoint);
67564       });
67565       function continueTo(nextStep) {
67566         context.map().on("move.intro drawn.intro", null);
67567         context.on("enter.intro", null);
67568         nextStep();
67569       }
67570     }
67571     function startDragMidpoint() {
67572       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67573         return continueTo(updateLine);
67574       }
67575       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
67576         context.enter(modeSelect(context, [woodRoadID]));
67577       }
67578       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
67579       var box = pad2(woodRoadDragMidpoint, padding, context);
67580       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
67581       context.map().on("move.intro drawn.intro", function() {
67582         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67583           return continueTo(updateLine);
67584         }
67585         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
67586         var box2 = pad2(woodRoadDragMidpoint, padding2, context);
67587         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
67588       });
67589       context.history().on("change.intro", function(changed) {
67590         if (changed.created().length === 1) {
67591           continueTo(continueDragMidpoint);
67592         }
67593       });
67594       context.on("enter.intro", function(mode) {
67595         if (mode.id !== "select") {
67596           context.enter(modeSelect(context, [woodRoadID]));
67597         }
67598       });
67599       function continueTo(nextStep) {
67600         context.map().on("move.intro drawn.intro", null);
67601         context.history().on("change.intro", null);
67602         context.on("enter.intro", null);
67603         nextStep();
67604       }
67605     }
67606     function continueDragMidpoint() {
67607       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67608         return continueTo(updateLine);
67609       }
67610       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67611       var box = pad2(woodRoadDragEndpoint, padding, context);
67612       box.height += 400;
67613       var advance = function() {
67614         context.history().checkpoint("doneUpdateLine");
67615         continueTo(deleteLines);
67616       };
67617       reveal(
67618         box,
67619         helpHtml("intro.lines.continue_drag_midpoint"),
67620         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67621       );
67622       context.map().on("move.intro drawn.intro", function() {
67623         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67624           return continueTo(updateLine);
67625         }
67626         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67627         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67628         box2.height += 400;
67629         reveal(
67630           box2,
67631           helpHtml("intro.lines.continue_drag_midpoint"),
67632           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67633         );
67634       });
67635       function continueTo(nextStep) {
67636         context.map().on("move.intro drawn.intro", null);
67637         nextStep();
67638       }
67639     }
67640     function deleteLines() {
67641       context.history().reset("doneUpdateLine");
67642       context.enter(modeBrowse(context));
67643       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67644         return chapter.restart();
67645       }
67646       var msec = transitionTime(deleteLinesLoc, context.map().center());
67647       if (msec) {
67648         reveal(null, null, { duration: 0 });
67649       }
67650       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
67651       timeout2(function() {
67652         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67653         var box = pad2(deleteLinesLoc, padding, context);
67654         box.top -= 200;
67655         box.height += 400;
67656         var advance = function() {
67657           continueTo(rightClickIntersection);
67658         };
67659         reveal(
67660           box,
67661           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
67662           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67663         );
67664         context.map().on("move.intro drawn.intro", function() {
67665           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67666           var box2 = pad2(deleteLinesLoc, padding2, context);
67667           box2.top -= 200;
67668           box2.height += 400;
67669           reveal(
67670             box2,
67671             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
67672             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67673           );
67674         });
67675         context.history().on("change.intro", function() {
67676           timeout2(function() {
67677             continueTo(deleteLines);
67678           }, 500);
67679         });
67680       }, msec + 100);
67681       function continueTo(nextStep) {
67682         context.map().on("move.intro drawn.intro", null);
67683         context.history().on("change.intro", null);
67684         nextStep();
67685       }
67686     }
67687     function rightClickIntersection() {
67688       context.history().reset("doneUpdateLine");
67689       context.enter(modeBrowse(context));
67690       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
67691       var rightClickString = helpHtml("intro.lines.split_street", {
67692         street1: _t("intro.graph.name.11th-avenue"),
67693         street2: _t("intro.graph.name.washington-street")
67694       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
67695       timeout2(function() {
67696         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
67697         var box = pad2(eleventhAvenueEnd, padding, context);
67698         reveal(box, rightClickString);
67699         context.map().on("move.intro drawn.intro", function() {
67700           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
67701           var box2 = pad2(eleventhAvenueEnd, padding2, context);
67702           reveal(
67703             box2,
67704             rightClickString,
67705             { duration: 0 }
67706           );
67707         });
67708         context.on("enter.intro", function(mode) {
67709           if (mode.id !== "select") return;
67710           var ids = context.selectedIDs();
67711           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return;
67712           timeout2(function() {
67713             var node = selectMenuItem(context, "split").node();
67714             if (!node) return;
67715             continueTo(splitIntersection);
67716           }, 50);
67717         });
67718         context.history().on("change.intro", function() {
67719           timeout2(function() {
67720             continueTo(deleteLines);
67721           }, 300);
67722         });
67723       }, 600);
67724       function continueTo(nextStep) {
67725         context.map().on("move.intro drawn.intro", null);
67726         context.on("enter.intro", null);
67727         context.history().on("change.intro", null);
67728         nextStep();
67729       }
67730     }
67731     function splitIntersection() {
67732       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67733         return continueTo(deleteLines);
67734       }
67735       var node = selectMenuItem(context, "split").node();
67736       if (!node) {
67737         return continueTo(rightClickIntersection);
67738       }
67739       var wasChanged = false;
67740       _washingtonSegmentID = null;
67741       reveal(
67742         ".edit-menu",
67743         helpHtml(
67744           "intro.lines.split_intersection",
67745           { street: _t("intro.graph.name.washington-street") }
67746         ),
67747         { padding: 50 }
67748       );
67749       context.map().on("move.intro drawn.intro", function() {
67750         var node2 = selectMenuItem(context, "split").node();
67751         if (!wasChanged && !node2) {
67752           return continueTo(rightClickIntersection);
67753         }
67754         reveal(
67755           ".edit-menu",
67756           helpHtml(
67757             "intro.lines.split_intersection",
67758             { street: _t("intro.graph.name.washington-street") }
67759           ),
67760           { duration: 0, padding: 50 }
67761         );
67762       });
67763       context.history().on("change.intro", function(changed) {
67764         wasChanged = true;
67765         timeout2(function() {
67766           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
67767             _washingtonSegmentID = changed.created()[0].id;
67768             continueTo(didSplit);
67769           } else {
67770             _washingtonSegmentID = null;
67771             continueTo(retrySplit);
67772           }
67773         }, 300);
67774       });
67775       function continueTo(nextStep) {
67776         context.map().on("move.intro drawn.intro", null);
67777         context.history().on("change.intro", null);
67778         nextStep();
67779       }
67780     }
67781     function retrySplit() {
67782       context.enter(modeBrowse(context));
67783       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
67784       var advance = function() {
67785         continueTo(rightClickIntersection);
67786       };
67787       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
67788       var box = pad2(eleventhAvenueEnd, padding, context);
67789       reveal(
67790         box,
67791         helpHtml("intro.lines.retry_split"),
67792         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67793       );
67794       context.map().on("move.intro drawn.intro", function() {
67795         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
67796         var box2 = pad2(eleventhAvenueEnd, padding2, context);
67797         reveal(
67798           box2,
67799           helpHtml("intro.lines.retry_split"),
67800           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67801         );
67802       });
67803       function continueTo(nextStep) {
67804         context.map().on("move.intro drawn.intro", null);
67805         nextStep();
67806       }
67807     }
67808     function didSplit() {
67809       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67810         return continueTo(rightClickIntersection);
67811       }
67812       var ids = context.selectedIDs();
67813       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
67814       var street = _t("intro.graph.name.washington-street");
67815       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67816       var box = pad2(twelfthAvenue, padding, context);
67817       box.width = box.width / 2;
67818       reveal(
67819         box,
67820         helpHtml(string, { street1: street, street2: street }),
67821         { duration: 500 }
67822       );
67823       timeout2(function() {
67824         context.map().centerZoomEase(twelfthAvenue, 18, 500);
67825         context.map().on("move.intro drawn.intro", function() {
67826           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67827           var box2 = pad2(twelfthAvenue, padding2, context);
67828           box2.width = box2.width / 2;
67829           reveal(
67830             box2,
67831             helpHtml(string, { street1: street, street2: street }),
67832             { duration: 0 }
67833           );
67834         });
67835       }, 600);
67836       context.on("enter.intro", function() {
67837         var ids2 = context.selectedIDs();
67838         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
67839           continueTo(multiSelect2);
67840         }
67841       });
67842       context.history().on("change.intro", function() {
67843         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67844           return continueTo(rightClickIntersection);
67845         }
67846       });
67847       function continueTo(nextStep) {
67848         context.map().on("move.intro drawn.intro", null);
67849         context.on("enter.intro", null);
67850         context.history().on("change.intro", null);
67851         nextStep();
67852       }
67853     }
67854     function multiSelect2() {
67855       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67856         return continueTo(rightClickIntersection);
67857       }
67858       var ids = context.selectedIDs();
67859       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
67860       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
67861       if (hasWashington && hasTwelfth) {
67862         return continueTo(multiRightClick);
67863       } else if (!hasWashington && !hasTwelfth) {
67864         return continueTo(didSplit);
67865       }
67866       context.map().centerZoomEase(twelfthAvenue, 18, 500);
67867       timeout2(function() {
67868         var selected, other, padding, box;
67869         if (hasWashington) {
67870           selected = _t("intro.graph.name.washington-street");
67871           other = _t("intro.graph.name.12th-avenue");
67872           padding = 60 * Math.pow(2, context.map().zoom() - 18);
67873           box = pad2(twelfthAvenueEnd, padding, context);
67874           box.width *= 3;
67875         } else {
67876           selected = _t("intro.graph.name.12th-avenue");
67877           other = _t("intro.graph.name.washington-street");
67878           padding = 200 * Math.pow(2, context.map().zoom() - 18);
67879           box = pad2(twelfthAvenue, padding, context);
67880           box.width /= 2;
67881         }
67882         reveal(
67883           box,
67884           helpHtml(
67885             "intro.lines.multi_select",
67886             { selected, other1: other }
67887           ) + " " + helpHtml(
67888             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
67889             { selected, other2: other }
67890           )
67891         );
67892         context.map().on("move.intro drawn.intro", function() {
67893           if (hasWashington) {
67894             selected = _t("intro.graph.name.washington-street");
67895             other = _t("intro.graph.name.12th-avenue");
67896             padding = 60 * Math.pow(2, context.map().zoom() - 18);
67897             box = pad2(twelfthAvenueEnd, padding, context);
67898             box.width *= 3;
67899           } else {
67900             selected = _t("intro.graph.name.12th-avenue");
67901             other = _t("intro.graph.name.washington-street");
67902             padding = 200 * Math.pow(2, context.map().zoom() - 18);
67903             box = pad2(twelfthAvenue, padding, context);
67904             box.width /= 2;
67905           }
67906           reveal(
67907             box,
67908             helpHtml(
67909               "intro.lines.multi_select",
67910               { selected, other1: other }
67911             ) + " " + helpHtml(
67912               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
67913               { selected, other2: other }
67914             ),
67915             { duration: 0 }
67916           );
67917         });
67918         context.on("enter.intro", function() {
67919           continueTo(multiSelect2);
67920         });
67921         context.history().on("change.intro", function() {
67922           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67923             return continueTo(rightClickIntersection);
67924           }
67925         });
67926       }, 600);
67927       function continueTo(nextStep) {
67928         context.map().on("move.intro drawn.intro", null);
67929         context.on("enter.intro", null);
67930         context.history().on("change.intro", null);
67931         nextStep();
67932       }
67933     }
67934     function multiRightClick() {
67935       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67936         return continueTo(rightClickIntersection);
67937       }
67938       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67939       var box = pad2(twelfthAvenue, padding, context);
67940       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
67941       reveal(box, rightClickString);
67942       context.map().on("move.intro drawn.intro", function() {
67943         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67944         var box2 = pad2(twelfthAvenue, padding2, context);
67945         reveal(box2, rightClickString, { duration: 0 });
67946       });
67947       context.ui().editMenu().on("toggled.intro", function(open) {
67948         if (!open) return;
67949         timeout2(function() {
67950           var ids = context.selectedIDs();
67951           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
67952             var node = selectMenuItem(context, "delete").node();
67953             if (!node) return;
67954             continueTo(multiDelete);
67955           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
67956             return continueTo(multiSelect2);
67957           } else {
67958             return continueTo(didSplit);
67959           }
67960         }, 300);
67961       });
67962       context.history().on("change.intro", function() {
67963         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67964           return continueTo(rightClickIntersection);
67965         }
67966       });
67967       function continueTo(nextStep) {
67968         context.map().on("move.intro drawn.intro", null);
67969         context.ui().editMenu().on("toggled.intro", null);
67970         context.history().on("change.intro", null);
67971         nextStep();
67972       }
67973     }
67974     function multiDelete() {
67975       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67976         return continueTo(rightClickIntersection);
67977       }
67978       var node = selectMenuItem(context, "delete").node();
67979       if (!node) return continueTo(multiRightClick);
67980       reveal(
67981         ".edit-menu",
67982         helpHtml("intro.lines.multi_delete"),
67983         { padding: 50 }
67984       );
67985       context.map().on("move.intro drawn.intro", function() {
67986         reveal(
67987           ".edit-menu",
67988           helpHtml("intro.lines.multi_delete"),
67989           { duration: 0, padding: 50 }
67990         );
67991       });
67992       context.on("exit.intro", function() {
67993         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
67994           return continueTo(multiSelect2);
67995         }
67996       });
67997       context.history().on("change.intro", function() {
67998         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
67999           continueTo(retryDelete);
68000         } else {
68001           continueTo(play);
68002         }
68003       });
68004       function continueTo(nextStep) {
68005         context.map().on("move.intro drawn.intro", null);
68006         context.on("exit.intro", null);
68007         context.history().on("change.intro", null);
68008         nextStep();
68009       }
68010     }
68011     function retryDelete() {
68012       context.enter(modeBrowse(context));
68013       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
68014       var box = pad2(twelfthAvenue, padding, context);
68015       reveal(box, helpHtml("intro.lines.retry_delete"), {
68016         buttonText: _t.html("intro.ok"),
68017         buttonCallback: function() {
68018           continueTo(multiSelect2);
68019         }
68020       });
68021       function continueTo(nextStep) {
68022         nextStep();
68023       }
68024     }
68025     function play() {
68026       dispatch14.call("done");
68027       reveal(
68028         ".ideditor",
68029         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
68030         {
68031           tooltipBox: ".intro-nav-wrap .chapter-building",
68032           buttonText: _t.html("intro.ok"),
68033           buttonCallback: function() {
68034             reveal(".ideditor");
68035           }
68036         }
68037       );
68038     }
68039     chapter.enter = function() {
68040       addLine();
68041     };
68042     chapter.exit = function() {
68043       timeouts.forEach(window.clearTimeout);
68044       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
68045       context.on("enter.intro exit.intro", null);
68046       context.map().on("move.intro drawn.intro", null);
68047       context.history().on("change.intro", null);
68048       context.container().select(".inspector-wrap").on("wheel.intro", null);
68049       context.container().select(".preset-list-button").on("click.intro", null);
68050     };
68051     chapter.restart = function() {
68052       chapter.exit();
68053       chapter.enter();
68054     };
68055     return utilRebind(chapter, dispatch14, "on");
68056   }
68057   var init_line2 = __esm({
68058     "modules/ui/intro/line.js"() {
68059       "use strict";
68060       init_src4();
68061       init_src5();
68062       init_presets();
68063       init_localizer();
68064       init_geo2();
68065       init_browse();
68066       init_select5();
68067       init_rebind();
68068       init_helper();
68069     }
68070   });
68071
68072   // modules/ui/intro/building.js
68073   var building_exports = {};
68074   __export(building_exports, {
68075     uiIntroBuilding: () => uiIntroBuilding
68076   });
68077   function uiIntroBuilding(context, reveal) {
68078     var dispatch14 = dispatch_default("done");
68079     var house = [-85.62815, 41.95638];
68080     var tank = [-85.62732, 41.95347];
68081     var buildingCatetory = _mainPresetIndex.item("category-building");
68082     var housePreset = _mainPresetIndex.item("building/house");
68083     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
68084     var timeouts = [];
68085     var _houseID = null;
68086     var _tankID = null;
68087     var chapter = {
68088       title: "intro.buildings.title"
68089     };
68090     function timeout2(f2, t2) {
68091       timeouts.push(window.setTimeout(f2, t2));
68092     }
68093     function eventCancel(d3_event) {
68094       d3_event.stopPropagation();
68095       d3_event.preventDefault();
68096     }
68097     function revealHouse(center, text, options) {
68098       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
68099       var box = pad2(center, padding, context);
68100       reveal(box, text, options);
68101     }
68102     function revealTank(center, text, options) {
68103       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
68104       var box = pad2(center, padding, context);
68105       reveal(box, text, options);
68106     }
68107     function addHouse() {
68108       context.enter(modeBrowse(context));
68109       context.history().reset("initial");
68110       _houseID = null;
68111       var msec = transitionTime(house, context.map().center());
68112       if (msec) {
68113         reveal(null, null, { duration: 0 });
68114       }
68115       context.map().centerZoomEase(house, 19, msec);
68116       timeout2(function() {
68117         var tooltip = reveal(
68118           "button.add-area",
68119           helpHtml("intro.buildings.add_building")
68120         );
68121         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
68122         context.on("enter.intro", function(mode) {
68123           if (mode.id !== "add-area") return;
68124           continueTo(startHouse);
68125         });
68126       }, msec + 100);
68127       function continueTo(nextStep) {
68128         context.on("enter.intro", null);
68129         nextStep();
68130       }
68131     }
68132     function startHouse() {
68133       if (context.mode().id !== "add-area") {
68134         return continueTo(addHouse);
68135       }
68136       _houseID = null;
68137       context.map().zoomEase(20, 500);
68138       timeout2(function() {
68139         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
68140         revealHouse(house, startString);
68141         context.map().on("move.intro drawn.intro", function() {
68142           revealHouse(house, startString, { duration: 0 });
68143         });
68144         context.on("enter.intro", function(mode) {
68145           if (mode.id !== "draw-area") return chapter.restart();
68146           continueTo(continueHouse);
68147         });
68148       }, 550);
68149       function continueTo(nextStep) {
68150         context.map().on("move.intro drawn.intro", null);
68151         context.on("enter.intro", null);
68152         nextStep();
68153       }
68154     }
68155     function continueHouse() {
68156       if (context.mode().id !== "draw-area") {
68157         return continueTo(addHouse);
68158       }
68159       _houseID = null;
68160       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
68161       revealHouse(house, continueString);
68162       context.map().on("move.intro drawn.intro", function() {
68163         revealHouse(house, continueString, { duration: 0 });
68164       });
68165       context.on("enter.intro", function(mode) {
68166         if (mode.id === "draw-area") {
68167           return;
68168         } else if (mode.id === "select") {
68169           var graph = context.graph();
68170           var way = context.entity(context.selectedIDs()[0]);
68171           var nodes = graph.childNodes(way);
68172           var points = utilArrayUniq(nodes).map(function(n3) {
68173             return context.projection(n3.loc);
68174           });
68175           if (isMostlySquare(points)) {
68176             _houseID = way.id;
68177             return continueTo(chooseCategoryBuilding);
68178           } else {
68179             return continueTo(retryHouse);
68180           }
68181         } else {
68182           return chapter.restart();
68183         }
68184       });
68185       function continueTo(nextStep) {
68186         context.map().on("move.intro drawn.intro", null);
68187         context.on("enter.intro", null);
68188         nextStep();
68189       }
68190     }
68191     function retryHouse() {
68192       var onClick = function() {
68193         continueTo(addHouse);
68194       };
68195       revealHouse(
68196         house,
68197         helpHtml("intro.buildings.retry_building"),
68198         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
68199       );
68200       context.map().on("move.intro drawn.intro", function() {
68201         revealHouse(
68202           house,
68203           helpHtml("intro.buildings.retry_building"),
68204           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
68205         );
68206       });
68207       function continueTo(nextStep) {
68208         context.map().on("move.intro drawn.intro", null);
68209         nextStep();
68210       }
68211     }
68212     function chooseCategoryBuilding() {
68213       if (!_houseID || !context.hasEntity(_houseID)) {
68214         return addHouse();
68215       }
68216       var ids = context.selectedIDs();
68217       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68218         context.enter(modeSelect(context, [_houseID]));
68219       }
68220       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68221       timeout2(function() {
68222         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68223         var button = context.container().select(".preset-category-building .preset-list-button");
68224         reveal(
68225           button.node(),
68226           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
68227         );
68228         button.on("click.intro", function() {
68229           button.on("click.intro", null);
68230           continueTo(choosePresetHouse);
68231         });
68232       }, 400);
68233       context.on("enter.intro", function(mode) {
68234         if (!_houseID || !context.hasEntity(_houseID)) {
68235           return continueTo(addHouse);
68236         }
68237         var ids2 = context.selectedIDs();
68238         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
68239           return continueTo(chooseCategoryBuilding);
68240         }
68241       });
68242       function continueTo(nextStep) {
68243         context.container().select(".inspector-wrap").on("wheel.intro", null);
68244         context.container().select(".preset-list-button").on("click.intro", null);
68245         context.on("enter.intro", null);
68246         nextStep();
68247       }
68248     }
68249     function choosePresetHouse() {
68250       if (!_houseID || !context.hasEntity(_houseID)) {
68251         return addHouse();
68252       }
68253       var ids = context.selectedIDs();
68254       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68255         context.enter(modeSelect(context, [_houseID]));
68256       }
68257       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68258       timeout2(function() {
68259         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68260         var button = context.container().select(".preset-building-house .preset-list-button");
68261         reveal(
68262           button.node(),
68263           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
68264           { duration: 300 }
68265         );
68266         button.on("click.intro", function() {
68267           button.on("click.intro", null);
68268           continueTo(closeEditorHouse);
68269         });
68270       }, 400);
68271       context.on("enter.intro", function(mode) {
68272         if (!_houseID || !context.hasEntity(_houseID)) {
68273           return continueTo(addHouse);
68274         }
68275         var ids2 = context.selectedIDs();
68276         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
68277           return continueTo(chooseCategoryBuilding);
68278         }
68279       });
68280       function continueTo(nextStep) {
68281         context.container().select(".inspector-wrap").on("wheel.intro", null);
68282         context.container().select(".preset-list-button").on("click.intro", null);
68283         context.on("enter.intro", null);
68284         nextStep();
68285       }
68286     }
68287     function closeEditorHouse() {
68288       if (!_houseID || !context.hasEntity(_houseID)) {
68289         return addHouse();
68290       }
68291       var ids = context.selectedIDs();
68292       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68293         context.enter(modeSelect(context, [_houseID]));
68294       }
68295       context.history().checkpoint("hasHouse");
68296       context.on("exit.intro", function() {
68297         continueTo(rightClickHouse);
68298       });
68299       timeout2(function() {
68300         reveal(
68301           ".entity-editor-pane",
68302           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
68303         );
68304       }, 500);
68305       function continueTo(nextStep) {
68306         context.on("exit.intro", null);
68307         nextStep();
68308       }
68309     }
68310     function rightClickHouse() {
68311       if (!_houseID) return chapter.restart();
68312       context.enter(modeBrowse(context));
68313       context.history().reset("hasHouse");
68314       var zoom = context.map().zoom();
68315       if (zoom < 20) {
68316         zoom = 20;
68317       }
68318       context.map().centerZoomEase(house, zoom, 500);
68319       context.on("enter.intro", function(mode) {
68320         if (mode.id !== "select") return;
68321         var ids = context.selectedIDs();
68322         if (ids.length !== 1 || ids[0] !== _houseID) return;
68323         timeout2(function() {
68324           var node = selectMenuItem(context, "orthogonalize").node();
68325           if (!node) return;
68326           continueTo(clickSquare);
68327         }, 50);
68328       });
68329       context.map().on("move.intro drawn.intro", function() {
68330         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
68331         revealHouse(house, rightclickString, { duration: 0 });
68332       });
68333       context.history().on("change.intro", function() {
68334         continueTo(rightClickHouse);
68335       });
68336       function continueTo(nextStep) {
68337         context.on("enter.intro", null);
68338         context.map().on("move.intro drawn.intro", null);
68339         context.history().on("change.intro", null);
68340         nextStep();
68341       }
68342     }
68343     function clickSquare() {
68344       if (!_houseID) return chapter.restart();
68345       var entity = context.hasEntity(_houseID);
68346       if (!entity) return continueTo(rightClickHouse);
68347       var node = selectMenuItem(context, "orthogonalize").node();
68348       if (!node) {
68349         return continueTo(rightClickHouse);
68350       }
68351       var wasChanged = false;
68352       reveal(
68353         ".edit-menu",
68354         helpHtml("intro.buildings.square_building"),
68355         { padding: 50 }
68356       );
68357       context.on("enter.intro", function(mode) {
68358         if (mode.id === "browse") {
68359           continueTo(rightClickHouse);
68360         } else if (mode.id === "move" || mode.id === "rotate") {
68361           continueTo(retryClickSquare);
68362         }
68363       });
68364       context.map().on("move.intro", function() {
68365         var node2 = selectMenuItem(context, "orthogonalize").node();
68366         if (!wasChanged && !node2) {
68367           return continueTo(rightClickHouse);
68368         }
68369         reveal(
68370           ".edit-menu",
68371           helpHtml("intro.buildings.square_building"),
68372           { duration: 0, padding: 50 }
68373         );
68374       });
68375       context.history().on("change.intro", function() {
68376         wasChanged = true;
68377         context.history().on("change.intro", null);
68378         timeout2(function() {
68379           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
68380             continueTo(doneSquare);
68381           } else {
68382             continueTo(retryClickSquare);
68383           }
68384         }, 500);
68385       });
68386       function continueTo(nextStep) {
68387         context.on("enter.intro", null);
68388         context.map().on("move.intro", null);
68389         context.history().on("change.intro", null);
68390         nextStep();
68391       }
68392     }
68393     function retryClickSquare() {
68394       context.enter(modeBrowse(context));
68395       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
68396         buttonText: _t.html("intro.ok"),
68397         buttonCallback: function() {
68398           continueTo(rightClickHouse);
68399         }
68400       });
68401       function continueTo(nextStep) {
68402         nextStep();
68403       }
68404     }
68405     function doneSquare() {
68406       context.history().checkpoint("doneSquare");
68407       revealHouse(house, helpHtml("intro.buildings.done_square"), {
68408         buttonText: _t.html("intro.ok"),
68409         buttonCallback: function() {
68410           continueTo(addTank);
68411         }
68412       });
68413       function continueTo(nextStep) {
68414         nextStep();
68415       }
68416     }
68417     function addTank() {
68418       context.enter(modeBrowse(context));
68419       context.history().reset("doneSquare");
68420       _tankID = null;
68421       var msec = transitionTime(tank, context.map().center());
68422       if (msec) {
68423         reveal(null, null, { duration: 0 });
68424       }
68425       context.map().centerZoomEase(tank, 19.5, msec);
68426       timeout2(function() {
68427         reveal(
68428           "button.add-area",
68429           helpHtml("intro.buildings.add_tank")
68430         );
68431         context.on("enter.intro", function(mode) {
68432           if (mode.id !== "add-area") return;
68433           continueTo(startTank);
68434         });
68435       }, msec + 100);
68436       function continueTo(nextStep) {
68437         context.on("enter.intro", null);
68438         nextStep();
68439       }
68440     }
68441     function startTank() {
68442       if (context.mode().id !== "add-area") {
68443         return continueTo(addTank);
68444       }
68445       _tankID = null;
68446       timeout2(function() {
68447         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
68448         revealTank(tank, startString);
68449         context.map().on("move.intro drawn.intro", function() {
68450           revealTank(tank, startString, { duration: 0 });
68451         });
68452         context.on("enter.intro", function(mode) {
68453           if (mode.id !== "draw-area") return chapter.restart();
68454           continueTo(continueTank);
68455         });
68456       }, 550);
68457       function continueTo(nextStep) {
68458         context.map().on("move.intro drawn.intro", null);
68459         context.on("enter.intro", null);
68460         nextStep();
68461       }
68462     }
68463     function continueTank() {
68464       if (context.mode().id !== "draw-area") {
68465         return continueTo(addTank);
68466       }
68467       _tankID = null;
68468       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
68469       revealTank(tank, continueString);
68470       context.map().on("move.intro drawn.intro", function() {
68471         revealTank(tank, continueString, { duration: 0 });
68472       });
68473       context.on("enter.intro", function(mode) {
68474         if (mode.id === "draw-area") {
68475           return;
68476         } else if (mode.id === "select") {
68477           _tankID = context.selectedIDs()[0];
68478           return continueTo(searchPresetTank);
68479         } else {
68480           return continueTo(addTank);
68481         }
68482       });
68483       function continueTo(nextStep) {
68484         context.map().on("move.intro drawn.intro", null);
68485         context.on("enter.intro", null);
68486         nextStep();
68487       }
68488     }
68489     function searchPresetTank() {
68490       if (!_tankID || !context.hasEntity(_tankID)) {
68491         return addTank();
68492       }
68493       var ids = context.selectedIDs();
68494       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
68495         context.enter(modeSelect(context, [_tankID]));
68496       }
68497       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68498       timeout2(function() {
68499         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68500         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
68501         reveal(
68502           ".preset-search-input",
68503           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
68504         );
68505       }, 400);
68506       context.on("enter.intro", function(mode) {
68507         if (!_tankID || !context.hasEntity(_tankID)) {
68508           return continueTo(addTank);
68509         }
68510         var ids2 = context.selectedIDs();
68511         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
68512           context.enter(modeSelect(context, [_tankID]));
68513           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68514           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68515           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
68516           reveal(
68517             ".preset-search-input",
68518             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
68519           );
68520           context.history().on("change.intro", null);
68521         }
68522       });
68523       function checkPresetSearch() {
68524         var first = context.container().select(".preset-list-item:first-child");
68525         if (first.classed("preset-man_made-storage_tank")) {
68526           reveal(
68527             first.select(".preset-list-button").node(),
68528             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
68529             { duration: 300 }
68530           );
68531           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
68532           context.history().on("change.intro", function() {
68533             continueTo(closeEditorTank);
68534           });
68535         }
68536       }
68537       function continueTo(nextStep) {
68538         context.container().select(".inspector-wrap").on("wheel.intro", null);
68539         context.on("enter.intro", null);
68540         context.history().on("change.intro", null);
68541         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
68542         nextStep();
68543       }
68544     }
68545     function closeEditorTank() {
68546       if (!_tankID || !context.hasEntity(_tankID)) {
68547         return addTank();
68548       }
68549       var ids = context.selectedIDs();
68550       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
68551         context.enter(modeSelect(context, [_tankID]));
68552       }
68553       context.history().checkpoint("hasTank");
68554       context.on("exit.intro", function() {
68555         continueTo(rightClickTank);
68556       });
68557       timeout2(function() {
68558         reveal(
68559           ".entity-editor-pane",
68560           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
68561         );
68562       }, 500);
68563       function continueTo(nextStep) {
68564         context.on("exit.intro", null);
68565         nextStep();
68566       }
68567     }
68568     function rightClickTank() {
68569       if (!_tankID) return continueTo(addTank);
68570       context.enter(modeBrowse(context));
68571       context.history().reset("hasTank");
68572       context.map().centerEase(tank, 500);
68573       timeout2(function() {
68574         context.on("enter.intro", function(mode) {
68575           if (mode.id !== "select") return;
68576           var ids = context.selectedIDs();
68577           if (ids.length !== 1 || ids[0] !== _tankID) return;
68578           timeout2(function() {
68579             var node = selectMenuItem(context, "circularize").node();
68580             if (!node) return;
68581             continueTo(clickCircle);
68582           }, 50);
68583         });
68584         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
68585         revealTank(tank, rightclickString);
68586         context.map().on("move.intro drawn.intro", function() {
68587           revealTank(tank, rightclickString, { duration: 0 });
68588         });
68589         context.history().on("change.intro", function() {
68590           continueTo(rightClickTank);
68591         });
68592       }, 600);
68593       function continueTo(nextStep) {
68594         context.on("enter.intro", null);
68595         context.map().on("move.intro drawn.intro", null);
68596         context.history().on("change.intro", null);
68597         nextStep();
68598       }
68599     }
68600     function clickCircle() {
68601       if (!_tankID) return chapter.restart();
68602       var entity = context.hasEntity(_tankID);
68603       if (!entity) return continueTo(rightClickTank);
68604       var node = selectMenuItem(context, "circularize").node();
68605       if (!node) {
68606         return continueTo(rightClickTank);
68607       }
68608       var wasChanged = false;
68609       reveal(
68610         ".edit-menu",
68611         helpHtml("intro.buildings.circle_tank"),
68612         { padding: 50 }
68613       );
68614       context.on("enter.intro", function(mode) {
68615         if (mode.id === "browse") {
68616           continueTo(rightClickTank);
68617         } else if (mode.id === "move" || mode.id === "rotate") {
68618           continueTo(retryClickCircle);
68619         }
68620       });
68621       context.map().on("move.intro", function() {
68622         var node2 = selectMenuItem(context, "circularize").node();
68623         if (!wasChanged && !node2) {
68624           return continueTo(rightClickTank);
68625         }
68626         reveal(
68627           ".edit-menu",
68628           helpHtml("intro.buildings.circle_tank"),
68629           { duration: 0, padding: 50 }
68630         );
68631       });
68632       context.history().on("change.intro", function() {
68633         wasChanged = true;
68634         context.history().on("change.intro", null);
68635         timeout2(function() {
68636           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
68637             continueTo(play);
68638           } else {
68639             continueTo(retryClickCircle);
68640           }
68641         }, 500);
68642       });
68643       function continueTo(nextStep) {
68644         context.on("enter.intro", null);
68645         context.map().on("move.intro", null);
68646         context.history().on("change.intro", null);
68647         nextStep();
68648       }
68649     }
68650     function retryClickCircle() {
68651       context.enter(modeBrowse(context));
68652       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
68653         buttonText: _t.html("intro.ok"),
68654         buttonCallback: function() {
68655           continueTo(rightClickTank);
68656         }
68657       });
68658       function continueTo(nextStep) {
68659         nextStep();
68660       }
68661     }
68662     function play() {
68663       dispatch14.call("done");
68664       reveal(
68665         ".ideditor",
68666         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
68667         {
68668           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
68669           buttonText: _t.html("intro.ok"),
68670           buttonCallback: function() {
68671             reveal(".ideditor");
68672           }
68673         }
68674       );
68675     }
68676     chapter.enter = function() {
68677       addHouse();
68678     };
68679     chapter.exit = function() {
68680       timeouts.forEach(window.clearTimeout);
68681       context.on("enter.intro exit.intro", null);
68682       context.map().on("move.intro drawn.intro", null);
68683       context.history().on("change.intro", null);
68684       context.container().select(".inspector-wrap").on("wheel.intro", null);
68685       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
68686       context.container().select(".more-fields .combobox-input").on("click.intro", null);
68687     };
68688     chapter.restart = function() {
68689       chapter.exit();
68690       chapter.enter();
68691     };
68692     return utilRebind(chapter, dispatch14, "on");
68693   }
68694   var init_building = __esm({
68695     "modules/ui/intro/building.js"() {
68696       "use strict";
68697       init_src4();
68698       init_presets();
68699       init_localizer();
68700       init_browse();
68701       init_select5();
68702       init_util();
68703       init_helper();
68704     }
68705   });
68706
68707   // modules/ui/intro/start_editing.js
68708   var start_editing_exports = {};
68709   __export(start_editing_exports, {
68710     uiIntroStartEditing: () => uiIntroStartEditing
68711   });
68712   function uiIntroStartEditing(context, reveal) {
68713     var dispatch14 = dispatch_default("done", "startEditing");
68714     var modalSelection = select_default2(null);
68715     var chapter = {
68716       title: "intro.startediting.title"
68717     };
68718     function showHelp() {
68719       reveal(
68720         ".map-control.help-control",
68721         helpHtml("intro.startediting.help"),
68722         {
68723           buttonText: _t.html("intro.ok"),
68724           buttonCallback: function() {
68725             shortcuts();
68726           }
68727         }
68728       );
68729     }
68730     function shortcuts() {
68731       reveal(
68732         ".map-control.help-control",
68733         helpHtml("intro.startediting.shortcuts"),
68734         {
68735           buttonText: _t.html("intro.ok"),
68736           buttonCallback: function() {
68737             showSave();
68738           }
68739         }
68740       );
68741     }
68742     function showSave() {
68743       context.container().selectAll(".shaded").remove();
68744       reveal(
68745         ".top-toolbar button.save",
68746         helpHtml("intro.startediting.save"),
68747         {
68748           buttonText: _t.html("intro.ok"),
68749           buttonCallback: function() {
68750             showStart();
68751           }
68752         }
68753       );
68754     }
68755     function showStart() {
68756       context.container().selectAll(".shaded").remove();
68757       modalSelection = uiModal(context.container());
68758       modalSelection.select(".modal").attr("class", "modal-splash modal");
68759       modalSelection.selectAll(".close").remove();
68760       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
68761         modalSelection.remove();
68762       });
68763       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68764       startbutton.append("h2").call(_t.append("intro.startediting.start"));
68765       dispatch14.call("startEditing");
68766     }
68767     chapter.enter = function() {
68768       showHelp();
68769     };
68770     chapter.exit = function() {
68771       modalSelection.remove();
68772       context.container().selectAll(".shaded").remove();
68773     };
68774     return utilRebind(chapter, dispatch14, "on");
68775   }
68776   var init_start_editing = __esm({
68777     "modules/ui/intro/start_editing.js"() {
68778       "use strict";
68779       init_src4();
68780       init_src5();
68781       init_localizer();
68782       init_helper();
68783       init_modal();
68784       init_rebind();
68785     }
68786   });
68787
68788   // modules/ui/intro/intro.js
68789   var intro_exports = {};
68790   __export(intro_exports, {
68791     uiIntro: () => uiIntro
68792   });
68793   function uiIntro(context) {
68794     const INTRO_IMAGERY = "Bing";
68795     let _introGraph = {};
68796     let _currChapter;
68797     function intro(selection2) {
68798       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
68799         for (let id2 in dataIntroGraph) {
68800           if (!_introGraph[id2]) {
68801             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
68802           }
68803         }
68804         selection2.call(startIntro);
68805       }).catch(function() {
68806       });
68807     }
68808     function startIntro(selection2) {
68809       context.enter(modeBrowse(context));
68810       let osm = context.connection();
68811       let history = context.history().toJSON();
68812       let hash2 = window.location.hash;
68813       let center = context.map().center();
68814       let zoom = context.map().zoom();
68815       let background = context.background().baseLayerSource();
68816       let overlays = context.background().overlayLayerSources();
68817       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
68818       let caches = osm && osm.caches();
68819       let baseEntities = context.history().graph().base().entities;
68820       context.ui().sidebar.expand();
68821       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
68822       context.inIntro(true);
68823       if (osm) {
68824         osm.toggle(false).reset();
68825       }
68826       context.history().reset();
68827       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
68828       context.history().checkpoint("initial");
68829       let imagery = context.background().findSource(INTRO_IMAGERY);
68830       if (imagery) {
68831         context.background().baseLayerSource(imagery);
68832       } else {
68833         context.background().bing();
68834       }
68835       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
68836       let layers = context.layers();
68837       layers.all().forEach((item) => {
68838         if (typeof item.layer.enabled === "function") {
68839           item.layer.enabled(item.id === "osm");
68840         }
68841       });
68842       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
68843       let curtain = uiCurtain(context.container().node());
68844       selection2.call(curtain);
68845       corePreferences("walkthrough_started", "yes");
68846       let storedProgress = corePreferences("walkthrough_progress") || "";
68847       let progress = storedProgress.split(";").filter(Boolean);
68848       let chapters = chapterFlow.map((chapter, i3) => {
68849         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
68850           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
68851           if (i3 < chapterFlow.length - 1) {
68852             const next = chapterFlow[i3 + 1];
68853             context.container().select(`button.chapter-${next}`).classed("next", true);
68854           }
68855           progress.push(chapter);
68856           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
68857         });
68858         return s2;
68859       });
68860       chapters[chapters.length - 1].on("startEditing", () => {
68861         progress.push("startEditing");
68862         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
68863         let incomplete = utilArrayDifference(chapterFlow, progress);
68864         if (!incomplete.length) {
68865           corePreferences("walkthrough_completed", "yes");
68866         }
68867         curtain.remove();
68868         navwrap.remove();
68869         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
68870         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
68871         if (osm) {
68872           osm.toggle(true).reset().caches(caches);
68873         }
68874         context.history().reset().merge(Object.values(baseEntities));
68875         context.background().baseLayerSource(background);
68876         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
68877         if (history) {
68878           context.history().fromJSON(history, false);
68879         }
68880         context.map().centerZoom(center, zoom);
68881         window.history.replaceState(null, "", hash2);
68882         context.inIntro(false);
68883       });
68884       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
68885       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68886       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
68887       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => `chapter chapter-${chapterFlow[i3]}`).on("click", enterChapter);
68888       buttons.append("span").html((d2) => _t.html(d2.title));
68889       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
68890       enterChapter(null, chapters[0]);
68891       function enterChapter(d3_event, newChapter) {
68892         if (_currChapter) {
68893           _currChapter.exit();
68894         }
68895         context.enter(modeBrowse(context));
68896         _currChapter = newChapter;
68897         _currChapter.enter();
68898         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
68899       }
68900     }
68901     return intro;
68902   }
68903   var chapterUi, chapterFlow;
68904   var init_intro = __esm({
68905     "modules/ui/intro/intro.js"() {
68906       "use strict";
68907       init_localizer();
68908       init_helper();
68909       init_preferences();
68910       init_file_fetcher();
68911       init_graph();
68912       init_browse();
68913       init_entity();
68914       init_icon();
68915       init_curtain();
68916       init_util();
68917       init_welcome();
68918       init_navigation();
68919       init_point();
68920       init_area4();
68921       init_line2();
68922       init_building();
68923       init_start_editing();
68924       chapterUi = {
68925         welcome: uiIntroWelcome,
68926         navigation: uiIntroNavigation,
68927         point: uiIntroPoint,
68928         area: uiIntroArea,
68929         line: uiIntroLine,
68930         building: uiIntroBuilding,
68931         startEditing: uiIntroStartEditing
68932       };
68933       chapterFlow = [
68934         "welcome",
68935         "navigation",
68936         "point",
68937         "area",
68938         "line",
68939         "building",
68940         "startEditing"
68941       ];
68942     }
68943   });
68944
68945   // modules/ui/intro/index.js
68946   var intro_exports2 = {};
68947   __export(intro_exports2, {
68948     uiIntro: () => uiIntro
68949   });
68950   var init_intro2 = __esm({
68951     "modules/ui/intro/index.js"() {
68952       "use strict";
68953       init_intro();
68954     }
68955   });
68956
68957   // modules/ui/issues_info.js
68958   var issues_info_exports = {};
68959   __export(issues_info_exports, {
68960     uiIssuesInfo: () => uiIssuesInfo
68961   });
68962   function uiIssuesInfo(context) {
68963     var warningsItem = {
68964       id: "warnings",
68965       count: 0,
68966       iconID: "iD-icon-alert",
68967       descriptionID: "issues.warnings_and_errors"
68968     };
68969     var resolvedItem = {
68970       id: "resolved",
68971       count: 0,
68972       iconID: "iD-icon-apply",
68973       descriptionID: "issues.user_resolved_issues"
68974     };
68975     function update(selection2) {
68976       var shownItems = [];
68977       var liveIssues = context.validator().getIssues({
68978         what: corePreferences("validate-what") || "edited",
68979         where: corePreferences("validate-where") || "all"
68980       });
68981       if (liveIssues.length) {
68982         warningsItem.count = liveIssues.length;
68983         shownItems.push(warningsItem);
68984       }
68985       if (corePreferences("validate-what") === "all") {
68986         var resolvedIssues = context.validator().getResolvedIssues();
68987         if (resolvedIssues.length) {
68988           resolvedItem.count = resolvedIssues.length;
68989           shownItems.push(resolvedItem);
68990         }
68991       }
68992       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
68993         return d2.id;
68994       });
68995       chips.exit().remove();
68996       var enter = chips.enter().append("a").attr("class", function(d2) {
68997         return "chip " + d2.id + "-count";
68998       }).attr("href", "#").each(function(d2) {
68999         var chipSelection = select_default2(this);
69000         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
69001         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
69002           d3_event.preventDefault();
69003           tooltipBehavior.hide(select_default2(this));
69004           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
69005         });
69006         chipSelection.call(svgIcon("#" + d2.iconID));
69007       });
69008       enter.append("span").attr("class", "count");
69009       enter.merge(chips).selectAll("span.count").text(function(d2) {
69010         return d2.count.toString();
69011       });
69012     }
69013     return function(selection2) {
69014       update(selection2);
69015       context.validator().on("validated.infobox", function() {
69016         update(selection2);
69017       });
69018     };
69019   }
69020   var init_issues_info = __esm({
69021     "modules/ui/issues_info.js"() {
69022       "use strict";
69023       init_src5();
69024       init_preferences();
69025       init_icon();
69026       init_localizer();
69027       init_tooltip();
69028     }
69029   });
69030
69031   // modules/util/IntervalTasksQueue.js
69032   var IntervalTasksQueue_exports = {};
69033   __export(IntervalTasksQueue_exports, {
69034     IntervalTasksQueue: () => IntervalTasksQueue
69035   });
69036   var IntervalTasksQueue;
69037   var init_IntervalTasksQueue = __esm({
69038     "modules/util/IntervalTasksQueue.js"() {
69039       "use strict";
69040       IntervalTasksQueue = class {
69041         /**
69042          * Interval in milliseconds inside which only 1 task can execute.
69043          * e.g. if interval is 200ms, and 5 async tasks are unqueued,
69044          * they will complete in ~1s if not cleared
69045          * @param {number} intervalInMs
69046          */
69047         constructor(intervalInMs) {
69048           this.intervalInMs = intervalInMs;
69049           this.pendingHandles = [];
69050           this.time = 0;
69051         }
69052         enqueue(task) {
69053           let taskTimeout = this.time;
69054           this.time += this.intervalInMs;
69055           this.pendingHandles.push(setTimeout(() => {
69056             this.time -= this.intervalInMs;
69057             task();
69058           }, taskTimeout));
69059         }
69060         clear() {
69061           this.pendingHandles.forEach((timeoutHandle) => {
69062             clearTimeout(timeoutHandle);
69063           });
69064           this.pendingHandles = [];
69065           this.time = 0;
69066         }
69067       };
69068     }
69069   });
69070
69071   // modules/renderer/background_source.js
69072   var background_source_exports = {};
69073   __export(background_source_exports, {
69074     rendererBackgroundSource: () => rendererBackgroundSource
69075   });
69076   function localeDateString(s2) {
69077     if (!s2) return null;
69078     var options = { day: "numeric", month: "short", year: "numeric" };
69079     var d2 = new Date(s2);
69080     if (isNaN(d2.getTime())) return null;
69081     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options);
69082   }
69083   function vintageRange(vintage) {
69084     var s2;
69085     if (vintage.start || vintage.end) {
69086       s2 = vintage.start || "?";
69087       if (vintage.start !== vintage.end) {
69088         s2 += " - " + (vintage.end || "?");
69089       }
69090     }
69091     return s2;
69092   }
69093   function rendererBackgroundSource(data) {
69094     var source = Object.assign({}, data);
69095     var _offset = [0, 0];
69096     var _name = source.name;
69097     var _description = source.description;
69098     var _best = !!source.best;
69099     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
69100     source.tileSize = data.tileSize || 256;
69101     source.zoomExtent = data.zoomExtent || [0, 22];
69102     source.overzoom = data.overzoom !== false;
69103     source.offset = function(val) {
69104       if (!arguments.length) return _offset;
69105       _offset = val;
69106       return source;
69107     };
69108     source.nudge = function(val, zoomlevel) {
69109       _offset[0] += val[0] / Math.pow(2, zoomlevel);
69110       _offset[1] += val[1] / Math.pow(2, zoomlevel);
69111       return source;
69112     };
69113     source.name = function() {
69114       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69115       return _t("imagery." + id_safe + ".name", { default: escape_default(_name) });
69116     };
69117     source.label = function() {
69118       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69119       return _t.append("imagery." + id_safe + ".name", { default: escape_default(_name) });
69120     };
69121     source.hasDescription = function() {
69122       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69123       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: escape_default(_description) }).text;
69124       return descriptionText !== "";
69125     };
69126     source.description = function() {
69127       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69128       return _t.append("imagery." + id_safe + ".description", { default: escape_default(_description) });
69129     };
69130     source.best = function() {
69131       return _best;
69132     };
69133     source.area = function() {
69134       if (!data.polygon) return Number.MAX_VALUE;
69135       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
69136       return isNaN(area) ? 0 : area;
69137     };
69138     source.imageryUsed = function() {
69139       return _name || source.id;
69140     };
69141     source.template = function(val) {
69142       if (!arguments.length) return _template;
69143       if (source.id === "custom" || source.id === "Bing") {
69144         _template = val;
69145       }
69146       return source;
69147     };
69148     source.url = function(coord2) {
69149       var result = _template.replace(/#[\s\S]*/u, "");
69150       if (result === "") return result;
69151       if (!source.type || source.id === "custom") {
69152         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
69153           source.type = "wms";
69154           source.projection = "EPSG:3857";
69155         } else if (/\{(x|y)\}/.test(result)) {
69156           source.type = "tms";
69157         } else if (/\{u\}/.test(result)) {
69158           source.type = "bing";
69159         }
69160       }
69161       if (source.type === "wms") {
69162         var tileToProjectedCoords = function(x2, y2, z3) {
69163           var zoomSize = Math.pow(2, z3);
69164           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
69165           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
69166           switch (source.projection) {
69167             case "EPSG:4326":
69168               return {
69169                 x: lon * 180 / Math.PI,
69170                 y: lat * 180 / Math.PI
69171               };
69172             default:
69173               var mercCoords = mercatorRaw(lon, lat);
69174               return {
69175                 x: 2003750834e-2 / Math.PI * mercCoords[0],
69176                 y: 2003750834e-2 / Math.PI * mercCoords[1]
69177               };
69178           }
69179         };
69180         var tileSize = source.tileSize;
69181         var projection2 = source.projection;
69182         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
69183         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
69184         result = result.replace(/\{(\w+)\}/g, function(token, key) {
69185           switch (key) {
69186             case "width":
69187             case "height":
69188               return tileSize;
69189             case "proj":
69190               return projection2;
69191             case "wkid":
69192               return projection2.replace(/^EPSG:/, "");
69193             case "bbox":
69194               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
69195               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
69196                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
69197               } else {
69198                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
69199               }
69200             case "w":
69201               return minXmaxY.x;
69202             case "s":
69203               return maxXminY.y;
69204             case "n":
69205               return maxXminY.x;
69206             case "e":
69207               return minXmaxY.y;
69208             default:
69209               return token;
69210           }
69211         });
69212       } else if (source.type === "tms") {
69213         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" : "");
69214       } else if (source.type === "bing") {
69215         result = result.replace("{u}", function() {
69216           var u2 = "";
69217           for (var zoom = coord2[2]; zoom > 0; zoom--) {
69218             var b3 = 0;
69219             var mask = 1 << zoom - 1;
69220             if ((coord2[0] & mask) !== 0) b3++;
69221             if ((coord2[1] & mask) !== 0) b3 += 2;
69222             u2 += b3.toString();
69223           }
69224           return u2;
69225         });
69226       }
69227       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
69228         var subdomains = r2.split(",");
69229         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
69230       });
69231       return result;
69232     };
69233     source.validZoom = function(z3, underzoom) {
69234       if (underzoom === void 0) underzoom = 0;
69235       return source.zoomExtent[0] - underzoom <= z3 && (source.overzoom || source.zoomExtent[1] > z3);
69236     };
69237     source.isLocatorOverlay = function() {
69238       return source.id === "mapbox_locator_overlay";
69239     };
69240     source.isHidden = function() {
69241       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
69242     };
69243     source.copyrightNotices = function() {
69244     };
69245     source.getMetadata = function(center, tileCoord, callback) {
69246       var vintage = {
69247         start: localeDateString(source.startDate),
69248         end: localeDateString(source.endDate)
69249       };
69250       vintage.range = vintageRange(vintage);
69251       var metadata = { vintage };
69252       callback(null, metadata);
69253     };
69254     return source;
69255   }
69256   var isRetina, _a3;
69257   var init_background_source = __esm({
69258     "modules/renderer/background_source.js"() {
69259       "use strict";
69260       init_src2();
69261       init_src18();
69262       init_lodash();
69263       init_localizer();
69264       init_geo2();
69265       init_util();
69266       init_aes();
69267       init_IntervalTasksQueue();
69268       isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
69269       (_a3 = window.matchMedia) == null ? void 0 : _a3.call(window, `
69270         (-webkit-min-device-pixel-ratio: 2), /* Safari */
69271         (min-resolution: 2dppx),             /* standard */
69272         (min-resolution: 192dpi)             /* fallback */
69273     `).addListener(function() {
69274         isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
69275       });
69276       rendererBackgroundSource.Bing = function(data, dispatch14) {
69277         data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
69278         var bing = rendererBackgroundSource(data);
69279         var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
69280         const strictParam = "n";
69281         var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
69282         var cache = {};
69283         var inflight = {};
69284         var providers = [];
69285         var taskQueue = new IntervalTasksQueue(250);
69286         var metadataLastZoom = -1;
69287         json_default(url).then(function(json) {
69288           let imageryResource = json.resourceSets[0].resources[0];
69289           let template = imageryResource.imageUrl;
69290           let subDomains = imageryResource.imageUrlSubdomains;
69291           let subDomainNumbers = subDomains.map((subDomain) => {
69292             return subDomain.substring(1);
69293           }).join(",");
69294           template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
69295           if (!new URLSearchParams(template).has(strictParam)) {
69296             template += `&${strictParam}=z`;
69297           }
69298           bing.template(template);
69299           providers = imageryResource.imageryProviders.map(function(provider) {
69300             return {
69301               attribution: provider.attribution,
69302               areas: provider.coverageAreas.map(function(area) {
69303                 return {
69304                   zoom: [area.zoomMin, area.zoomMax],
69305                   extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
69306                 };
69307               })
69308             };
69309           });
69310           dispatch14.call("change");
69311         }).catch(function() {
69312         });
69313         bing.copyrightNotices = function(zoom, extent) {
69314           zoom = Math.min(zoom, 21);
69315           return providers.filter(function(provider) {
69316             return provider.areas.some(function(area) {
69317               return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
69318             });
69319           }).map(function(provider) {
69320             return provider.attribution;
69321           }).join(", ");
69322         };
69323         bing.getMetadata = function(center, tileCoord, callback) {
69324           var tileID = tileCoord.slice(0, 3).join("/");
69325           var zoom = Math.min(tileCoord[2], 21);
69326           var centerPoint = center[1] + "," + center[0];
69327           var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
69328           if (inflight[tileID]) return;
69329           if (!cache[tileID]) {
69330             cache[tileID] = {};
69331           }
69332           if (cache[tileID] && cache[tileID].metadata) {
69333             return callback(null, cache[tileID].metadata);
69334           }
69335           inflight[tileID] = true;
69336           if (metadataLastZoom !== tileCoord[2]) {
69337             metadataLastZoom = tileCoord[2];
69338             taskQueue.clear();
69339           }
69340           taskQueue.enqueue(() => {
69341             json_default(url2).then(function(result) {
69342               delete inflight[tileID];
69343               if (!result) {
69344                 throw new Error("Unknown Error");
69345               }
69346               var vintage = {
69347                 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
69348                 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
69349               };
69350               vintage.range = vintageRange(vintage);
69351               var metadata = { vintage };
69352               cache[tileID].metadata = metadata;
69353               if (callback) callback(null, metadata);
69354             }).catch(function(err) {
69355               delete inflight[tileID];
69356               if (callback) callback(err.message);
69357             });
69358           });
69359         };
69360         bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
69361         return bing;
69362       };
69363       rendererBackgroundSource.Esri = function(data) {
69364         if (data.template.match(/blankTile/) === null) {
69365           data.template = data.template + "?blankTile=false";
69366         }
69367         var esri = rendererBackgroundSource(data);
69368         var cache = {};
69369         var inflight = {};
69370         var _prevCenter;
69371         esri.fetchTilemap = function(center) {
69372           if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3) return;
69373           _prevCenter = center;
69374           var z3 = 20;
69375           var dummyUrl = esri.url([1, 2, 3]);
69376           var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z3));
69377           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));
69378           var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z3 + "/" + y2 + "/" + x2 + "/8/8";
69379           json_default(tilemapUrl).then(function(tilemap) {
69380             if (!tilemap) {
69381               throw new Error("Unknown Error");
69382             }
69383             var hasTiles = true;
69384             for (var i3 = 0; i3 < tilemap.data.length; i3++) {
69385               if (!tilemap.data[i3]) {
69386                 hasTiles = false;
69387                 break;
69388               }
69389             }
69390             esri.zoomExtent[1] = hasTiles ? 22 : 19;
69391           }).catch(function() {
69392           });
69393         };
69394         esri.getMetadata = function(center, tileCoord, callback) {
69395           if (esri.id !== "EsriWorldImagery") {
69396             return callback(null, {});
69397           }
69398           var tileID = tileCoord.slice(0, 3).join("/");
69399           var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
69400           var centerPoint = center[0] + "," + center[1];
69401           var unknown = _t("info_panels.background.unknown");
69402           var vintage = {};
69403           var metadata = {};
69404           if (inflight[tileID]) return;
69405           var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
69406           url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
69407           if (!cache[tileID]) {
69408             cache[tileID] = {};
69409           }
69410           if (cache[tileID] && cache[tileID].metadata) {
69411             return callback(null, cache[tileID].metadata);
69412           }
69413           inflight[tileID] = true;
69414           json_default(url).then(function(result) {
69415             delete inflight[tileID];
69416             result = result.features.map((f2) => f2.attributes).filter((a4) => a4.MinMapLevel <= zoom && a4.MaxMapLevel >= zoom)[0];
69417             if (!result) {
69418               throw new Error("Unknown Error");
69419             } else if (result.features && result.features.length < 1) {
69420               throw new Error("No Results");
69421             } else if (result.error && result.error.message) {
69422               throw new Error(result.error.message);
69423             }
69424             var captureDate = localeDateString(result.SRC_DATE2);
69425             vintage = {
69426               start: captureDate,
69427               end: captureDate,
69428               range: captureDate
69429             };
69430             metadata = {
69431               vintage,
69432               source: clean2(result.NICE_NAME),
69433               description: clean2(result.NICE_DESC),
69434               resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
69435               accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
69436             };
69437             if (isFinite(metadata.resolution)) {
69438               metadata.resolution += " m";
69439             }
69440             if (isFinite(metadata.accuracy)) {
69441               metadata.accuracy += " m";
69442             }
69443             cache[tileID].metadata = metadata;
69444             if (callback) callback(null, metadata);
69445           }).catch(function(err) {
69446             delete inflight[tileID];
69447             if (callback) callback(err.message);
69448           });
69449           function clean2(val) {
69450             return String(val).trim() || unknown;
69451           }
69452         };
69453         return esri;
69454       };
69455       rendererBackgroundSource.None = function() {
69456         var source = rendererBackgroundSource({ id: "none", template: "" });
69457         source.name = function() {
69458           return _t("background.none");
69459         };
69460         source.label = function() {
69461           return _t.append("background.none");
69462         };
69463         source.imageryUsed = function() {
69464           return null;
69465         };
69466         source.area = function() {
69467           return -1;
69468         };
69469         return source;
69470       };
69471       rendererBackgroundSource.Custom = function(template) {
69472         var source = rendererBackgroundSource({ id: "custom", template });
69473         source.name = function() {
69474           return _t("background.custom");
69475         };
69476         source.label = function() {
69477           return _t.append("background.custom");
69478         };
69479         source.imageryUsed = function() {
69480           var cleaned = source.template();
69481           if (cleaned.indexOf("?") !== -1) {
69482             var parts = cleaned.split("?", 2);
69483             var qs = utilStringQs(parts[1]);
69484             ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
69485               if (qs[param]) {
69486                 qs[param] = "{apikey}";
69487               }
69488             });
69489             cleaned = parts[0] + "?" + utilQsString(qs, true);
69490           }
69491           cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
69492           return "Custom (" + cleaned + " )";
69493         };
69494         source.area = function() {
69495           return -2;
69496         };
69497         return source;
69498       };
69499     }
69500   });
69501
69502   // node_modules/@turf/meta/dist/esm/index.js
69503   function coordEach(geojson, callback, excludeWrapCoord) {
69504     if (geojson === null) return;
69505     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;
69506     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
69507       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
69508       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
69509       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
69510       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
69511         var multiFeatureIndex = 0;
69512         var geometryIndex = 0;
69513         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
69514         if (geometry === null) continue;
69515         coords = geometry.coordinates;
69516         var geomType = geometry.type;
69517         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
69518         switch (geomType) {
69519           case null:
69520             break;
69521           case "Point":
69522             if (callback(
69523               coords,
69524               coordIndex,
69525               featureIndex,
69526               multiFeatureIndex,
69527               geometryIndex
69528             ) === false)
69529               return false;
69530             coordIndex++;
69531             multiFeatureIndex++;
69532             break;
69533           case "LineString":
69534           case "MultiPoint":
69535             for (j3 = 0; j3 < coords.length; j3++) {
69536               if (callback(
69537                 coords[j3],
69538                 coordIndex,
69539                 featureIndex,
69540                 multiFeatureIndex,
69541                 geometryIndex
69542               ) === false)
69543                 return false;
69544               coordIndex++;
69545               if (geomType === "MultiPoint") multiFeatureIndex++;
69546             }
69547             if (geomType === "LineString") multiFeatureIndex++;
69548             break;
69549           case "Polygon":
69550           case "MultiLineString":
69551             for (j3 = 0; j3 < coords.length; j3++) {
69552               for (k3 = 0; k3 < coords[j3].length - wrapShrink; k3++) {
69553                 if (callback(
69554                   coords[j3][k3],
69555                   coordIndex,
69556                   featureIndex,
69557                   multiFeatureIndex,
69558                   geometryIndex
69559                 ) === false)
69560                   return false;
69561                 coordIndex++;
69562               }
69563               if (geomType === "MultiLineString") multiFeatureIndex++;
69564               if (geomType === "Polygon") geometryIndex++;
69565             }
69566             if (geomType === "Polygon") multiFeatureIndex++;
69567             break;
69568           case "MultiPolygon":
69569             for (j3 = 0; j3 < coords.length; j3++) {
69570               geometryIndex = 0;
69571               for (k3 = 0; k3 < coords[j3].length; k3++) {
69572                 for (l2 = 0; l2 < coords[j3][k3].length - wrapShrink; l2++) {
69573                   if (callback(
69574                     coords[j3][k3][l2],
69575                     coordIndex,
69576                     featureIndex,
69577                     multiFeatureIndex,
69578                     geometryIndex
69579                   ) === false)
69580                     return false;
69581                   coordIndex++;
69582                 }
69583                 geometryIndex++;
69584               }
69585               multiFeatureIndex++;
69586             }
69587             break;
69588           case "GeometryCollection":
69589             for (j3 = 0; j3 < geometry.geometries.length; j3++)
69590               if (coordEach(geometry.geometries[j3], callback, excludeWrapCoord) === false)
69591                 return false;
69592             break;
69593           default:
69594             throw new Error("Unknown Geometry Type");
69595         }
69596       }
69597     }
69598   }
69599   var init_esm6 = __esm({
69600     "node_modules/@turf/meta/dist/esm/index.js"() {
69601     }
69602   });
69603
69604   // node_modules/@turf/bbox/dist/esm/index.js
69605   function bbox(geojson, options = {}) {
69606     if (geojson.bbox != null && true !== options.recompute) {
69607       return geojson.bbox;
69608     }
69609     const result = [Infinity, Infinity, -Infinity, -Infinity];
69610     coordEach(geojson, (coord2) => {
69611       if (result[0] > coord2[0]) {
69612         result[0] = coord2[0];
69613       }
69614       if (result[1] > coord2[1]) {
69615         result[1] = coord2[1];
69616       }
69617       if (result[2] < coord2[0]) {
69618         result[2] = coord2[0];
69619       }
69620       if (result[3] < coord2[1]) {
69621         result[3] = coord2[1];
69622       }
69623     });
69624     return result;
69625   }
69626   var turf_bbox_default;
69627   var init_esm7 = __esm({
69628     "node_modules/@turf/bbox/dist/esm/index.js"() {
69629       init_esm6();
69630       turf_bbox_default = bbox;
69631     }
69632   });
69633
69634   // modules/renderer/tile_layer.js
69635   var tile_layer_exports = {};
69636   __export(tile_layer_exports, {
69637     rendererTileLayer: () => rendererTileLayer
69638   });
69639   function rendererTileLayer(context) {
69640     var transformProp = utilPrefixCSSProperty("Transform");
69641     var tiler8 = utilTiler();
69642     var _tileSize = 256;
69643     var _projection;
69644     var _cache5 = {};
69645     var _tileOrigin;
69646     var _zoom;
69647     var _source;
69648     var _underzoom = 0;
69649     function tileSizeAtZoom(d2, z3) {
69650       return d2.tileSize * Math.pow(2, z3 - d2[2]) / d2.tileSize;
69651     }
69652     function atZoom(t2, distance) {
69653       var power = Math.pow(2, distance);
69654       return [
69655         Math.floor(t2[0] * power),
69656         Math.floor(t2[1] * power),
69657         t2[2] + distance
69658       ];
69659     }
69660     function lookUp(d2) {
69661       for (var up = -1; up > -d2[2]; up--) {
69662         var tile = atZoom(d2, up);
69663         if (_cache5[_source.url(tile)] !== false) {
69664           return tile;
69665         }
69666       }
69667     }
69668     function uniqueBy(a4, n3) {
69669       var o2 = [];
69670       var seen = {};
69671       for (var i3 = 0; i3 < a4.length; i3++) {
69672         if (seen[a4[i3][n3]] === void 0) {
69673           o2.push(a4[i3]);
69674           seen[a4[i3][n3]] = true;
69675         }
69676       }
69677       return o2;
69678     }
69679     function addSource(d2) {
69680       d2.url = _source.url(d2);
69681       d2.tileSize = _tileSize;
69682       d2.source = _source;
69683       return d2;
69684     }
69685     function background(selection2) {
69686       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
69687       var pixelOffset;
69688       if (_source) {
69689         pixelOffset = [
69690           _source.offset()[0] * Math.pow(2, _zoom),
69691           _source.offset()[1] * Math.pow(2, _zoom)
69692         ];
69693       } else {
69694         pixelOffset = [0, 0];
69695       }
69696       tiler8.scale(_projection.scale() * 2 * Math.PI).translate([
69697         _projection.translate()[0] + pixelOffset[0],
69698         _projection.translate()[1] + pixelOffset[1]
69699       ]);
69700       _tileOrigin = [
69701         _projection.scale() * Math.PI - _projection.translate()[0],
69702         _projection.scale() * Math.PI - _projection.translate()[1]
69703       ];
69704       render(selection2);
69705     }
69706     function render(selection2) {
69707       if (!_source) return;
69708       var requests = [];
69709       var showDebug = context.getDebug("tile") && !_source.overlay;
69710       if (_source.validZoom(_zoom, _underzoom)) {
69711         tiler8.skipNullIsland(!!_source.overlay);
69712         tiler8().forEach(function(d2) {
69713           addSource(d2);
69714           if (d2.url === "") return;
69715           if (typeof d2.url !== "string") return;
69716           requests.push(d2);
69717           if (_cache5[d2.url] === false && lookUp(d2)) {
69718             requests.push(addSource(lookUp(d2)));
69719           }
69720         });
69721         requests = uniqueBy(requests, "url").filter(function(r2) {
69722           return _cache5[r2.url] !== false;
69723         });
69724       }
69725       function load(d3_event, d2) {
69726         _cache5[d2.url] = true;
69727         select_default2(this).on("error", null).on("load", null);
69728         render(selection2);
69729       }
69730       function error(d3_event, d2) {
69731         _cache5[d2.url] = false;
69732         select_default2(this).on("error", null).on("load", null).remove();
69733         render(selection2);
69734       }
69735       function imageTransform(d2) {
69736         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
69737         var scale = tileSizeAtZoom(d2, _zoom);
69738         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 + ")";
69739       }
69740       function tileCenter(d2) {
69741         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
69742         return [
69743           d2[0] * ts - _tileOrigin[0] + ts / 2,
69744           d2[1] * ts - _tileOrigin[1] + ts / 2
69745         ];
69746       }
69747       function debugTransform(d2) {
69748         var coord2 = tileCenter(d2);
69749         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
69750       }
69751       var dims = tiler8.size();
69752       var mapCenter = [dims[0] / 2, dims[1] / 2];
69753       var minDist = Math.max(dims[0], dims[1]);
69754       var nearCenter;
69755       requests.forEach(function(d2) {
69756         var c2 = tileCenter(d2);
69757         var dist = geoVecLength(c2, mapCenter);
69758         if (dist < minDist) {
69759           minDist = dist;
69760           nearCenter = d2;
69761         }
69762       });
69763       var image = selection2.selectAll("img").data(requests, function(d2) {
69764         return d2.url;
69765       });
69766       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).on("transitionend", function() {
69767         const tile = select_default2(this);
69768         if (tile.classed("tile-removing")) {
69769           tile.remove();
69770         }
69771       });
69772       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
69773         return d2.url;
69774       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
69775         return d2 === nearCenter;
69776       }).sort((a4, b3) => a4[2] - b3[2]);
69777       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
69778         return d2.url;
69779       });
69780       debug2.exit().remove();
69781       if (showDebug) {
69782         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
69783         debugEnter.append("div").attr("class", "tile-label-debug-coord");
69784         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
69785         debug2 = debug2.merge(debugEnter);
69786         debug2.style(transformProp, debugTransform);
69787         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
69788           return d2[2] + " / " + d2[0] + " / " + d2[1];
69789         });
69790         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
69791           var span = select_default2(this);
69792           var center = context.projection.invert(tileCenter(d2));
69793           _source.getMetadata(center, d2, function(err, result) {
69794             if (result && result.vintage && result.vintage.range) {
69795               span.text(result.vintage.range);
69796             } else {
69797               span.text("");
69798               span.call(_t.append("info_panels.background.vintage"));
69799               span.append("span").text(": ");
69800               span.call(_t.append("info_panels.background.unknown"));
69801             }
69802           });
69803         });
69804       }
69805     }
69806     background.projection = function(val) {
69807       if (!arguments.length) return _projection;
69808       _projection = val;
69809       return background;
69810     };
69811     background.dimensions = function(val) {
69812       if (!arguments.length) return tiler8.size();
69813       tiler8.size(val);
69814       return background;
69815     };
69816     background.source = function(val) {
69817       if (!arguments.length) return _source;
69818       _source = val;
69819       _tileSize = _source.tileSize;
69820       _cache5 = {};
69821       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
69822       return background;
69823     };
69824     background.underzoom = function(amount) {
69825       if (!arguments.length) return _underzoom;
69826       _underzoom = amount;
69827       return background;
69828     };
69829     return background;
69830   }
69831   var init_tile_layer = __esm({
69832     "modules/renderer/tile_layer.js"() {
69833       "use strict";
69834       init_src5();
69835       init_localizer();
69836       init_geo2();
69837       init_util();
69838     }
69839   });
69840
69841   // modules/renderer/background.js
69842   var background_exports2 = {};
69843   __export(background_exports2, {
69844     rendererBackground: () => rendererBackground
69845   });
69846   function rendererBackground(context) {
69847     const dispatch14 = dispatch_default("change");
69848     const baseLayer = rendererTileLayer(context).projection(context.projection);
69849     let _checkedBlocklists = [];
69850     let _isValid = true;
69851     let _overlayLayers = [];
69852     let _brightness = 1;
69853     let _contrast = 1;
69854     let _saturation = 1;
69855     let _sharpness = 1;
69856     function ensureImageryIndex() {
69857       return _mainFileFetcher.get("imagery").then((sources) => {
69858         if (_imageryIndex) return _imageryIndex;
69859         _imageryIndex = {
69860           imagery: sources,
69861           features: {}
69862         };
69863         const features = sources.map((source) => {
69864           if (!source.polygon) return null;
69865           const rings = source.polygon.map((ring) => [ring]);
69866           const feature3 = {
69867             type: "Feature",
69868             properties: { id: source.id },
69869             geometry: { type: "MultiPolygon", coordinates: rings }
69870           };
69871           _imageryIndex.features[source.id] = feature3;
69872           return feature3;
69873         }).filter(Boolean);
69874         _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features });
69875         _imageryIndex.backgrounds = sources.map((source) => {
69876           if (source.type === "bing") {
69877             return rendererBackgroundSource.Bing(source, dispatch14);
69878           } else if (/^EsriWorldImagery/.test(source.id)) {
69879             return rendererBackgroundSource.Esri(source);
69880           } else {
69881             return rendererBackgroundSource(source);
69882           }
69883         });
69884         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
69885         let template = corePreferences("background-custom-template") || "";
69886         const custom = rendererBackgroundSource.Custom(template);
69887         _imageryIndex.backgrounds.unshift(custom);
69888         return _imageryIndex;
69889       });
69890     }
69891     function background(selection2) {
69892       const currSource = baseLayer.source();
69893       if (context.map().zoom() > 18) {
69894         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
69895           const center = context.map().center();
69896           currSource.fetchTilemap(center);
69897         }
69898       }
69899       const sources = background.sources(context.map().extent());
69900       const wasValid = _isValid;
69901       _isValid = !!sources.filter((d2) => d2 === currSource).length;
69902       if (wasValid !== _isValid) {
69903         background.updateImagery();
69904       }
69905       let baseFilter = "";
69906       if (_brightness !== 1) {
69907         baseFilter += ` brightness(${_brightness})`;
69908       }
69909       if (_contrast !== 1) {
69910         baseFilter += ` contrast(${_contrast})`;
69911       }
69912       if (_saturation !== 1) {
69913         baseFilter += ` saturate(${_saturation})`;
69914       }
69915       if (_sharpness < 1) {
69916         const blur = number_default(0.5, 5)(1 - _sharpness);
69917         baseFilter += ` blur(${blur}px)`;
69918       }
69919       let base = selection2.selectAll(".layer-background").data([0]);
69920       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
69921       base.style("filter", baseFilter || null);
69922       let imagery = base.selectAll(".layer-imagery").data([0]);
69923       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
69924       let maskFilter = "";
69925       let mixBlendMode = "";
69926       if (_sharpness > 1) {
69927         mixBlendMode = "overlay";
69928         maskFilter = "saturate(0) blur(3px) invert(1)";
69929         let contrast = _sharpness - 1;
69930         maskFilter += ` contrast(${contrast})`;
69931         let brightness = number_default(1, 0.85)(_sharpness - 1);
69932         maskFilter += ` brightness(${brightness})`;
69933       }
69934       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
69935       mask.exit().remove();
69936       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);
69937       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
69938       overlays.exit().remove();
69939       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
69940     }
69941     background.updateImagery = function() {
69942       let currSource = baseLayer.source();
69943       if (context.inIntro() || !currSource) return;
69944       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
69945       const meters = geoOffsetToMeters(currSource.offset());
69946       const EPSILON = 0.01;
69947       const x2 = +meters[0].toFixed(2);
69948       const y2 = +meters[1].toFixed(2);
69949       let hash2 = utilStringQs(window.location.hash);
69950       let id2 = currSource.id;
69951       if (id2 === "custom") {
69952         id2 = `custom:${currSource.template()}`;
69953       }
69954       if (id2) {
69955         hash2.background = id2;
69956       } else {
69957         delete hash2.background;
69958       }
69959       if (o2) {
69960         hash2.overlays = o2;
69961       } else {
69962         delete hash2.overlays;
69963       }
69964       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
69965         hash2.offset = `${x2},${y2}`;
69966       } else {
69967         delete hash2.offset;
69968       }
69969       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
69970       let imageryUsed = [];
69971       let photoOverlaysUsed = [];
69972       const currUsed = currSource.imageryUsed();
69973       if (currUsed && _isValid) {
69974         imageryUsed.push(currUsed);
69975       }
69976       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
69977       const dataLayer = context.layers().layer("data");
69978       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
69979         imageryUsed.push(dataLayer.getSrc());
69980       }
69981       const photoOverlayLayers = {
69982         streetside: "Bing Streetside",
69983         mapillary: "Mapillary Images",
69984         "mapillary-map-features": "Mapillary Map Features",
69985         "mapillary-signs": "Mapillary Signs",
69986         kartaview: "KartaView Images",
69987         vegbilder: "Norwegian Road Administration Images",
69988         mapilio: "Mapilio Images",
69989         panoramax: "Panoramax Images"
69990       };
69991       for (let layerID in photoOverlayLayers) {
69992         const layer = context.layers().layer(layerID);
69993         if (layer && layer.enabled()) {
69994           photoOverlaysUsed.push(layerID);
69995           imageryUsed.push(photoOverlayLayers[layerID]);
69996         }
69997       }
69998       context.history().imageryUsed(imageryUsed);
69999       context.history().photoOverlaysUsed(photoOverlaysUsed);
70000     };
70001     background.sources = (extent, zoom, includeCurrent) => {
70002       if (!_imageryIndex) return [];
70003       let visible = {};
70004       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
70005       const currSource = baseLayer.source();
70006       const osm = context.connection();
70007       const blocklists = osm && osm.imageryBlocklists() || [];
70008       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
70009       if (blocklistChanged) {
70010         _imageryIndex.backgrounds.forEach((source) => {
70011           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
70012         });
70013         _checkedBlocklists = blocklists.map((regex) => String(regex));
70014       }
70015       return _imageryIndex.backgrounds.filter((source) => {
70016         if (includeCurrent && currSource === source) return true;
70017         if (source.isBlocked) return false;
70018         if (!source.polygon) return true;
70019         if (zoom && zoom < 6) return false;
70020         return visible[source.id];
70021       });
70022     };
70023     background.dimensions = (val) => {
70024       if (!val) return;
70025       baseLayer.dimensions(val);
70026       _overlayLayers.forEach((layer) => layer.dimensions(val));
70027     };
70028     background.baseLayerSource = function(d2) {
70029       if (!arguments.length) return baseLayer.source();
70030       const osm = context.connection();
70031       if (!osm) return background;
70032       const blocklists = osm.imageryBlocklists();
70033       const template = d2.template();
70034       let fail = false;
70035       let tested = 0;
70036       let regex;
70037       for (let i3 = 0; i3 < blocklists.length; i3++) {
70038         regex = blocklists[i3];
70039         fail = regex.test(template);
70040         tested++;
70041         if (fail) break;
70042       }
70043       if (!tested) {
70044         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
70045         fail = regex.test(template);
70046       }
70047       baseLayer.source(!fail ? d2 : background.findSource("none"));
70048       dispatch14.call("change");
70049       background.updateImagery();
70050       return background;
70051     };
70052     background.findSource = (id2) => {
70053       if (!id2 || !_imageryIndex) return null;
70054       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
70055     };
70056     background.bing = () => {
70057       background.baseLayerSource(background.findSource("Bing"));
70058     };
70059     background.showsLayer = (d2) => {
70060       const currSource = baseLayer.source();
70061       if (!d2 || !currSource) return false;
70062       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
70063     };
70064     background.overlayLayerSources = () => {
70065       return _overlayLayers.map((layer) => layer.source());
70066     };
70067     background.toggleOverlayLayer = (d2) => {
70068       let layer;
70069       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
70070         layer = _overlayLayers[i3];
70071         if (layer.source() === d2) {
70072           _overlayLayers.splice(i3, 1);
70073           dispatch14.call("change");
70074           background.updateImagery();
70075           return;
70076         }
70077       }
70078       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
70079         baseLayer.dimensions()
70080       );
70081       _overlayLayers.push(layer);
70082       dispatch14.call("change");
70083       background.updateImagery();
70084     };
70085     background.nudge = (d2, zoom) => {
70086       const currSource = baseLayer.source();
70087       if (currSource) {
70088         currSource.nudge(d2, zoom);
70089         dispatch14.call("change");
70090         background.updateImagery();
70091       }
70092       return background;
70093     };
70094     background.offset = function(d2) {
70095       const currSource = baseLayer.source();
70096       if (!arguments.length) {
70097         return currSource && currSource.offset() || [0, 0];
70098       }
70099       if (currSource) {
70100         currSource.offset(d2);
70101         dispatch14.call("change");
70102         background.updateImagery();
70103       }
70104       return background;
70105     };
70106     background.brightness = function(d2) {
70107       if (!arguments.length) return _brightness;
70108       _brightness = d2;
70109       if (context.mode()) dispatch14.call("change");
70110       return background;
70111     };
70112     background.contrast = function(d2) {
70113       if (!arguments.length) return _contrast;
70114       _contrast = d2;
70115       if (context.mode()) dispatch14.call("change");
70116       return background;
70117     };
70118     background.saturation = function(d2) {
70119       if (!arguments.length) return _saturation;
70120       _saturation = d2;
70121       if (context.mode()) dispatch14.call("change");
70122       return background;
70123     };
70124     background.sharpness = function(d2) {
70125       if (!arguments.length) return _sharpness;
70126       _sharpness = d2;
70127       if (context.mode()) dispatch14.call("change");
70128       return background;
70129     };
70130     let _loadPromise;
70131     background.ensureLoaded = () => {
70132       if (_loadPromise) return _loadPromise;
70133       return _loadPromise = ensureImageryIndex();
70134     };
70135     background.init = () => {
70136       const loadPromise = background.ensureLoaded();
70137       const hash2 = utilStringQs(window.location.hash);
70138       const requestedBackground = hash2.background || hash2.layer;
70139       const lastUsedBackground = corePreferences("background-last-used");
70140       return loadPromise.then((imageryIndex) => {
70141         const extent = context.map().extent();
70142         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
70143         const first = validBackgrounds.length && validBackgrounds[0];
70144         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
70145         let best;
70146         if (!requestedBackground && extent) {
70147           const viewArea = extent.area();
70148           best = validBackgrounds.find((s2) => {
70149             if (!s2.best() || s2.overlay) return false;
70150             let bbox2 = turf_bbox_default(turf_bbox_clip_default(
70151               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
70152               extent.rectangle()
70153             ));
70154             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
70155             return area / viewArea > 0.5;
70156           });
70157         }
70158         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
70159           const template = requestedBackground.replace(/^custom:/, "");
70160           const custom = background.findSource("custom");
70161           background.baseLayerSource(custom.template(template));
70162           corePreferences("background-custom-template", template);
70163         } else {
70164           background.baseLayerSource(
70165             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
70166           );
70167         }
70168         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
70169         if (locator) {
70170           background.toggleOverlayLayer(locator);
70171         }
70172         const overlays = (hash2.overlays || "").split(",");
70173         overlays.forEach((overlay) => {
70174           overlay = background.findSource(overlay);
70175           if (overlay) {
70176             background.toggleOverlayLayer(overlay);
70177           }
70178         });
70179         if (hash2.gpx) {
70180           const gpx2 = context.layers().layer("data");
70181           if (gpx2) {
70182             gpx2.url(hash2.gpx, ".gpx");
70183           }
70184         }
70185         if (hash2.offset) {
70186           const offset = hash2.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
70187           if (offset.length === 2) {
70188             background.offset(geoMetersToOffset(offset));
70189           }
70190         }
70191       }).catch((err) => {
70192         console.error(err);
70193       });
70194     };
70195     return utilRebind(background, dispatch14, "on");
70196   }
70197   var import_which_polygon4, _imageryIndex;
70198   var init_background2 = __esm({
70199     "modules/renderer/background.js"() {
70200       "use strict";
70201       init_src4();
70202       init_src8();
70203       init_src5();
70204       init_esm5();
70205       init_esm7();
70206       import_which_polygon4 = __toESM(require_which_polygon());
70207       init_preferences();
70208       init_file_fetcher();
70209       init_geo2();
70210       init_background_source();
70211       init_tile_layer();
70212       init_util();
70213       init_rebind();
70214       _imageryIndex = null;
70215     }
70216   });
70217
70218   // modules/renderer/features.js
70219   var features_exports = {};
70220   __export(features_exports, {
70221     rendererFeatures: () => rendererFeatures
70222   });
70223   function rendererFeatures(context) {
70224     var dispatch14 = dispatch_default("change", "redraw");
70225     const features = {};
70226     var _deferred2 = /* @__PURE__ */ new Set();
70227     var traffic_roads = {
70228       "motorway": true,
70229       "motorway_link": true,
70230       "trunk": true,
70231       "trunk_link": true,
70232       "primary": true,
70233       "primary_link": true,
70234       "secondary": true,
70235       "secondary_link": true,
70236       "tertiary": true,
70237       "tertiary_link": true,
70238       "residential": true,
70239       "unclassified": true,
70240       "living_street": true,
70241       "busway": true
70242     };
70243     var service_roads = {
70244       "service": true,
70245       "road": true,
70246       "track": true
70247     };
70248     var paths = {
70249       "path": true,
70250       "footway": true,
70251       "cycleway": true,
70252       "bridleway": true,
70253       "steps": true,
70254       "ladder": true,
70255       "pedestrian": true
70256     };
70257     var _cullFactor = 1;
70258     var _cache5 = {};
70259     var _rules = {};
70260     var _stats = {};
70261     var _keys = [];
70262     var _hidden = [];
70263     var _forceVisible = {};
70264     function update() {
70265       const hash2 = utilStringQs(window.location.hash);
70266       const disabled = features.disabled();
70267       if (disabled.length) {
70268         hash2.disable_features = disabled.join(",");
70269       } else {
70270         delete hash2.disable_features;
70271       }
70272       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
70273       corePreferences("disabled-features", disabled.join(","));
70274       _hidden = features.hidden();
70275       dispatch14.call("change");
70276       dispatch14.call("redraw");
70277     }
70278     function defineRule(k3, filter2, max3) {
70279       var isEnabled = true;
70280       _keys.push(k3);
70281       _rules[k3] = {
70282         filter: filter2,
70283         enabled: isEnabled,
70284         // whether the user wants it enabled..
70285         count: 0,
70286         currentMax: max3 || Infinity,
70287         defaultMax: max3 || Infinity,
70288         enable: function() {
70289           this.enabled = true;
70290           this.currentMax = this.defaultMax;
70291         },
70292         disable: function() {
70293           this.enabled = false;
70294           this.currentMax = 0;
70295         },
70296         hidden: function() {
70297           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
70298         },
70299         autoHidden: function() {
70300           return this.hidden() && this.currentMax > 0;
70301         }
70302       };
70303     }
70304     function isAddressPoint2(tags, geometry) {
70305       const keys2 = Object.keys(tags);
70306       return geometry === "point" && keys2.length > 0 && keys2.every(
70307         (key) => key.startsWith("addr:") || !osmIsInterestingTag(key)
70308       );
70309     }
70310     defineRule("address_points", isAddressPoint2, 100);
70311     defineRule("points", function isPoint(tags, geometry) {
70312       return geometry === "point" && !isAddressPoint2(tags, geometry);
70313     }, 200);
70314     defineRule("traffic_roads", function isTrafficRoad(tags) {
70315       return traffic_roads[tags.highway];
70316     });
70317     defineRule("service_roads", function isServiceRoad(tags) {
70318       return service_roads[tags.highway];
70319     });
70320     defineRule("paths", function isPath(tags) {
70321       return paths[tags.highway];
70322     });
70323     defineRule("buildings", function isBuilding(tags) {
70324       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
70325     }, 250);
70326     defineRule("building_parts", function isBuildingPart(tags) {
70327       return !!tags["building:part"];
70328     });
70329     defineRule("indoor", function isIndoor(tags) {
70330       return !!tags.indoor && tags.indoor !== "no" || !!tags.indoormark && tags.indoormark !== "no";
70331     });
70332     defineRule("landuse", function isLanduse(tags, geometry) {
70333       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);
70334     });
70335     defineRule("boundaries", function isBoundary(tags, geometry) {
70336       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);
70337     });
70338     defineRule("water", function isWater(tags) {
70339       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";
70340     });
70341     defineRule("rail", function isRail(tags) {
70342       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
70343     });
70344     defineRule("pistes", function isPiste(tags) {
70345       return tags["piste:type"];
70346     });
70347     defineRule("aerialways", function isAerialways(tags) {
70348       return !!(tags == null ? void 0 : tags.aerialway) && tags.aerialway !== "yes" && tags.aerialway !== "station";
70349     });
70350     defineRule("power", function isPower(tags) {
70351       return !!tags.power;
70352     });
70353     defineRule("past_future", function isPastFuture(tags) {
70354       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
70355         return false;
70356       }
70357       const keys2 = Object.keys(tags);
70358       for (const key of keys2) {
70359         if (osmLifecyclePrefixes[tags[key]]) return true;
70360         const parts = key.split(":");
70361         if (parts.length === 1) continue;
70362         const prefix = parts[0];
70363         if (osmLifecyclePrefixes[prefix]) return true;
70364       }
70365       return false;
70366     });
70367     defineRule("others", function isOther(tags, geometry) {
70368       return geometry === "line" || geometry === "area";
70369     });
70370     features.features = function() {
70371       return _rules;
70372     };
70373     features.keys = function() {
70374       return _keys;
70375     };
70376     features.enabled = function(k3) {
70377       if (!arguments.length) {
70378         return _keys.filter(function(k4) {
70379           return _rules[k4].enabled;
70380         });
70381       }
70382       return _rules[k3] && _rules[k3].enabled;
70383     };
70384     features.disabled = function(k3) {
70385       if (!arguments.length) {
70386         return _keys.filter(function(k4) {
70387           return !_rules[k4].enabled;
70388         });
70389       }
70390       return _rules[k3] && !_rules[k3].enabled;
70391     };
70392     features.hidden = function(k3) {
70393       var _a4;
70394       if (!arguments.length) {
70395         return _keys.filter(function(k4) {
70396           return _rules[k4].hidden();
70397         });
70398       }
70399       return (_a4 = _rules[k3]) == null ? void 0 : _a4.hidden();
70400     };
70401     features.autoHidden = function(k3) {
70402       if (!arguments.length) {
70403         return _keys.filter(function(k4) {
70404           return _rules[k4].autoHidden();
70405         });
70406       }
70407       return _rules[k3] && _rules[k3].autoHidden();
70408     };
70409     features.enable = function(k3) {
70410       if (_rules[k3] && !_rules[k3].enabled) {
70411         _rules[k3].enable();
70412         update();
70413       }
70414     };
70415     features.enableAll = function() {
70416       var didEnable = false;
70417       for (var k3 in _rules) {
70418         if (!_rules[k3].enabled) {
70419           didEnable = true;
70420           _rules[k3].enable();
70421         }
70422       }
70423       if (didEnable) update();
70424     };
70425     features.disable = function(k3) {
70426       if (_rules[k3] && _rules[k3].enabled) {
70427         _rules[k3].disable();
70428         update();
70429       }
70430     };
70431     features.disableAll = function() {
70432       var didDisable = false;
70433       for (var k3 in _rules) {
70434         if (_rules[k3].enabled) {
70435           didDisable = true;
70436           _rules[k3].disable();
70437         }
70438       }
70439       if (didDisable) update();
70440     };
70441     features.toggle = function(k3) {
70442       if (_rules[k3]) {
70443         (function(f2) {
70444           return f2.enabled ? f2.disable() : f2.enable();
70445         })(_rules[k3]);
70446         update();
70447       }
70448     };
70449     features.resetStats = function() {
70450       for (var i3 = 0; i3 < _keys.length; i3++) {
70451         _rules[_keys[i3]].count = 0;
70452       }
70453       dispatch14.call("change");
70454     };
70455     features.gatherStats = function(d2, resolver, dimensions) {
70456       var needsRedraw = false;
70457       var types = utilArrayGroupBy(d2, "type");
70458       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
70459       var currHidden, geometry, matches, i3, j3;
70460       for (i3 = 0; i3 < _keys.length; i3++) {
70461         _rules[_keys[i3]].count = 0;
70462       }
70463       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
70464       for (i3 = 0; i3 < entities.length; i3++) {
70465         geometry = entities[i3].geometry(resolver);
70466         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
70467         for (j3 = 0; j3 < matches.length; j3++) {
70468           _rules[matches[j3]].count++;
70469         }
70470       }
70471       currHidden = features.hidden();
70472       if (currHidden !== _hidden) {
70473         _hidden = currHidden;
70474         needsRedraw = true;
70475         dispatch14.call("change");
70476       }
70477       return needsRedraw;
70478     };
70479     features.stats = function() {
70480       for (var i3 = 0; i3 < _keys.length; i3++) {
70481         _stats[_keys[i3]] = _rules[_keys[i3]].count;
70482       }
70483       return _stats;
70484     };
70485     features.clear = function(d2) {
70486       for (var i3 = 0; i3 < d2.length; i3++) {
70487         features.clearEntity(d2[i3]);
70488       }
70489     };
70490     features.clearEntity = function(entity) {
70491       delete _cache5[osmEntity.key(entity)];
70492     };
70493     features.reset = function() {
70494       Array.from(_deferred2).forEach(function(handle) {
70495         window.cancelIdleCallback(handle);
70496         _deferred2.delete(handle);
70497       });
70498       _cache5 = {};
70499     };
70500     function relationShouldBeChecked(relation) {
70501       return relation.tags.type === "boundary";
70502     }
70503     features.getMatches = function(entity, resolver, geometry) {
70504       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity)) return {};
70505       var ent = osmEntity.key(entity);
70506       if (!_cache5[ent]) {
70507         _cache5[ent] = {};
70508       }
70509       if (!_cache5[ent].matches) {
70510         var matches = {};
70511         var hasMatch = false;
70512         for (var i3 = 0; i3 < _keys.length; i3++) {
70513           if (_keys[i3] === "others") {
70514             if (hasMatch) continue;
70515             if (entity.type === "way") {
70516               var parents = features.getParents(entity, resolver, geometry);
70517               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
70518               parents.length > 0 && parents.every(function(parent2) {
70519                 return parent2.tags.type === "boundary";
70520               })) {
70521                 var pkey = osmEntity.key(parents[0]);
70522                 if (_cache5[pkey] && _cache5[pkey].matches) {
70523                   matches = Object.assign({}, _cache5[pkey].matches);
70524                   continue;
70525                 }
70526               }
70527             }
70528           }
70529           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
70530             matches[_keys[i3]] = hasMatch = true;
70531           }
70532         }
70533         _cache5[ent].matches = matches;
70534       }
70535       return _cache5[ent].matches;
70536     };
70537     features.getParents = function(entity, resolver, geometry) {
70538       if (geometry === "point") return [];
70539       var ent = osmEntity.key(entity);
70540       if (!_cache5[ent]) {
70541         _cache5[ent] = {};
70542       }
70543       if (!_cache5[ent].parents) {
70544         var parents = [];
70545         if (geometry === "vertex") {
70546           parents = resolver.parentWays(entity);
70547         } else {
70548           parents = resolver.parentRelations(entity);
70549         }
70550         _cache5[ent].parents = parents;
70551       }
70552       return _cache5[ent].parents;
70553     };
70554     features.isHiddenPreset = function(preset, geometry) {
70555       if (!_hidden.length) return false;
70556       if (!preset.tags) return false;
70557       var test = preset.setTags({}, geometry);
70558       for (var key in _rules) {
70559         if (_rules[key].filter(test, geometry)) {
70560           if (_hidden.indexOf(key) !== -1) {
70561             return key;
70562           }
70563           return false;
70564         }
70565       }
70566       return false;
70567     };
70568     features.isHiddenFeature = function(entity, resolver, geometry) {
70569       if (!_hidden.length) return false;
70570       if (!entity.version) return false;
70571       if (_forceVisible[entity.id]) return false;
70572       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
70573       return matches.length && matches.every(function(k3) {
70574         return features.hidden(k3);
70575       });
70576     };
70577     features.isHiddenChild = function(entity, resolver, geometry) {
70578       if (!_hidden.length) return false;
70579       if (!entity.version || geometry === "point") return false;
70580       if (_forceVisible[entity.id]) return false;
70581       var parents = features.getParents(entity, resolver, geometry);
70582       if (!parents.length) return false;
70583       for (var i3 = 0; i3 < parents.length; i3++) {
70584         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
70585           return false;
70586         }
70587       }
70588       return true;
70589     };
70590     features.hasHiddenConnections = function(entity, resolver) {
70591       if (!_hidden.length) return false;
70592       var childNodes, connections;
70593       if (entity.type === "midpoint") {
70594         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
70595         connections = [];
70596       } else {
70597         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
70598         connections = features.getParents(entity, resolver, entity.geometry(resolver));
70599       }
70600       connections = childNodes.reduce(function(result, e3) {
70601         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
70602       }, connections);
70603       return connections.some(function(e3) {
70604         return features.isHidden(e3, resolver, e3.geometry(resolver));
70605       });
70606     };
70607     features.isHidden = function(entity, resolver, geometry) {
70608       if (!_hidden.length) return false;
70609       if (!entity.version) return false;
70610       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
70611       return fn(entity, resolver, geometry);
70612     };
70613     features.filter = function(d2, resolver) {
70614       if (!_hidden.length) return d2;
70615       var result = [];
70616       for (var i3 = 0; i3 < d2.length; i3++) {
70617         var entity = d2[i3];
70618         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
70619           result.push(entity);
70620         }
70621       }
70622       return result;
70623     };
70624     features.forceVisible = function(entityIDs) {
70625       if (!arguments.length) return Object.keys(_forceVisible);
70626       _forceVisible = {};
70627       for (var i3 = 0; i3 < entityIDs.length; i3++) {
70628         _forceVisible[entityIDs[i3]] = true;
70629         var entity = context.hasEntity(entityIDs[i3]);
70630         if (entity && entity.type === "relation") {
70631           for (var j3 in entity.members) {
70632             _forceVisible[entity.members[j3].id] = true;
70633           }
70634         }
70635       }
70636       return features;
70637     };
70638     features.init = function() {
70639       var storage = corePreferences("disabled-features");
70640       if (storage) {
70641         var storageDisabled = storage.replace(/;/g, ",").split(",");
70642         storageDisabled.forEach(features.disable);
70643       }
70644       var hash2 = utilStringQs(window.location.hash);
70645       if (hash2.disable_features) {
70646         var hashDisabled = hash2.disable_features.replace(/;/g, ",").split(",");
70647         hashDisabled.forEach(features.disable);
70648       }
70649     };
70650     context.history().on("merge.features", function(newEntities) {
70651       if (!newEntities) return;
70652       var handle = window.requestIdleCallback(function() {
70653         var graph = context.graph();
70654         var types = utilArrayGroupBy(newEntities, "type");
70655         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
70656         for (var i3 = 0; i3 < entities.length; i3++) {
70657           var geometry = entities[i3].geometry(graph);
70658           features.getMatches(entities[i3], graph, geometry);
70659         }
70660       });
70661       _deferred2.add(handle);
70662     });
70663     return utilRebind(features, dispatch14, "on");
70664   }
70665   var init_features = __esm({
70666     "modules/renderer/features.js"() {
70667       "use strict";
70668       init_src4();
70669       init_preferences();
70670       init_osm();
70671       init_rebind();
70672       init_util();
70673     }
70674   });
70675
70676   // modules/util/bind_once.js
70677   var bind_once_exports = {};
70678   __export(bind_once_exports, {
70679     utilBindOnce: () => utilBindOnce
70680   });
70681   function utilBindOnce(target, type2, listener, capture) {
70682     var typeOnce = type2 + ".once";
70683     function one2() {
70684       target.on(typeOnce, null);
70685       listener.apply(this, arguments);
70686     }
70687     target.on(typeOnce, one2, capture);
70688     return this;
70689   }
70690   var init_bind_once = __esm({
70691     "modules/util/bind_once.js"() {
70692       "use strict";
70693     }
70694   });
70695
70696   // modules/util/zoom_pan.js
70697   var zoom_pan_exports = {};
70698   __export(zoom_pan_exports, {
70699     utilZoomPan: () => utilZoomPan
70700   });
70701   function defaultFilter3(d3_event) {
70702     return !d3_event.ctrlKey && !d3_event.button;
70703   }
70704   function defaultExtent2() {
70705     var e3 = this;
70706     if (e3 instanceof SVGElement) {
70707       e3 = e3.ownerSVGElement || e3;
70708       if (e3.hasAttribute("viewBox")) {
70709         e3 = e3.viewBox.baseVal;
70710         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
70711       }
70712       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
70713     }
70714     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
70715   }
70716   function defaultWheelDelta2(d3_event) {
70717     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
70718   }
70719   function defaultConstrain2(transform2, extent, translateExtent) {
70720     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];
70721     return transform2.translate(
70722       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
70723       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
70724     );
70725   }
70726   function utilZoomPan() {
70727     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;
70728     function zoom(selection2) {
70729       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
70730       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
70731     }
70732     zoom.transform = function(collection, transform2, point) {
70733       var selection2 = collection.selection ? collection.selection() : collection;
70734       if (collection !== selection2) {
70735         schedule(collection, transform2, point);
70736       } else {
70737         selection2.interrupt().each(function() {
70738           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
70739         });
70740       }
70741     };
70742     zoom.scaleBy = function(selection2, k3, p2) {
70743       zoom.scaleTo(selection2, function() {
70744         var k0 = _transform.k, k1 = typeof k3 === "function" ? k3.apply(this, arguments) : k3;
70745         return k0 * k1;
70746       }, p2);
70747     };
70748     zoom.scaleTo = function(selection2, k3, p2) {
70749       zoom.transform(selection2, function() {
70750         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;
70751         return constrain(translate(scale(t02, k1), p02, p1), e3, translateExtent);
70752       }, p2);
70753     };
70754     zoom.translateBy = function(selection2, x2, y2) {
70755       zoom.transform(selection2, function() {
70756         return constrain(_transform.translate(
70757           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
70758           typeof y2 === "function" ? y2.apply(this, arguments) : y2
70759         ), extent.apply(this, arguments), translateExtent);
70760       });
70761     };
70762     zoom.translateTo = function(selection2, x2, y2, p2) {
70763       zoom.transform(selection2, function() {
70764         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
70765         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
70766           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
70767           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
70768         ), e3, translateExtent);
70769       }, p2);
70770     };
70771     function scale(transform2, k3) {
70772       k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k3));
70773       return k3 === transform2.k ? transform2 : new Transform(k3, transform2.x, transform2.y);
70774     }
70775     function translate(transform2, p02, p1) {
70776       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
70777       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
70778     }
70779     function centroid(extent2) {
70780       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
70781     }
70782     function schedule(transition2, transform2, point) {
70783       transition2.on("start.zoom", function() {
70784         gesture(this, arguments).start(null);
70785       }).on("interrupt.zoom end.zoom", function() {
70786         gesture(this, arguments).end(null);
70787       }).tween("zoom", function() {
70788         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));
70789         return function(t2) {
70790           if (t2 === 1) {
70791             t2 = b3;
70792           } else {
70793             var l2 = i3(t2);
70794             var k3 = w3 / l2[2];
70795             t2 = new Transform(k3, p2[0] - l2[0] * k3, p2[1] - l2[1] * k3);
70796           }
70797           g3.zoom(null, null, t2);
70798         };
70799       });
70800     }
70801     function gesture(that, args, clean2) {
70802       return !clean2 && _activeGesture || new Gesture(that, args);
70803     }
70804     function Gesture(that, args) {
70805       this.that = that;
70806       this.args = args;
70807       this.active = 0;
70808       this.extent = extent.apply(that, args);
70809     }
70810     Gesture.prototype = {
70811       start: function(d3_event) {
70812         if (++this.active === 1) {
70813           _activeGesture = this;
70814           dispatch14.call("start", this, d3_event);
70815         }
70816         return this;
70817       },
70818       zoom: function(d3_event, key, transform2) {
70819         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
70820         if (this.pointer0 && key !== "touch") this.pointer0[1] = transform2.invert(this.pointer0[0]);
70821         if (this.pointer1 && key !== "touch") this.pointer1[1] = transform2.invert(this.pointer1[0]);
70822         _transform = transform2;
70823         dispatch14.call("zoom", this, d3_event, key, transform2);
70824         return this;
70825       },
70826       end: function(d3_event) {
70827         if (--this.active === 0) {
70828           _activeGesture = null;
70829           dispatch14.call("end", this, d3_event);
70830         }
70831         return this;
70832       }
70833     };
70834     function wheeled(d3_event) {
70835       if (!filter2.apply(this, arguments)) return;
70836       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);
70837       if (g3.wheel) {
70838         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
70839           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
70840         }
70841         clearTimeout(g3.wheel);
70842       } else {
70843         g3.mouse = [p2, t2.invert(p2)];
70844         interrupt_default(this);
70845         g3.start(d3_event);
70846       }
70847       d3_event.preventDefault();
70848       d3_event.stopImmediatePropagation();
70849       g3.wheel = setTimeout(wheelidled, _wheelDelay);
70850       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k3), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
70851       function wheelidled() {
70852         g3.wheel = null;
70853         g3.end(d3_event);
70854       }
70855     }
70856     var _downPointerIDs = /* @__PURE__ */ new Set();
70857     var _pointerLocGetter;
70858     function pointerdown(d3_event) {
70859       _downPointerIDs.add(d3_event.pointerId);
70860       if (!filter2.apply(this, arguments)) return;
70861       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
70862       var started;
70863       d3_event.stopImmediatePropagation();
70864       _pointerLocGetter = utilFastMouse(this);
70865       var loc = _pointerLocGetter(d3_event);
70866       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
70867       if (!g3.pointer0) {
70868         g3.pointer0 = p2;
70869         started = true;
70870       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
70871         g3.pointer1 = p2;
70872       }
70873       if (started) {
70874         interrupt_default(this);
70875         g3.start(d3_event);
70876       }
70877     }
70878     function pointermove(d3_event) {
70879       if (!_downPointerIDs.has(d3_event.pointerId)) return;
70880       if (!_activeGesture || !_pointerLocGetter) return;
70881       var g3 = gesture(this, arguments);
70882       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
70883       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
70884       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
70885         if (g3.pointer0) _downPointerIDs.delete(g3.pointer0[2]);
70886         if (g3.pointer1) _downPointerIDs.delete(g3.pointer1[2]);
70887         g3.end(d3_event);
70888         return;
70889       }
70890       d3_event.preventDefault();
70891       d3_event.stopImmediatePropagation();
70892       var loc = _pointerLocGetter(d3_event);
70893       var t2, p2, l2;
70894       if (isPointer0) g3.pointer0[0] = loc;
70895       else if (isPointer1) g3.pointer1[0] = loc;
70896       t2 = _transform;
70897       if (g3.pointer1) {
70898         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;
70899         t2 = scale(t2, Math.sqrt(dp / dl));
70900         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
70901         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
70902       } else if (g3.pointer0) {
70903         p2 = g3.pointer0[0];
70904         l2 = g3.pointer0[1];
70905       } else {
70906         return;
70907       }
70908       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
70909     }
70910     function pointerup(d3_event) {
70911       if (!_downPointerIDs.has(d3_event.pointerId)) return;
70912       _downPointerIDs.delete(d3_event.pointerId);
70913       if (!_activeGesture) return;
70914       var g3 = gesture(this, arguments);
70915       d3_event.stopImmediatePropagation();
70916       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId) delete g3.pointer0;
70917       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId) delete g3.pointer1;
70918       if (g3.pointer1 && !g3.pointer0) {
70919         g3.pointer0 = g3.pointer1;
70920         delete g3.pointer1;
70921       }
70922       if (g3.pointer0) {
70923         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
70924       } else {
70925         g3.end(d3_event);
70926       }
70927     }
70928     zoom.wheelDelta = function(_3) {
70929       return arguments.length ? (wheelDelta = utilFunctor(+_3), zoom) : wheelDelta;
70930     };
70931     zoom.filter = function(_3) {
70932       return arguments.length ? (filter2 = utilFunctor(!!_3), zoom) : filter2;
70933     };
70934     zoom.extent = function(_3) {
70935       return arguments.length ? (extent = utilFunctor([[+_3[0][0], +_3[0][1]], [+_3[1][0], +_3[1][1]]]), zoom) : extent;
70936     };
70937     zoom.scaleExtent = function(_3) {
70938       return arguments.length ? (scaleExtent[0] = +_3[0], scaleExtent[1] = +_3[1], zoom) : [scaleExtent[0], scaleExtent[1]];
70939     };
70940     zoom.translateExtent = function(_3) {
70941       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]]];
70942     };
70943     zoom.constrain = function(_3) {
70944       return arguments.length ? (constrain = _3, zoom) : constrain;
70945     };
70946     zoom.interpolate = function(_3) {
70947       return arguments.length ? (interpolate = _3, zoom) : interpolate;
70948     };
70949     zoom._transform = function(_3) {
70950       return arguments.length ? (_transform = _3, zoom) : _transform;
70951     };
70952     return utilRebind(zoom, dispatch14, "on");
70953   }
70954   var init_zoom_pan = __esm({
70955     "modules/util/zoom_pan.js"() {
70956       "use strict";
70957       init_src4();
70958       init_src8();
70959       init_src5();
70960       init_src11();
70961       init_src12();
70962       init_transform3();
70963       init_util2();
70964       init_rebind();
70965     }
70966   });
70967
70968   // modules/util/double_up.js
70969   var double_up_exports = {};
70970   __export(double_up_exports, {
70971     utilDoubleUp: () => utilDoubleUp
70972   });
70973   function utilDoubleUp() {
70974     var dispatch14 = dispatch_default("doubleUp");
70975     var _maxTimespan = 500;
70976     var _maxDistance = 20;
70977     var _pointer;
70978     function pointerIsValidFor(loc) {
70979       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
70980       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
70981     }
70982     function pointerdown(d3_event) {
70983       if (d3_event.ctrlKey || d3_event.button === 2) return;
70984       var loc = [d3_event.clientX, d3_event.clientY];
70985       if (_pointer && !pointerIsValidFor(loc)) {
70986         _pointer = void 0;
70987       }
70988       if (!_pointer) {
70989         _pointer = {
70990           startLoc: loc,
70991           startTime: (/* @__PURE__ */ new Date()).getTime(),
70992           upCount: 0,
70993           pointerId: d3_event.pointerId
70994         };
70995       } else {
70996         _pointer.pointerId = d3_event.pointerId;
70997       }
70998     }
70999     function pointerup(d3_event) {
71000       if (d3_event.ctrlKey || d3_event.button === 2) return;
71001       if (!_pointer || _pointer.pointerId !== d3_event.pointerId) return;
71002       _pointer.upCount += 1;
71003       if (_pointer.upCount === 2) {
71004         var loc = [d3_event.clientX, d3_event.clientY];
71005         if (pointerIsValidFor(loc)) {
71006           var locInThis = utilFastMouse(this)(d3_event);
71007           dispatch14.call("doubleUp", this, d3_event, locInThis);
71008         }
71009         _pointer = void 0;
71010       }
71011     }
71012     function doubleUp(selection2) {
71013       if ("PointerEvent" in window) {
71014         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
71015       } else {
71016         selection2.on("dblclick.doubleUp", function(d3_event) {
71017           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
71018         });
71019       }
71020     }
71021     doubleUp.off = function(selection2) {
71022       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
71023     };
71024     return utilRebind(doubleUp, dispatch14, "on");
71025   }
71026   var init_double_up = __esm({
71027     "modules/util/double_up.js"() {
71028       "use strict";
71029       init_src4();
71030       init_util2();
71031       init_rebind();
71032       init_vector();
71033     }
71034   });
71035
71036   // modules/renderer/map.js
71037   var map_exports = {};
71038   __export(map_exports, {
71039     rendererMap: () => rendererMap
71040   });
71041   function rendererMap(context) {
71042     var dispatch14 = dispatch_default(
71043       "move",
71044       "drawn",
71045       "crossEditableZoom",
71046       "hitMinZoom",
71047       "changeHighlighting",
71048       "changeAreaFill"
71049     );
71050     var projection2 = context.projection;
71051     var curtainProjection = context.curtainProjection;
71052     var drawLayers;
71053     var drawPoints;
71054     var drawVertices;
71055     var drawLines;
71056     var drawAreas;
71057     var drawMidpoints;
71058     var drawLabels;
71059     var _selection = select_default2(null);
71060     var supersurface = select_default2(null);
71061     var wrapper = select_default2(null);
71062     var surface = select_default2(null);
71063     var _dimensions = [1, 1];
71064     var _dblClickZoomEnabled = true;
71065     var _redrawEnabled = true;
71066     var _gestureTransformStart;
71067     var _transformStart = projection2.transform();
71068     var _transformLast;
71069     var _isTransformed = false;
71070     var _minzoom = 0;
71071     var _getMouseCoords;
71072     var _lastPointerEvent;
71073     var _lastWithinEditableZoom;
71074     var _pointerDown = false;
71075     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
71076     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
71077     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
71078       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
71079     }).on("end.map", function() {
71080       _pointerDown = false;
71081     });
71082     var _doubleUpHandler = utilDoubleUp();
71083     var scheduleRedraw = throttle_default(redraw, 750);
71084     function cancelPendingRedraw() {
71085       scheduleRedraw.cancel();
71086     }
71087     function map2(selection2) {
71088       _selection = selection2;
71089       context.on("change.map", immediateRedraw);
71090       var osm = context.connection();
71091       if (osm) {
71092         osm.on("change.map", immediateRedraw);
71093       }
71094       function didUndoOrRedo(targetTransform) {
71095         var mode = context.mode().id;
71096         if (mode !== "browse" && mode !== "select") return;
71097         if (targetTransform) {
71098           map2.transformEase(targetTransform);
71099         }
71100       }
71101       context.history().on("merge.map", function() {
71102         scheduleRedraw();
71103       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
71104         didUndoOrRedo(fromStack.transform);
71105       }).on("redone.map", function(stack) {
71106         didUndoOrRedo(stack.transform);
71107       });
71108       context.background().on("change.map", immediateRedraw);
71109       context.features().on("redraw.map", immediateRedraw);
71110       drawLayers.on("change.map", function() {
71111         context.background().updateImagery();
71112         immediateRedraw();
71113       });
71114       selection2.on("wheel.map mousewheel.map", function(d3_event) {
71115         d3_event.preventDefault();
71116       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
71117       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
71118       wrapper = supersurface.append("div").attr("class", "layer layer-data");
71119       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
71120       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
71121         _lastPointerEvent = d3_event;
71122         if (d3_event.button === 2) {
71123           d3_event.stopPropagation();
71124         }
71125       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
71126         _lastPointerEvent = d3_event;
71127         if (resetTransform()) {
71128           immediateRedraw();
71129         }
71130       }).on(_pointerPrefix + "move.map", function(d3_event) {
71131         _lastPointerEvent = d3_event;
71132       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
71133         if (map2.editableDataEnabled() && !_isTransformed) {
71134           var hover = d3_event.target.__data__;
71135           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
71136           dispatch14.call("drawn", this, { full: false });
71137         }
71138       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
71139         if (map2.editableDataEnabled() && !_isTransformed) {
71140           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
71141           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
71142           dispatch14.call("drawn", this, { full: false });
71143         }
71144       });
71145       var detected = utilDetect();
71146       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
71147       // but we only need to do this on desktop Safari anyway. – #7694
71148       !detected.isMobileWebKit) {
71149         surface.on("gesturestart.surface", function(d3_event) {
71150           d3_event.preventDefault();
71151           _gestureTransformStart = projection2.transform();
71152         }).on("gesturechange.surface", gestureChange);
71153       }
71154       updateAreaFill();
71155       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
71156         if (!_dblClickZoomEnabled) return;
71157         if (typeof d3_event.target.__data__ === "object" && // or area fills
71158         !select_default2(d3_event.target).classed("fill")) return;
71159         var zoomOut2 = d3_event.shiftKey;
71160         var t2 = projection2.transform();
71161         var p1 = t2.invert(p02);
71162         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
71163         t2.x = p02[0] - p1[0] * t2.k;
71164         t2.y = p02[1] - p1[1] * t2.k;
71165         map2.transformEase(t2);
71166       });
71167       context.on("enter.map", function() {
71168         if (!map2.editableDataEnabled(
71169           true
71170           /* skip zoom check */
71171         )) return;
71172         if (_isTransformed) return;
71173         var graph = context.graph();
71174         var selectedAndParents = {};
71175         context.selectedIDs().forEach(function(id2) {
71176           var entity = graph.hasEntity(id2);
71177           if (entity) {
71178             selectedAndParents[entity.id] = entity;
71179             if (entity.type === "node") {
71180               graph.parentWays(entity).forEach(function(parent2) {
71181                 selectedAndParents[parent2.id] = parent2;
71182               });
71183             }
71184           }
71185         });
71186         var data = Object.values(selectedAndParents);
71187         var filter2 = function(d2) {
71188           return d2.id in selectedAndParents;
71189         };
71190         data = context.features().filter(data, graph);
71191         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
71192         dispatch14.call("drawn", this, { full: false });
71193         scheduleRedraw();
71194       });
71195       map2.dimensions(utilGetDimensions(selection2));
71196     }
71197     function zoomEventFilter(d3_event) {
71198       if (d3_event.type === "mousedown") {
71199         var hasOrphan = false;
71200         var listeners = window.__on;
71201         for (var i3 = 0; i3 < listeners.length; i3++) {
71202           var listener = listeners[i3];
71203           if (listener.name === "zoom" && listener.type === "mouseup") {
71204             hasOrphan = true;
71205             break;
71206           }
71207         }
71208         if (hasOrphan) {
71209           var event = window.CustomEvent;
71210           if (event) {
71211             event = new event("mouseup");
71212           } else {
71213             event = window.document.createEvent("Event");
71214             event.initEvent("mouseup", false, false);
71215           }
71216           event.view = window;
71217           window.dispatchEvent(event);
71218         }
71219       }
71220       return d3_event.button !== 2;
71221     }
71222     function pxCenter() {
71223       return [_dimensions[0] / 2, _dimensions[1] / 2];
71224     }
71225     function drawEditable(difference2, extent) {
71226       var mode = context.mode();
71227       var graph = context.graph();
71228       var features = context.features();
71229       var all = context.history().intersects(map2.extent());
71230       var fullRedraw = false;
71231       var data;
71232       var set4;
71233       var filter2;
71234       var applyFeatureLayerFilters = true;
71235       if (map2.isInWideSelection()) {
71236         data = [];
71237         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
71238           var entity = context.hasEntity(id2);
71239           if (entity) data.push(entity);
71240         });
71241         fullRedraw = true;
71242         filter2 = utilFunctor(true);
71243         applyFeatureLayerFilters = false;
71244       } else if (difference2) {
71245         var complete = difference2.complete(map2.extent());
71246         data = Object.values(complete).filter(Boolean);
71247         set4 = new Set(Object.keys(complete));
71248         filter2 = function(d2) {
71249           return set4.has(d2.id);
71250         };
71251         features.clear(data);
71252       } else {
71253         if (features.gatherStats(all, graph, _dimensions)) {
71254           extent = void 0;
71255         }
71256         if (extent) {
71257           data = context.history().intersects(map2.extent().intersection(extent));
71258           set4 = new Set(data.map(function(entity) {
71259             return entity.id;
71260           }));
71261           filter2 = function(d2) {
71262             return set4.has(d2.id);
71263           };
71264         } else {
71265           data = all;
71266           fullRedraw = true;
71267           filter2 = utilFunctor(true);
71268         }
71269       }
71270       if (applyFeatureLayerFilters) {
71271         data = features.filter(data, graph);
71272       } else {
71273         context.features().resetStats();
71274       }
71275       if (mode && mode.id === "select") {
71276         surface.call(drawVertices.drawSelected, graph, map2.extent());
71277       }
71278       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);
71279       dispatch14.call("drawn", this, { full: true });
71280     }
71281     map2.init = function() {
71282       drawLayers = svgLayers(projection2, context);
71283       drawPoints = svgPoints(projection2, context);
71284       drawVertices = svgVertices(projection2, context);
71285       drawLines = svgLines(projection2, context);
71286       drawAreas = svgAreas(projection2, context);
71287       drawMidpoints = svgMidpoints(projection2, context);
71288       drawLabels = svgLabels(projection2, context);
71289     };
71290     function editOff() {
71291       context.features().resetStats();
71292       surface.selectAll(".layer-osm *").remove();
71293       surface.selectAll(".layer-touch:not(.markers) *").remove();
71294       var allowed = {
71295         "browse": true,
71296         "save": true,
71297         "select-note": true,
71298         "select-data": true,
71299         "select-error": true
71300       };
71301       var mode = context.mode();
71302       if (mode && !allowed[mode.id]) {
71303         context.enter(modeBrowse(context));
71304       }
71305       dispatch14.call("drawn", this, { full: true });
71306     }
71307     function gestureChange(d3_event) {
71308       var e3 = d3_event;
71309       e3.preventDefault();
71310       var props = {
71311         deltaMode: 0,
71312         // dummy values to ignore in zoomPan
71313         deltaY: 1,
71314         // dummy values to ignore in zoomPan
71315         clientX: e3.clientX,
71316         clientY: e3.clientY,
71317         screenX: e3.screenX,
71318         screenY: e3.screenY,
71319         x: e3.x,
71320         y: e3.y
71321       };
71322       var e22 = new WheelEvent("wheel", props);
71323       e22._scale = e3.scale;
71324       e22._rotation = e3.rotation;
71325       _selection.node().dispatchEvent(e22);
71326     }
71327     function zoomPan2(event, key, transform2) {
71328       var source = event && event.sourceEvent || event;
71329       var eventTransform = transform2 || event && event.transform;
71330       var x2 = eventTransform.x;
71331       var y2 = eventTransform.y;
71332       var k3 = eventTransform.k;
71333       if (source && source.type === "wheel") {
71334         if (_pointerDown) return;
71335         var detected = utilDetect();
71336         var dX = source.deltaX;
71337         var dY = source.deltaY;
71338         var x22 = x2;
71339         var y22 = y2;
71340         var k22 = k3;
71341         var t02, p02, p1;
71342         if (source.deltaMode === 1) {
71343           var lines = Math.abs(source.deltaY);
71344           var sign2 = source.deltaY > 0 ? 1 : -1;
71345           dY = sign2 * clamp_default(
71346             lines * 18.001,
71347             4.000244140625,
71348             // min
71349             350.000244140625
71350             // max
71351           );
71352           t02 = _isTransformed ? _transformLast : _transformStart;
71353           p02 = _getMouseCoords(source);
71354           p1 = t02.invert(p02);
71355           k22 = t02.k * Math.pow(2, -dY / 500);
71356           k22 = clamp_default(k22, kMin, kMax);
71357           x22 = p02[0] - p1[0] * k22;
71358           y22 = p02[1] - p1[1] * k22;
71359         } else if (source._scale) {
71360           t02 = _gestureTransformStart;
71361           p02 = _getMouseCoords(source);
71362           p1 = t02.invert(p02);
71363           k22 = t02.k * source._scale;
71364           k22 = clamp_default(k22, kMin, kMax);
71365           x22 = p02[0] - p1[0] * k22;
71366           y22 = p02[1] - p1[1] * k22;
71367         } else if (source.ctrlKey && !isInteger(dY)) {
71368           dY *= 6;
71369           t02 = _isTransformed ? _transformLast : _transformStart;
71370           p02 = _getMouseCoords(source);
71371           p1 = t02.invert(p02);
71372           k22 = t02.k * Math.pow(2, -dY / 500);
71373           k22 = clamp_default(k22, kMin, kMax);
71374           x22 = p02[0] - p1[0] * k22;
71375           y22 = p02[1] - p1[1] * k22;
71376         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
71377           t02 = _isTransformed ? _transformLast : _transformStart;
71378           p02 = _getMouseCoords(source);
71379           p1 = t02.invert(p02);
71380           k22 = t02.k * Math.pow(2, -dY / 500);
71381           k22 = clamp_default(k22, kMin, kMax);
71382           x22 = p02[0] - p1[0] * k22;
71383           y22 = p02[1] - p1[1] * k22;
71384         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
71385           p1 = projection2.translate();
71386           x22 = p1[0] - dX;
71387           y22 = p1[1] - dY;
71388           k22 = projection2.scale();
71389           k22 = clamp_default(k22, kMin, kMax);
71390         }
71391         if (x22 !== x2 || y22 !== y2 || k22 !== k3) {
71392           x2 = x22;
71393           y2 = y22;
71394           k3 = k22;
71395           eventTransform = identity2.translate(x22, y22).scale(k22);
71396           if (_zoomerPanner._transform) {
71397             _zoomerPanner._transform(eventTransform);
71398           } else {
71399             _selection.node().__zoom = eventTransform;
71400           }
71401         }
71402       }
71403       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k3) {
71404         return;
71405       }
71406       if (geoScaleToZoom(k3, TILESIZE) < _minzoom) {
71407         surface.interrupt();
71408         dispatch14.call("hitMinZoom", this, map2);
71409         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
71410         scheduleRedraw();
71411         dispatch14.call("move", this, map2);
71412         return;
71413       }
71414       projection2.transform(eventTransform);
71415       var withinEditableZoom = map2.withinEditableZoom();
71416       if (_lastWithinEditableZoom !== withinEditableZoom) {
71417         if (_lastWithinEditableZoom !== void 0) {
71418           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
71419         }
71420         _lastWithinEditableZoom = withinEditableZoom;
71421       }
71422       var scale = k3 / _transformStart.k;
71423       var tX = (x2 / scale - _transformStart.x) * scale;
71424       var tY = (y2 / scale - _transformStart.y) * scale;
71425       if (context.inIntro()) {
71426         curtainProjection.transform({
71427           x: x2 - tX,
71428           y: y2 - tY,
71429           k: k3
71430         });
71431       }
71432       if (source) {
71433         _lastPointerEvent = event;
71434       }
71435       _isTransformed = true;
71436       _transformLast = eventTransform;
71437       utilSetTransform(supersurface, tX, tY, scale);
71438       scheduleRedraw();
71439       dispatch14.call("move", this, map2);
71440       function isInteger(val) {
71441         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
71442       }
71443     }
71444     function resetTransform() {
71445       if (!_isTransformed) return false;
71446       utilSetTransform(supersurface, 0, 0);
71447       _isTransformed = false;
71448       if (context.inIntro()) {
71449         curtainProjection.transform(projection2.transform());
71450       }
71451       return true;
71452     }
71453     function redraw(difference2, extent) {
71454       if (typeof window === "undefined") return;
71455       if (surface.empty() || !_redrawEnabled) return;
71456       if (resetTransform()) {
71457         difference2 = extent = void 0;
71458       }
71459       var zoom = map2.zoom();
71460       var z3 = String(~~zoom);
71461       if (surface.attr("data-zoom") !== z3) {
71462         surface.attr("data-zoom", z3);
71463       }
71464       var lat = map2.center()[1];
71465       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
71466       surface.classed("low-zoom", zoom <= lowzoom(lat));
71467       if (!difference2) {
71468         supersurface.call(context.background());
71469         wrapper.call(drawLayers);
71470       }
71471       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
71472         context.loadTiles(projection2);
71473         drawEditable(difference2, extent);
71474       } else {
71475         editOff();
71476       }
71477       _transformStart = projection2.transform();
71478       return map2;
71479     }
71480     var immediateRedraw = function(difference2, extent) {
71481       if (!difference2 && !extent) cancelPendingRedraw();
71482       redraw(difference2, extent);
71483     };
71484     map2.lastPointerEvent = function() {
71485       return _lastPointerEvent;
71486     };
71487     map2.mouse = function(d3_event) {
71488       var event = d3_event || _lastPointerEvent;
71489       if (event) {
71490         var s2;
71491         while (s2 = event.sourceEvent) {
71492           event = s2;
71493         }
71494         return _getMouseCoords(event);
71495       }
71496       return null;
71497     };
71498     map2.mouseCoordinates = function() {
71499       var coord2 = map2.mouse() || pxCenter();
71500       return projection2.invert(coord2);
71501     };
71502     map2.dblclickZoomEnable = function(val) {
71503       if (!arguments.length) return _dblClickZoomEnabled;
71504       _dblClickZoomEnabled = val;
71505       return map2;
71506     };
71507     map2.redrawEnable = function(val) {
71508       if (!arguments.length) return _redrawEnabled;
71509       _redrawEnabled = val;
71510       return map2;
71511     };
71512     map2.isTransformed = function() {
71513       return _isTransformed;
71514     };
71515     function setTransform(t2, duration, force) {
71516       var t3 = projection2.transform();
71517       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y) return false;
71518       if (duration) {
71519         _selection.transition().duration(duration).on("start", function() {
71520           map2.startEase();
71521         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
71522       } else {
71523         projection2.transform(t2);
71524         _transformStart = t2;
71525         _selection.call(_zoomerPanner.transform, _transformStart);
71526       }
71527       return true;
71528     }
71529     function setCenterZoom(loc2, z22, duration, force) {
71530       var c2 = map2.center();
71531       var z3 = map2.zoom();
71532       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z22 === z3 && !force) return false;
71533       var proj = geoRawMercator().transform(projection2.transform());
71534       var k22 = clamp_default(geoZoomToScale(z22, TILESIZE), kMin, kMax);
71535       proj.scale(k22);
71536       var t2 = proj.translate();
71537       var point = proj(loc2);
71538       var center = pxCenter();
71539       t2[0] += center[0] - point[0];
71540       t2[1] += center[1] - point[1];
71541       return setTransform(identity2.translate(t2[0], t2[1]).scale(k22), duration, force);
71542     }
71543     map2.pan = function(delta, duration) {
71544       var t2 = projection2.translate();
71545       var k3 = projection2.scale();
71546       t2[0] += delta[0];
71547       t2[1] += delta[1];
71548       if (duration) {
71549         _selection.transition().duration(duration).on("start", function() {
71550           map2.startEase();
71551         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k3));
71552       } else {
71553         projection2.translate(t2);
71554         _transformStart = projection2.transform();
71555         _selection.call(_zoomerPanner.transform, _transformStart);
71556         dispatch14.call("move", this, map2);
71557         immediateRedraw();
71558       }
71559       return map2;
71560     };
71561     map2.dimensions = function(val) {
71562       if (!arguments.length) return _dimensions;
71563       _dimensions = val;
71564       drawLayers.dimensions(_dimensions);
71565       context.background().dimensions(_dimensions);
71566       projection2.clipExtent([[0, 0], _dimensions]);
71567       _getMouseCoords = utilFastMouse(supersurface.node());
71568       scheduleRedraw();
71569       return map2;
71570     };
71571     function zoomIn(delta) {
71572       setCenterZoom(map2.center(), Math.trunc(map2.zoom() + 0.45) + delta, 150, true);
71573     }
71574     function zoomOut(delta) {
71575       setCenterZoom(map2.center(), Math.ceil(map2.zoom() - 0.45) - delta, 150, true);
71576     }
71577     map2.zoomIn = function() {
71578       zoomIn(1);
71579     };
71580     map2.zoomInFurther = function() {
71581       zoomIn(4);
71582     };
71583     map2.canZoomIn = function() {
71584       return map2.zoom() < maxZoom;
71585     };
71586     map2.zoomOut = function() {
71587       zoomOut(1);
71588     };
71589     map2.zoomOutFurther = function() {
71590       zoomOut(4);
71591     };
71592     map2.canZoomOut = function() {
71593       return map2.zoom() > minZoom4;
71594     };
71595     map2.center = function(loc2) {
71596       if (!arguments.length) {
71597         return projection2.invert(pxCenter());
71598       }
71599       if (setCenterZoom(loc2, map2.zoom())) {
71600         dispatch14.call("move", this, map2);
71601       }
71602       scheduleRedraw();
71603       return map2;
71604     };
71605     map2.unobscuredCenterZoomEase = function(loc, zoom) {
71606       var offset = map2.unobscuredOffsetPx();
71607       var proj = geoRawMercator().transform(projection2.transform());
71608       proj.scale(geoZoomToScale(zoom, TILESIZE));
71609       var locPx = proj(loc);
71610       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
71611       var offsetLoc = proj.invert(offsetLocPx);
71612       map2.centerZoomEase(offsetLoc, zoom);
71613     };
71614     map2.unobscuredOffsetPx = function() {
71615       var openPane = context.container().select(".map-panes .map-pane.shown");
71616       if (!openPane.empty()) {
71617         return [openPane.node().offsetWidth / 2, 0];
71618       }
71619       return [0, 0];
71620     };
71621     map2.zoom = function(z22) {
71622       if (!arguments.length) {
71623         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
71624       }
71625       if (z22 < _minzoom) {
71626         surface.interrupt();
71627         dispatch14.call("hitMinZoom", this, map2);
71628         z22 = context.minEditableZoom();
71629       }
71630       if (setCenterZoom(map2.center(), z22)) {
71631         dispatch14.call("move", this, map2);
71632       }
71633       scheduleRedraw();
71634       return map2;
71635     };
71636     map2.centerZoom = function(loc2, z22) {
71637       if (setCenterZoom(loc2, z22)) {
71638         dispatch14.call("move", this, map2);
71639       }
71640       scheduleRedraw();
71641       return map2;
71642     };
71643     map2.zoomTo = function(entities) {
71644       if (!isArray_default(entities)) {
71645         entities = [entities];
71646       }
71647       if (entities.length === 0) return map2;
71648       var extent = entities.map((entity) => entity.extent(context.graph())).reduce((a4, b3) => a4.extend(b3));
71649       if (!isFinite(extent.area())) return map2;
71650       var z22 = clamp_default(map2.trimmedExtentZoom(extent), 0, 20);
71651       return map2.centerZoom(extent.center(), z22);
71652     };
71653     map2.centerEase = function(loc2, duration) {
71654       duration = duration || 250;
71655       setCenterZoom(loc2, map2.zoom(), duration);
71656       return map2;
71657     };
71658     map2.zoomEase = function(z22, duration) {
71659       duration = duration || 250;
71660       setCenterZoom(map2.center(), z22, duration, false);
71661       return map2;
71662     };
71663     map2.centerZoomEase = function(loc2, z22, duration) {
71664       duration = duration || 250;
71665       setCenterZoom(loc2, z22, duration, false);
71666       return map2;
71667     };
71668     map2.transformEase = function(t2, duration) {
71669       duration = duration || 250;
71670       setTransform(
71671         t2,
71672         duration,
71673         false
71674         /* don't force */
71675       );
71676       return map2;
71677     };
71678     map2.zoomToEase = function(obj, duration) {
71679       var extent;
71680       if (Array.isArray(obj)) {
71681         obj.forEach(function(entity) {
71682           var entityExtent = entity.extent(context.graph());
71683           if (!extent) {
71684             extent = entityExtent;
71685           } else {
71686             extent = extent.extend(entityExtent);
71687           }
71688         });
71689       } else {
71690         extent = obj.extent(context.graph());
71691       }
71692       if (!isFinite(extent.area())) return map2;
71693       var z22 = clamp_default(map2.trimmedExtentZoom(extent), 0, 20);
71694       return map2.centerZoomEase(extent.center(), z22, duration);
71695     };
71696     map2.startEase = function() {
71697       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
71698         map2.cancelEase();
71699       });
71700       return map2;
71701     };
71702     map2.cancelEase = function() {
71703       _selection.interrupt();
71704       return map2;
71705     };
71706     map2.extent = function(val) {
71707       if (!arguments.length) {
71708         return new geoExtent(
71709           projection2.invert([0, _dimensions[1]]),
71710           projection2.invert([_dimensions[0], 0])
71711         );
71712       } else {
71713         var extent = geoExtent(val);
71714         map2.centerZoom(extent.center(), map2.extentZoom(extent));
71715       }
71716     };
71717     map2.trimmedExtent = function(val) {
71718       if (!arguments.length) {
71719         var headerY = 71;
71720         var footerY = 30;
71721         var pad3 = 10;
71722         return new geoExtent(
71723           projection2.invert([pad3, _dimensions[1] - footerY - pad3]),
71724           projection2.invert([_dimensions[0] - pad3, headerY + pad3])
71725         );
71726       } else {
71727         var extent = geoExtent(val);
71728         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
71729       }
71730     };
71731     function calcExtentZoom(extent, dim) {
71732       var tl = projection2([extent[0][0], extent[1][1]]);
71733       var br = projection2([extent[1][0], extent[0][1]]);
71734       var hFactor = (br[0] - tl[0]) / dim[0];
71735       var vFactor = (br[1] - tl[1]) / dim[1];
71736       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
71737       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
71738       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
71739       return newZoom;
71740     }
71741     map2.extentZoom = function(val) {
71742       return calcExtentZoom(geoExtent(val), _dimensions);
71743     };
71744     map2.trimmedExtentZoom = function(val) {
71745       var trimY = 120;
71746       var trimX = 40;
71747       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
71748       return calcExtentZoom(geoExtent(val), trimmed);
71749     };
71750     map2.withinEditableZoom = function() {
71751       return map2.zoom() >= context.minEditableZoom();
71752     };
71753     map2.isInWideSelection = function() {
71754       return !map2.withinEditableZoom() && context.selectedIDs().length;
71755     };
71756     map2.editableDataEnabled = function(skipZoomCheck) {
71757       var layer = context.layers().layer("osm");
71758       if (!layer || !layer.enabled()) return false;
71759       return skipZoomCheck || map2.withinEditableZoom();
71760     };
71761     map2.notesEditable = function() {
71762       var layer = context.layers().layer("notes");
71763       if (!layer || !layer.enabled()) return false;
71764       return map2.withinEditableZoom();
71765     };
71766     map2.minzoom = function(val) {
71767       if (!arguments.length) return _minzoom;
71768       _minzoom = val;
71769       return map2;
71770     };
71771     map2.toggleHighlightEdited = function() {
71772       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
71773       map2.pan([0, 0]);
71774       dispatch14.call("changeHighlighting", this);
71775     };
71776     map2.areaFillOptions = ["wireframe", "partial", "full"];
71777     map2.activeAreaFill = function(val) {
71778       if (!arguments.length) return corePreferences("area-fill") || "partial";
71779       corePreferences("area-fill", val);
71780       if (val !== "wireframe") {
71781         corePreferences("area-fill-toggle", val);
71782       }
71783       updateAreaFill();
71784       map2.pan([0, 0]);
71785       dispatch14.call("changeAreaFill", this);
71786       return map2;
71787     };
71788     map2.toggleWireframe = function() {
71789       var activeFill = map2.activeAreaFill();
71790       if (activeFill === "wireframe") {
71791         activeFill = corePreferences("area-fill-toggle") || "partial";
71792       } else {
71793         activeFill = "wireframe";
71794       }
71795       map2.activeAreaFill(activeFill);
71796     };
71797     function updateAreaFill() {
71798       var activeFill = map2.activeAreaFill();
71799       map2.areaFillOptions.forEach(function(opt) {
71800         surface.classed("fill-" + opt, Boolean(opt === activeFill));
71801       });
71802     }
71803     map2.layers = () => drawLayers;
71804     map2.doubleUpHandler = function() {
71805       return _doubleUpHandler;
71806     };
71807     return utilRebind(map2, dispatch14, "on");
71808   }
71809   var TILESIZE, minZoom4, maxZoom, kMin, kMax;
71810   var init_map = __esm({
71811     "modules/renderer/map.js"() {
71812       "use strict";
71813       init_throttle();
71814       init_src4();
71815       init_src8();
71816       init_src16();
71817       init_src5();
71818       init_src12();
71819       init_preferences();
71820       init_geo2();
71821       init_browse();
71822       init_svg();
71823       init_util2();
71824       init_bind_once();
71825       init_detect();
71826       init_dimensions();
71827       init_rebind();
71828       init_zoom_pan();
71829       init_double_up();
71830       init_lodash();
71831       TILESIZE = 256;
71832       minZoom4 = 2;
71833       maxZoom = 24;
71834       kMin = geoZoomToScale(minZoom4, TILESIZE);
71835       kMax = geoZoomToScale(maxZoom, TILESIZE);
71836     }
71837   });
71838
71839   // modules/renderer/photos.js
71840   var photos_exports = {};
71841   __export(photos_exports, {
71842     rendererPhotos: () => rendererPhotos
71843   });
71844   function rendererPhotos(context) {
71845     var dispatch14 = dispatch_default("change");
71846     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
71847     var _allPhotoTypes = ["flat", "panoramic"];
71848     var _shownPhotoTypes = _allPhotoTypes.slice();
71849     var _dateFilters = ["fromDate", "toDate"];
71850     var _fromDate;
71851     var _toDate;
71852     var _usernames;
71853     function photos() {
71854     }
71855     function updateStorage() {
71856       var hash2 = utilStringQs(window.location.hash);
71857       var enabled = context.layers().all().filter(function(d2) {
71858         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
71859       }).map(function(d2) {
71860         return d2.id;
71861       });
71862       if (enabled.length) {
71863         hash2.photo_overlay = enabled.join(",");
71864       } else {
71865         delete hash2.photo_overlay;
71866       }
71867       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
71868     }
71869     photos.overlayLayerIDs = function() {
71870       return _layerIDs;
71871     };
71872     photos.allPhotoTypes = function() {
71873       return _allPhotoTypes;
71874     };
71875     photos.dateFilters = function() {
71876       return _dateFilters;
71877     };
71878     photos.dateFilterValue = function(val) {
71879       return val === _dateFilters[0] ? _fromDate : _toDate;
71880     };
71881     photos.setDateFilter = function(type2, val, updateUrl) {
71882       var date = val && new Date(val);
71883       if (date && !isNaN(date)) {
71884         val = date.toISOString().slice(0, 10);
71885       } else {
71886         val = null;
71887       }
71888       if (type2 === _dateFilters[0]) {
71889         _fromDate = val;
71890         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
71891           _toDate = _fromDate;
71892         }
71893       }
71894       if (type2 === _dateFilters[1]) {
71895         _toDate = val;
71896         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
71897           _fromDate = _toDate;
71898         }
71899       }
71900       dispatch14.call("change", this);
71901       if (updateUrl) {
71902         var rangeString;
71903         if (_fromDate || _toDate) {
71904           rangeString = (_fromDate || "") + "_" + (_toDate || "");
71905         }
71906         setUrlFilterValue("photo_dates", rangeString);
71907       }
71908     };
71909     photos.setUsernameFilter = function(val, updateUrl) {
71910       if (val && typeof val === "string") val = val.replace(/;/g, ",").split(",");
71911       if (val) {
71912         val = val.map((d2) => d2.trim()).filter(Boolean);
71913         if (!val.length) {
71914           val = null;
71915         }
71916       }
71917       _usernames = val;
71918       dispatch14.call("change", this);
71919       if (updateUrl) {
71920         var hashString;
71921         if (_usernames) {
71922           hashString = _usernames.join(",");
71923         }
71924         setUrlFilterValue("photo_username", hashString);
71925       }
71926     };
71927     photos.togglePhotoType = function(val, updateUrl) {
71928       var index = _shownPhotoTypes.indexOf(val);
71929       if (index !== -1) {
71930         _shownPhotoTypes.splice(index, 1);
71931       } else {
71932         _shownPhotoTypes.push(val);
71933       }
71934       if (updateUrl) {
71935         var hashString;
71936         if (_shownPhotoTypes) {
71937           hashString = _shownPhotoTypes.join(",");
71938         }
71939         setUrlFilterValue("photo_type", hashString);
71940       }
71941       dispatch14.call("change", this);
71942       return photos;
71943     };
71944     function setUrlFilterValue(property, val) {
71945       const hash2 = utilStringQs(window.location.hash);
71946       if (val) {
71947         if (hash2[property] === val) return;
71948         hash2[property] = val;
71949       } else {
71950         if (!(property in hash2)) return;
71951         delete hash2[property];
71952       }
71953       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
71954     }
71955     function showsLayer(id2) {
71956       var layer = context.layers().layer(id2);
71957       return layer && layer.supported() && layer.enabled();
71958     }
71959     photos.shouldFilterDateBySlider = function() {
71960       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("mapilio") || showsLayer("streetside") || showsLayer("vegbilder") || showsLayer("panoramax");
71961     };
71962     photos.shouldFilterByPhotoType = function() {
71963       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder") || showsLayer("panoramax");
71964     };
71965     photos.shouldFilterByUsername = function() {
71966       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside") || showsLayer("panoramax");
71967     };
71968     photos.showsPhotoType = function(val) {
71969       if (!photos.shouldFilterByPhotoType()) return true;
71970       return _shownPhotoTypes.indexOf(val) !== -1;
71971     };
71972     photos.showsFlat = function() {
71973       return photos.showsPhotoType("flat");
71974     };
71975     photos.showsPanoramic = function() {
71976       return photos.showsPhotoType("panoramic");
71977     };
71978     photos.fromDate = function() {
71979       return _fromDate;
71980     };
71981     photos.toDate = function() {
71982       return _toDate;
71983     };
71984     photos.usernames = function() {
71985       return _usernames;
71986     };
71987     photos.init = function() {
71988       var hash2 = utilStringQs(window.location.hash);
71989       var parts;
71990       if (hash2.photo_dates) {
71991         parts = /^(.*)[–_](.*)$/g.exec(hash2.photo_dates.trim());
71992         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
71993         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
71994       }
71995       if (hash2.photo_username) {
71996         this.setUsernameFilter(hash2.photo_username, false);
71997       }
71998       if (hash2.photo_type) {
71999         parts = hash2.photo_type.replace(/;/g, ",").split(",");
72000         _allPhotoTypes.forEach((d2) => {
72001           if (!parts.includes(d2)) this.togglePhotoType(d2, false);
72002         });
72003       }
72004       if (hash2.photo_overlay) {
72005         var hashOverlayIDs = hash2.photo_overlay.replace(/;/g, ",").split(",");
72006         hashOverlayIDs.forEach(function(id2) {
72007           if (id2 === "openstreetcam") id2 = "kartaview";
72008           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
72009           if (layer2 && !layer2.enabled()) layer2.enabled(true);
72010         });
72011       }
72012       if (hash2.photo) {
72013         var photoIds = hash2.photo.replace(/;/g, ",").split(",");
72014         var photoId = photoIds.length && photoIds[0].trim();
72015         var results = /(.*)\/(.*)/g.exec(photoId);
72016         if (results && results.length >= 3) {
72017           var serviceId = results[1];
72018           if (serviceId === "openstreetcam") serviceId = "kartaview";
72019           var photoKey = results[2];
72020           var service = services[serviceId];
72021           if (service && service.ensureViewerLoaded) {
72022             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
72023             if (layer && !layer.enabled()) layer.enabled(true);
72024             var baselineTime = Date.now();
72025             service.on("loadedImages.rendererPhotos", function() {
72026               if (Date.now() - baselineTime > 45e3) {
72027                 service.on("loadedImages.rendererPhotos", null);
72028                 return;
72029               }
72030               if (!service.cachedImage(photoKey)) return;
72031               service.on("loadedImages.rendererPhotos", null);
72032               service.ensureViewerLoaded(context).then(function() {
72033                 service.selectImage(context, photoKey).showViewer(context);
72034               });
72035             });
72036           }
72037         }
72038       }
72039       context.layers().on("change.rendererPhotos", updateStorage);
72040     };
72041     return utilRebind(photos, dispatch14, "on");
72042   }
72043   var init_photos = __esm({
72044     "modules/renderer/photos.js"() {
72045       "use strict";
72046       init_src4();
72047       init_services();
72048       init_rebind();
72049       init_util();
72050     }
72051   });
72052
72053   // modules/renderer/index.js
72054   var renderer_exports = {};
72055   __export(renderer_exports, {
72056     rendererBackground: () => rendererBackground,
72057     rendererBackgroundSource: () => rendererBackgroundSource,
72058     rendererFeatures: () => rendererFeatures,
72059     rendererMap: () => rendererMap,
72060     rendererPhotos: () => rendererPhotos,
72061     rendererTileLayer: () => rendererTileLayer
72062   });
72063   var init_renderer = __esm({
72064     "modules/renderer/index.js"() {
72065       "use strict";
72066       init_background_source();
72067       init_background2();
72068       init_features();
72069       init_map();
72070       init_photos();
72071       init_tile_layer();
72072     }
72073   });
72074
72075   // modules/ui/map_in_map.js
72076   var map_in_map_exports = {};
72077   __export(map_in_map_exports, {
72078     uiMapInMap: () => uiMapInMap
72079   });
72080   function uiMapInMap(context) {
72081     function mapInMap(selection2) {
72082       var backgroundLayer = rendererTileLayer(context).underzoom(2);
72083       var overlayLayers = {};
72084       var projection2 = geoRawMercator();
72085       var dataLayer = svgData(projection2, context).showLabels(false);
72086       var debugLayer = svgDebug(projection2, context);
72087       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
72088       var wrap2 = select_default2(null);
72089       var tiles = select_default2(null);
72090       var viewport = select_default2(null);
72091       var _isTransformed = false;
72092       var _isHidden = true;
72093       var _skipEvents = false;
72094       var _gesture = null;
72095       var _zDiff = 6;
72096       var _dMini;
72097       var _cMini;
72098       var _tStart;
72099       var _tCurr;
72100       var _timeoutID;
72101       function zoomStarted() {
72102         if (_skipEvents) return;
72103         _tStart = _tCurr = projection2.transform();
72104         _gesture = null;
72105       }
72106       function zoomed(d3_event) {
72107         if (_skipEvents) return;
72108         var x2 = d3_event.transform.x;
72109         var y2 = d3_event.transform.y;
72110         var k3 = d3_event.transform.k;
72111         var isZooming = k3 !== _tStart.k;
72112         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
72113         if (!isZooming && !isPanning) {
72114           return;
72115         }
72116         if (!_gesture) {
72117           _gesture = isZooming ? "zoom" : "pan";
72118         }
72119         var tMini = projection2.transform();
72120         var tX, tY, scale;
72121         if (_gesture === "zoom") {
72122           scale = k3 / tMini.k;
72123           tX = (_cMini[0] / scale - _cMini[0]) * scale;
72124           tY = (_cMini[1] / scale - _cMini[1]) * scale;
72125         } else {
72126           k3 = tMini.k;
72127           scale = 1;
72128           tX = x2 - tMini.x;
72129           tY = y2 - tMini.y;
72130         }
72131         utilSetTransform(tiles, tX, tY, scale);
72132         utilSetTransform(viewport, 0, 0, scale);
72133         _isTransformed = true;
72134         _tCurr = identity2.translate(x2, y2).scale(k3);
72135         var zMain = geoScaleToZoom(context.projection.scale());
72136         var zMini = geoScaleToZoom(k3);
72137         _zDiff = zMain - zMini;
72138         queueRedraw();
72139       }
72140       function zoomEnded() {
72141         if (_skipEvents) return;
72142         if (_gesture !== "pan") return;
72143         updateProjection();
72144         _gesture = null;
72145         context.map().center(projection2.invert(_cMini));
72146       }
72147       function updateProjection() {
72148         var loc = context.map().center();
72149         var tMain = context.projection.transform();
72150         var zMain = geoScaleToZoom(tMain.k);
72151         var zMini = Math.max(zMain - _zDiff, 0.5);
72152         var kMini = geoZoomToScale(zMini);
72153         projection2.translate([tMain.x, tMain.y]).scale(kMini);
72154         var point = projection2(loc);
72155         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
72156         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
72157         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
72158         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
72159         _tCurr = projection2.transform();
72160         if (_isTransformed) {
72161           utilSetTransform(tiles, 0, 0);
72162           utilSetTransform(viewport, 0, 0);
72163           _isTransformed = false;
72164         }
72165         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
72166         _skipEvents = true;
72167         wrap2.call(zoom.transform, _tCurr);
72168         _skipEvents = false;
72169       }
72170       function redraw() {
72171         clearTimeout(_timeoutID);
72172         if (_isHidden) return;
72173         updateProjection();
72174         var zMini = geoScaleToZoom(projection2.scale());
72175         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
72176         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
72177         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
72178         var background = tiles.selectAll(".map-in-map-background").data([0]);
72179         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
72180         var overlaySources = context.background().overlayLayerSources();
72181         var activeOverlayLayers = [];
72182         for (var i3 = 0; i3 < overlaySources.length; i3++) {
72183           if (overlaySources[i3].validZoom(zMini)) {
72184             if (!overlayLayers[i3]) overlayLayers[i3] = rendererTileLayer(context);
72185             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
72186           }
72187         }
72188         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
72189         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
72190         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
72191           return d2.source().name();
72192         });
72193         overlays.exit().remove();
72194         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
72195           select_default2(this).call(layer);
72196         });
72197         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
72198         dataLayers.exit().remove();
72199         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
72200         if (_gesture !== "pan") {
72201           var getPath = path_default(projection2);
72202           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
72203           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
72204           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
72205           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
72206           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
72207             return getPath.area(d2) < 30;
72208           });
72209         }
72210       }
72211       function queueRedraw() {
72212         clearTimeout(_timeoutID);
72213         _timeoutID = setTimeout(function() {
72214           redraw();
72215         }, 750);
72216       }
72217       function toggle(d3_event) {
72218         if (d3_event) d3_event.preventDefault();
72219         _isHidden = !_isHidden;
72220         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
72221         if (_isHidden) {
72222           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
72223             selection2.selectAll(".map-in-map").style("display", "none");
72224           });
72225         } else {
72226           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
72227             redraw();
72228           });
72229         }
72230       }
72231       uiMapInMap.toggle = toggle;
72232       wrap2 = selection2.selectAll(".map-in-map").data([0]);
72233       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
72234       _dMini = [200, 150];
72235       _cMini = geoVecScale(_dMini, 0.5);
72236       context.map().on("drawn.map-in-map", function(drawn) {
72237         if (drawn.full === true) {
72238           redraw();
72239         }
72240       });
72241       redraw();
72242       context.keybinding().on(_t("background.minimap.key"), toggle);
72243     }
72244     return mapInMap;
72245   }
72246   var init_map_in_map = __esm({
72247     "modules/ui/map_in_map.js"() {
72248       "use strict";
72249       init_src2();
72250       init_src5();
72251       init_src12();
72252       init_localizer();
72253       init_geo2();
72254       init_renderer();
72255       init_svg();
72256       init_util();
72257     }
72258   });
72259
72260   // modules/ui/notice.js
72261   var notice_exports = {};
72262   __export(notice_exports, {
72263     uiNotice: () => uiNotice
72264   });
72265   function uiNotice(context) {
72266     return function(selection2) {
72267       var div = selection2.append("div").attr("class", "notice");
72268       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
72269         context.map().zoomEase(context.minEditableZoom());
72270       }).on("wheel", function(d3_event) {
72271         var e22 = new WheelEvent(d3_event.type, d3_event);
72272         context.surface().node().dispatchEvent(e22);
72273       });
72274       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
72275       function disableTooHigh() {
72276         var canEdit = context.map().zoom() >= context.minEditableZoom();
72277         div.style("display", canEdit ? "none" : "block");
72278       }
72279       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
72280       disableTooHigh();
72281     };
72282   }
72283   var init_notice = __esm({
72284     "modules/ui/notice.js"() {
72285       "use strict";
72286       init_debounce();
72287       init_localizer();
72288       init_svg();
72289     }
72290   });
72291
72292   // modules/ui/photoviewer.js
72293   var photoviewer_exports = {};
72294   __export(photoviewer_exports, {
72295     uiPhotoviewer: () => uiPhotoviewer
72296   });
72297   function uiPhotoviewer(context) {
72298     var dispatch14 = dispatch_default("resize");
72299     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72300     const addPhotoIdButton = /* @__PURE__ */ new Set(["mapillary", "panoramax"]);
72301     function photoviewer(selection2) {
72302       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
72303         for (const service of Object.values(services)) {
72304           if (typeof service.hideViewer === "function") {
72305             service.hideViewer(context);
72306           }
72307         }
72308       }).append("div").call(svgIcon("#iD-icon-close"));
72309       function preventDefault(d3_event) {
72310         d3_event.preventDefault();
72311       }
72312       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
72313         _pointerPrefix + "down",
72314         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
72315       );
72316       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
72317         _pointerPrefix + "down",
72318         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
72319       );
72320       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
72321         _pointerPrefix + "down",
72322         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
72323       );
72324       context.features().on("change.setPhotoFromViewer", function() {
72325         setPhotoTagButton();
72326       });
72327       context.history().on("change.setPhotoFromViewer", function() {
72328         setPhotoTagButton();
72329       });
72330       function setPhotoTagButton() {
72331         const service = getServiceId();
72332         const isActiveForService = addPhotoIdButton.has(service) && services[service].isViewerOpen() && layerEnabled(service) && context.mode().id === "select";
72333         renderAddPhotoIdButton(service, isActiveForService);
72334         function layerEnabled(which) {
72335           const layers = context.layers();
72336           const layer = layers.layer(which);
72337           return layer.enabled();
72338         }
72339         function getServiceId() {
72340           for (const serviceId in services) {
72341             const service2 = services[serviceId];
72342             if (typeof service2.isViewerOpen === "function") {
72343               if (service2.isViewerOpen()) {
72344                 return serviceId;
72345               }
72346             }
72347           }
72348           return false;
72349         }
72350         function renderAddPhotoIdButton(service2, shouldDisplay) {
72351           const button = selection2.selectAll(".set-photo-from-viewer").data(shouldDisplay ? [0] : []);
72352           button.exit().remove();
72353           const buttonEnter = button.enter().append("button").attr("class", "set-photo-from-viewer").call(svgIcon("#fas-eye-dropper")).call(
72354             uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
72355           );
72356           buttonEnter.select(".tooltip").classed("dark", true).style("width", "300px").merge(button).on("click", function(e3) {
72357             e3.preventDefault();
72358             e3.stopPropagation();
72359             const activeServiceId = getServiceId();
72360             const image = services[activeServiceId].getActiveImage();
72361             const action = (graph2) => context.selectedIDs().reduce((graph3, entityID) => {
72362               const tags = graph3.entity(entityID).tags;
72363               const action2 = actionChangeTags(entityID, { ...tags, [activeServiceId]: image.id });
72364               return action2(graph3);
72365             }, graph2);
72366             const annotation = _t("operations.change_tags.annotation");
72367             context.perform(action, annotation);
72368             buttonDisable("already_set");
72369           });
72370           if (service2 === "panoramax") {
72371             const panoramaxControls = selection2.select(".panoramax-wrapper .pnlm-zoom-controls.pnlm-controls");
72372             panoramaxControls.style("margin-top", shouldDisplay ? "36px" : "6px");
72373           }
72374           if (!shouldDisplay) return;
72375           const activeImage = services[service2].getActiveImage();
72376           const graph = context.graph();
72377           const entities = context.selectedIDs().map((id2) => graph.hasEntity(id2)).filter(Boolean);
72378           if (entities.map((entity) => entity.tags[service2]).every((value) => value === (activeImage == null ? void 0 : activeImage.id))) {
72379             buttonDisable("already_set");
72380           } else if (activeImage && entities.map((entity) => entity.extent(context.graph()).center()).every((loc) => geoSphericalDistance(loc, activeImage.loc) > 100)) {
72381             buttonDisable("too_far");
72382           } else {
72383             buttonDisable(false);
72384           }
72385         }
72386         function buttonDisable(reason) {
72387           const disabled = reason !== false;
72388           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
72389           button.attr("disabled", disabled ? "true" : null);
72390           button.classed("disabled", disabled);
72391           button.call(uiTooltip().destroyAny);
72392           if (disabled) {
72393             button.call(
72394               uiTooltip().title(() => _t.append(`inspector.set_photo_from_viewer.disable.${reason}`)).placement("right")
72395             );
72396           } else {
72397             button.call(
72398               uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
72399             );
72400           }
72401           button.select(".tooltip").classed("dark", true).style("width", "300px");
72402         }
72403       }
72404       function buildResizeListener(target, eventName, dispatch15, options) {
72405         var resizeOnX = !!options.resizeOnX;
72406         var resizeOnY = !!options.resizeOnY;
72407         var minHeight = options.minHeight || 240;
72408         var minWidth = options.minWidth || 320;
72409         var pointerId;
72410         var startX;
72411         var startY;
72412         var startWidth;
72413         var startHeight;
72414         function startResize(d3_event) {
72415           if (pointerId !== (d3_event.pointerId || "mouse")) return;
72416           d3_event.preventDefault();
72417           d3_event.stopPropagation();
72418           var mapSize = context.map().dimensions();
72419           if (resizeOnX) {
72420             var mapWidth = mapSize[0];
72421             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-left"), 10);
72422             var newWidth = clamp_default(startWidth + d3_event.clientX - startX, minWidth, mapWidth - viewerMargin * 2);
72423             target.style("width", newWidth + "px");
72424           }
72425           if (resizeOnY) {
72426             const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
72427             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
72428             var maxHeight = mapSize[1] - menuHeight - viewerMargin * 2;
72429             var newHeight = clamp_default(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
72430             target.style("height", newHeight + "px");
72431           }
72432           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
72433         }
72434         function stopResize(d3_event) {
72435           if (pointerId !== (d3_event.pointerId || "mouse")) return;
72436           d3_event.preventDefault();
72437           d3_event.stopPropagation();
72438           select_default2(window).on("." + eventName, null);
72439         }
72440         return function initResize(d3_event) {
72441           d3_event.preventDefault();
72442           d3_event.stopPropagation();
72443           pointerId = d3_event.pointerId || "mouse";
72444           startX = d3_event.clientX;
72445           startY = d3_event.clientY;
72446           var targetRect = target.node().getBoundingClientRect();
72447           startWidth = targetRect.width;
72448           startHeight = targetRect.height;
72449           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
72450           if (_pointerPrefix === "pointer") {
72451             select_default2(window).on("pointercancel." + eventName, stopResize, false);
72452           }
72453         };
72454       }
72455     }
72456     photoviewer.onMapResize = function() {
72457       var photoviewer2 = context.container().select(".photoviewer");
72458       var content = context.container().select(".main-content");
72459       var mapDimensions = utilGetDimensions(content, true);
72460       const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
72461       const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
72462       var photoDimensions = utilGetDimensions(photoviewer2, true);
72463       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - menuHeight - viewerMargin * 2) {
72464         var setPhotoDimensions = [
72465           Math.min(photoDimensions[0], mapDimensions[0]),
72466           Math.min(photoDimensions[1], mapDimensions[1] - menuHeight - viewerMargin * 2)
72467         ];
72468         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
72469         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
72470       }
72471     };
72472     function subtractPadding(dimensions, selection2) {
72473       return [
72474         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
72475         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
72476       ];
72477     }
72478     return utilRebind(photoviewer, dispatch14, "on");
72479   }
72480   var init_photoviewer = __esm({
72481     "modules/ui/photoviewer.js"() {
72482       "use strict";
72483       init_src5();
72484       init_lodash();
72485       init_localizer();
72486       init_src4();
72487       init_icon();
72488       init_dimensions();
72489       init_util();
72490       init_services();
72491       init_tooltip();
72492       init_actions();
72493       init_geo2();
72494     }
72495   });
72496
72497   // modules/ui/restore.js
72498   var restore_exports = {};
72499   __export(restore_exports, {
72500     uiRestore: () => uiRestore
72501   });
72502   function uiRestore(context) {
72503     return function(selection2) {
72504       if (!context.history().hasRestorableChanges()) return;
72505       let modalSelection = uiModal(selection2, true);
72506       modalSelection.select(".modal").attr("class", "modal fillL");
72507       let introModal = modalSelection.select(".content");
72508       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
72509       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
72510       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
72511       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
72512         context.history().restore();
72513         modalSelection.remove();
72514       });
72515       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
72516       restore.append("div").call(_t.append("restore.restore"));
72517       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
72518         context.history().clearSaved();
72519         modalSelection.remove();
72520       });
72521       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
72522       reset.append("div").call(_t.append("restore.reset"));
72523       restore.node().focus();
72524     };
72525   }
72526   var init_restore = __esm({
72527     "modules/ui/restore.js"() {
72528       "use strict";
72529       init_localizer();
72530       init_modal();
72531     }
72532   });
72533
72534   // modules/ui/scale.js
72535   var scale_exports2 = {};
72536   __export(scale_exports2, {
72537     uiScale: () => uiScale
72538   });
72539   function uiScale(context) {
72540     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
72541     function scaleDefs(loc1, loc2) {
72542       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;
72543       if (isImperial) {
72544         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
72545       } else {
72546         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
72547       }
72548       for (i3 = 0; i3 < buckets.length; i3++) {
72549         val = buckets[i3];
72550         if (dist >= val) {
72551           scale.dist = Math.floor(dist / val) * val;
72552           break;
72553         } else {
72554           scale.dist = +dist.toFixed(2);
72555         }
72556       }
72557       dLon = geoMetersToLon(scale.dist / conversion, lat);
72558       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
72559       scale.text = displayLength(scale.dist / conversion, isImperial);
72560       return scale;
72561     }
72562     function update(selection2) {
72563       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
72564       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
72565       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
72566     }
72567     return function(selection2) {
72568       function switchUnits() {
72569         isImperial = !isImperial;
72570         selection2.call(update);
72571       }
72572       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
72573       scalegroup.append("path").attr("class", "scale-path");
72574       selection2.append("div").attr("class", "scale-text");
72575       selection2.call(update);
72576       context.map().on("move.scale", function() {
72577         update(selection2);
72578       });
72579     };
72580   }
72581   var init_scale2 = __esm({
72582     "modules/ui/scale.js"() {
72583       "use strict";
72584       init_units();
72585       init_geo2();
72586       init_localizer();
72587     }
72588   });
72589
72590   // modules/ui/shortcuts.js
72591   var shortcuts_exports = {};
72592   __export(shortcuts_exports, {
72593     uiShortcuts: () => uiShortcuts
72594   });
72595   function uiShortcuts(context) {
72596     var detected = utilDetect();
72597     var _activeTab = 0;
72598     var _modalSelection;
72599     var _selection = select_default2(null);
72600     var _dataShortcuts;
72601     function shortcutsModal(_modalSelection2) {
72602       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
72603       var content = _modalSelection2.select(".content");
72604       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
72605       _mainFileFetcher.get("shortcuts").then(function(data) {
72606         _dataShortcuts = data;
72607         content.call(render);
72608       }).catch(function() {
72609       });
72610     }
72611     function render(selection2) {
72612       if (!_dataShortcuts) return;
72613       var wrapper = selection2.selectAll(".wrapper").data([0]);
72614       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
72615       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
72616       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
72617       wrapper = wrapper.merge(wrapperEnter);
72618       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
72619       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
72620         d3_event.preventDefault();
72621         var i3 = _dataShortcuts.indexOf(d2);
72622         _activeTab = i3;
72623         render(selection2);
72624       });
72625       tabsEnter.append("span").html(function(d2) {
72626         return _t.html(d2.text);
72627       });
72628       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
72629         return i3 === _activeTab;
72630       });
72631       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
72632       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
72633         return "shortcut-tab shortcut-tab-" + d2.tab;
72634       });
72635       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
72636         return d2.columns;
72637       }).enter().append("table").attr("class", "shortcut-column");
72638       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
72639         return d2.rows;
72640       }).enter().append("tr").attr("class", "shortcut-row");
72641       var sectionRows = rowsEnter.filter(function(d2) {
72642         return !d2.shortcuts;
72643       });
72644       sectionRows.append("td");
72645       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
72646         return _t.html(d2.text);
72647       });
72648       var shortcutRows = rowsEnter.filter(function(d2) {
72649         return d2.shortcuts;
72650       });
72651       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
72652       var modifierKeys = shortcutKeys.filter(function(d2) {
72653         return d2.modifiers;
72654       });
72655       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
72656         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
72657           return ["\u2318"];
72658         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
72659           return [];
72660         } else {
72661           return d2.modifiers;
72662         }
72663       }).enter().each(function() {
72664         var selection3 = select_default2(this);
72665         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
72666           return uiCmd.display(d2);
72667         });
72668         selection3.append("span").text("+");
72669       });
72670       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
72671         var arr = d2.shortcuts;
72672         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
72673           arr = ["Y"];
72674         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
72675           arr = ["F11"];
72676         }
72677         arr = arr.map(function(s2) {
72678           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
72679         });
72680         return utilArrayUniq(arr).map(function(s2) {
72681           return {
72682             shortcut: s2,
72683             separator: d2.separator,
72684             suffix: d2.suffix
72685           };
72686         });
72687       }).enter().each(function(d2, i3, nodes) {
72688         var selection3 = select_default2(this);
72689         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
72690         if (click && click[1]) {
72691           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
72692         } else if (d2.shortcut.toLowerCase() === "long-press") {
72693           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
72694         } else if (d2.shortcut.toLowerCase() === "tap") {
72695           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
72696         } else {
72697           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
72698             return d4.shortcut;
72699           });
72700         }
72701         if (i3 < nodes.length - 1) {
72702           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
72703         } else if (i3 === nodes.length - 1 && d2.suffix) {
72704           selection3.append("span").text(d2.suffix);
72705         }
72706       });
72707       shortcutKeys.filter(function(d2) {
72708         return d2.gesture;
72709       }).each(function() {
72710         var selection3 = select_default2(this);
72711         selection3.append("span").text("+");
72712         selection3.append("span").attr("class", "gesture").html(function(d2) {
72713           return _t.html(d2.gesture);
72714         });
72715       });
72716       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
72717         return d2.text ? _t.html(d2.text) : "\xA0";
72718       });
72719       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
72720         return i3 === _activeTab ? "flex" : "none";
72721       });
72722     }
72723     return function(selection2, show) {
72724       _selection = selection2;
72725       if (show) {
72726         _modalSelection = uiModal(selection2);
72727         _modalSelection.call(shortcutsModal);
72728       } else {
72729         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
72730           if (context.container().selectAll(".modal-shortcuts").size()) {
72731             if (_modalSelection) {
72732               _modalSelection.close();
72733               _modalSelection = null;
72734             }
72735           } else {
72736             _modalSelection = uiModal(_selection);
72737             _modalSelection.call(shortcutsModal);
72738           }
72739         });
72740       }
72741     };
72742   }
72743   var init_shortcuts = __esm({
72744     "modules/ui/shortcuts.js"() {
72745       "use strict";
72746       init_src5();
72747       init_file_fetcher();
72748       init_localizer();
72749       init_icon();
72750       init_cmd();
72751       init_modal();
72752       init_util();
72753       init_detect();
72754     }
72755   });
72756
72757   // node_modules/@mapbox/sexagesimal/index.js
72758   var require_sexagesimal = __commonJS({
72759     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
72760       module2.exports = element;
72761       module2.exports.pair = pair3;
72762       module2.exports.format = format2;
72763       module2.exports.formatPair = formatPair;
72764       module2.exports.coordToDMS = coordToDMS;
72765       function element(input, dims) {
72766         var result = search(input, dims);
72767         return result === null ? null : result.val;
72768       }
72769       function formatPair(input) {
72770         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
72771       }
72772       function format2(input, dim) {
72773         var dms = coordToDMS(input, dim);
72774         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
72775       }
72776       function coordToDMS(input, dim) {
72777         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
72778         var dir = dirs[input >= 0 ? 0 : 1];
72779         var abs3 = Math.abs(input);
72780         var whole = Math.floor(abs3);
72781         var fraction = abs3 - whole;
72782         var fractionMinutes = fraction * 60;
72783         var minutes = Math.floor(fractionMinutes);
72784         var seconds = Math.floor((fractionMinutes - minutes) * 60);
72785         return {
72786           whole,
72787           minutes,
72788           seconds,
72789           dir
72790         };
72791       }
72792       function search(input, dims) {
72793         if (!dims) dims = "NSEW";
72794         if (typeof input !== "string") return null;
72795         input = input.toUpperCase();
72796         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
72797         var m3 = input.match(regex);
72798         if (!m3) return null;
72799         var matched = m3[0];
72800         var dim;
72801         if (m3[1] && m3[5]) {
72802           dim = m3[1];
72803           matched = matched.slice(0, -1);
72804         } else {
72805           dim = m3[1] || m3[5];
72806         }
72807         if (dim && dims.indexOf(dim) === -1) return null;
72808         var deg = m3[2] ? parseFloat(m3[2]) : 0;
72809         var min3 = m3[3] ? parseFloat(m3[3]) / 60 : 0;
72810         var sec = m3[4] ? parseFloat(m3[4]) / 3600 : 0;
72811         var sign2 = deg < 0 ? -1 : 1;
72812         if (dim === "S" || dim === "W") sign2 *= -1;
72813         return {
72814           val: (Math.abs(deg) + min3 + sec) * sign2,
72815           dim,
72816           matched,
72817           remain: input.slice(matched.length)
72818         };
72819       }
72820       function pair3(input, dims) {
72821         input = input.trim();
72822         var one2 = search(input, dims);
72823         if (!one2) return null;
72824         input = one2.remain.trim();
72825         var two = search(input, dims);
72826         if (!two || two.remain) return null;
72827         if (one2.dim) {
72828           return swapdim(one2.val, two.val, one2.dim);
72829         } else {
72830           return [one2.val, two.val];
72831         }
72832       }
72833       function swapdim(a4, b3, dim) {
72834         if (dim === "N" || dim === "S") return [a4, b3];
72835         if (dim === "W" || dim === "E") return [b3, a4];
72836       }
72837     }
72838   });
72839
72840   // modules/ui/feature_list.js
72841   var feature_list_exports = {};
72842   __export(feature_list_exports, {
72843     uiFeatureList: () => uiFeatureList
72844   });
72845   function uiFeatureList(context) {
72846     var _geocodeResults;
72847     function featureList(selection2) {
72848       var header = selection2.append("div").attr("class", "header fillL");
72849       header.append("h2").call(_t.append("inspector.feature_list"));
72850       var searchWrap = selection2.append("div").attr("class", "search-header");
72851       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
72852       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
72853       var listWrap = selection2.append("div").attr("class", "inspector-body");
72854       var list = listWrap.append("div").attr("class", "feature-list");
72855       context.on("exit.feature-list", clearSearch);
72856       context.map().on("drawn.feature-list", mapDrawn);
72857       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
72858       function focusSearch(d3_event) {
72859         var mode = context.mode() && context.mode().id;
72860         if (mode !== "browse") return;
72861         d3_event.preventDefault();
72862         search.node().focus();
72863       }
72864       function keydown(d3_event) {
72865         if (d3_event.keyCode === 27) {
72866           search.node().blur();
72867         }
72868       }
72869       function keypress(d3_event) {
72870         var q3 = search.property("value"), items = list.selectAll(".feature-list-item");
72871         if (d3_event.keyCode === 13 && // ↩ Return
72872         q3.length && items.size()) {
72873           click(d3_event, items.datum());
72874         }
72875       }
72876       function inputevent() {
72877         _geocodeResults = void 0;
72878         drawList();
72879       }
72880       function clearSearch() {
72881         search.property("value", "");
72882         drawList();
72883       }
72884       function mapDrawn(e3) {
72885         if (e3.full) {
72886           drawList();
72887         }
72888       }
72889       function features() {
72890         var graph = context.graph();
72891         var visibleCenter = context.map().extent().center();
72892         var q3 = search.property("value").toLowerCase().trim();
72893         if (!q3) return [];
72894         const locationMatch = sexagesimal.pair(q3.toUpperCase()) || dmsMatcher(q3);
72895         const coordResult = [];
72896         if (locationMatch) {
72897           const latLon = [Number(locationMatch[0]), Number(locationMatch[1])];
72898           const lonLat = [latLon[1], latLon[0]];
72899           const isLatLonValid = latLon[0] >= -90 && latLon[0] <= 90 && latLon[1] >= -180 && latLon[1] <= 180;
72900           let isLonLatValid = lonLat[0] >= -90 && lonLat[0] <= 90 && lonLat[1] >= -180 && lonLat[1] <= 180;
72901           isLonLatValid && (isLonLatValid = !q3.match(/[NSEW]/i));
72902           isLonLatValid && (isLonLatValid = !locationMatch[2]);
72903           isLonLatValid && (isLonLatValid = lonLat[0] !== lonLat[1]);
72904           if (isLatLonValid) {
72905             coordResult.push({
72906               id: latLon[0] + "/" + latLon[1],
72907               geometry: "point",
72908               type: _t("inspector.location"),
72909               name: dmsCoordinatePair([latLon[1], latLon[0]]),
72910               location: latLon,
72911               zoom: locationMatch[2]
72912             });
72913           }
72914           if (isLonLatValid) {
72915             coordResult.push({
72916               id: lonLat[0] + "/" + lonLat[1],
72917               geometry: "point",
72918               type: _t("inspector.location"),
72919               name: dmsCoordinatePair([lonLat[1], lonLat[0]]),
72920               location: lonLat
72921             });
72922           }
72923         }
72924         const idMatch = !locationMatch && q3.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
72925         const idResult = [];
72926         if (idMatch) {
72927           var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
72928           var elemId = idMatch[2];
72929           idResult.push({
72930             id: elemType + elemId,
72931             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
72932             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
72933             name: elemId
72934           });
72935         }
72936         var allEntities = graph.entities;
72937         const localResults = [];
72938         for (var id2 in allEntities) {
72939           var entity = allEntities[id2];
72940           if (!entity) continue;
72941           var name = utilDisplayName(entity) || "";
72942           if (name.toLowerCase().indexOf(q3) < 0) continue;
72943           var matched = _mainPresetIndex.match(entity, graph);
72944           var type2 = matched && matched.name() || utilDisplayType(entity.id);
72945           var extent = entity.extent(graph);
72946           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
72947           localResults.push({
72948             id: entity.id,
72949             entity,
72950             geometry: entity.geometry(graph),
72951             type: type2,
72952             name,
72953             distance
72954           });
72955           if (localResults.length > 100) break;
72956         }
72957         localResults.sort((a4, b3) => a4.distance - b3.distance);
72958         const geocodeResults = [];
72959         (_geocodeResults || []).forEach(function(d2) {
72960           if (d2.osm_type && d2.osm_id) {
72961             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
72962             var tags = {};
72963             tags[d2.class] = d2.type;
72964             var attrs = { id: id3, type: d2.osm_type, tags };
72965             if (d2.osm_type === "way") {
72966               attrs.nodes = ["a", "a"];
72967             }
72968             var tempEntity = osmEntity(attrs);
72969             var tempGraph = coreGraph([tempEntity]);
72970             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
72971             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
72972             geocodeResults.push({
72973               id: tempEntity.id,
72974               geometry: tempEntity.geometry(tempGraph),
72975               type: type3,
72976               name: d2.display_name,
72977               extent: new geoExtent(
72978                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
72979                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
72980               )
72981             });
72982           }
72983         });
72984         const extraResults = [];
72985         if (q3.match(/^[0-9]+$/)) {
72986           extraResults.push({
72987             id: "n" + q3,
72988             geometry: "point",
72989             type: _t("inspector.node"),
72990             name: q3
72991           });
72992           extraResults.push({
72993             id: "w" + q3,
72994             geometry: "line",
72995             type: _t("inspector.way"),
72996             name: q3
72997           });
72998           extraResults.push({
72999             id: "r" + q3,
73000             geometry: "relation",
73001             type: _t("inspector.relation"),
73002             name: q3
73003           });
73004           extraResults.push({
73005             id: "note" + q3,
73006             geometry: "note",
73007             type: _t("note.note"),
73008             name: q3
73009           });
73010         }
73011         return [...idResult, ...localResults, ...coordResult, ...geocodeResults, ...extraResults];
73012       }
73013       function drawList() {
73014         var value = search.property("value");
73015         var results = features();
73016         list.classed("filtered", value.length);
73017         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"));
73018         resultsIndicator.append("span").attr("class", "entity-name");
73019         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
73020         if (services.geocoder) {
73021           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"));
73022         }
73023         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
73024         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
73025         var items = list.selectAll(".feature-list-item").data(results, function(d2) {
73026           return d2.id;
73027         });
73028         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);
73029         var label = enter.append("div").attr("class", "label");
73030         label.each(function(d2) {
73031           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
73032         });
73033         label.append("span").attr("class", "entity-type").text(function(d2) {
73034           return d2.type;
73035         });
73036         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) {
73037           return d2.name;
73038         });
73039         enter.style("opacity", 0).transition().style("opacity", 1);
73040         items.exit().each((d2) => mouseout(void 0, d2)).remove();
73041         items.merge(enter).order();
73042       }
73043       function mouseover(d3_event, d2) {
73044         if (d2.location !== void 0) return;
73045         utilHighlightEntities([d2.id], true, context);
73046       }
73047       function mouseout(d3_event, d2) {
73048         if (d2.location !== void 0) return;
73049         utilHighlightEntities([d2.id], false, context);
73050       }
73051       function click(d3_event, d2) {
73052         d3_event.preventDefault();
73053         if (d2.location) {
73054           context.map().centerZoomEase([d2.location[1], d2.location[0]], d2.zoom || 19);
73055         } else if (d2.entity) {
73056           utilHighlightEntities([d2.id], false, context);
73057           context.enter(modeSelect(context, [d2.entity.id]));
73058           context.map().zoomToEase(d2.entity);
73059         } else if (d2.geometry === "note") {
73060           const noteId = d2.id.replace(/\D/g, "");
73061           context.moveToNote(noteId);
73062         } else {
73063           context.zoomToEntity(d2.id);
73064         }
73065       }
73066       function geocoderSearch() {
73067         services.geocoder.search(search.property("value"), function(err, resp) {
73068           _geocodeResults = resp || [];
73069           drawList();
73070         });
73071       }
73072     }
73073     return featureList;
73074   }
73075   var sexagesimal;
73076   var init_feature_list = __esm({
73077     "modules/ui/feature_list.js"() {
73078       "use strict";
73079       init_src5();
73080       sexagesimal = __toESM(require_sexagesimal());
73081       init_presets();
73082       init_localizer();
73083       init_units();
73084       init_graph();
73085       init_geo();
73086       init_geo2();
73087       init_select5();
73088       init_entity();
73089       init_tags();
73090       init_services();
73091       init_icon();
73092       init_cmd();
73093       init_util();
73094     }
73095   });
73096
73097   // modules/ui/sections/entity_issues.js
73098   var entity_issues_exports = {};
73099   __export(entity_issues_exports, {
73100     uiSectionEntityIssues: () => uiSectionEntityIssues
73101   });
73102   function uiSectionEntityIssues(context) {
73103     var preference = corePreferences("entity-issues.reference.expanded");
73104     var _expanded = preference === null ? true : preference === "true";
73105     var _entityIDs = [];
73106     var _issues = [];
73107     var _activeIssueID;
73108     var section = uiSection("entity-issues", context).shouldDisplay(function() {
73109       return _issues.length > 0;
73110     }).label(function() {
73111       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
73112     }).disclosureContent(renderDisclosureContent);
73113     context.validator().on("validated.entity_issues", function() {
73114       reloadIssues();
73115       section.reRender();
73116     }).on("focusedIssue.entity_issues", function(issue) {
73117       makeActiveIssue(issue.id);
73118     });
73119     function reloadIssues() {
73120       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
73121     }
73122     function makeActiveIssue(issueID) {
73123       _activeIssueID = issueID;
73124       section.selection().selectAll(".issue-container").classed("active", function(d2) {
73125         return d2.id === _activeIssueID;
73126       });
73127     }
73128     function renderDisclosureContent(selection2) {
73129       selection2.classed("grouped-items-area", true);
73130       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
73131       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
73132         return d2.key;
73133       });
73134       containers.exit().remove();
73135       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
73136       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
73137         return "issue severity-" + d2.severity;
73138       }).on("mouseover.highlight", function(d3_event, d2) {
73139         var ids = d2.entityIds.filter(function(e3) {
73140           return _entityIDs.indexOf(e3) === -1;
73141         });
73142         utilHighlightEntities(ids, true, context);
73143       }).on("mouseout.highlight", function(d3_event, d2) {
73144         var ids = d2.entityIds.filter(function(e3) {
73145           return _entityIDs.indexOf(e3) === -1;
73146         });
73147         utilHighlightEntities(ids, false, context);
73148       });
73149       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
73150       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
73151         makeActiveIssue(d2.id);
73152         var extent = d2.extent(context.graph());
73153         if (extent) {
73154           var setZoom = Math.max(context.map().zoom(), 19);
73155           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
73156         }
73157       });
73158       textEnter.each(function(d2) {
73159         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73160         select_default2(this).call(svgIcon(iconName, "issue-icon"));
73161       });
73162       textEnter.append("span").attr("class", "issue-message");
73163       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
73164       infoButton.on("click", function(d3_event) {
73165         d3_event.stopPropagation();
73166         d3_event.preventDefault();
73167         this.blur();
73168         var container = select_default2(this.parentNode.parentNode.parentNode);
73169         var info = container.selectAll(".issue-info");
73170         var isExpanded = info.classed("expanded");
73171         _expanded = !isExpanded;
73172         corePreferences("entity-issues.reference.expanded", _expanded);
73173         if (isExpanded) {
73174           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
73175             info.classed("expanded", false);
73176           });
73177         } else {
73178           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
73179             info.style("max-height", null);
73180           });
73181         }
73182       });
73183       itemsEnter.append("ul").attr("class", "issue-fix-list");
73184       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
73185         if (typeof d2.reference === "function") {
73186           select_default2(this).call(d2.reference);
73187         } else {
73188           select_default2(this).call(_t.append("inspector.no_documentation_key"));
73189         }
73190       });
73191       containers = containers.merge(containersEnter).classed("active", function(d2) {
73192         return d2.id === _activeIssueID;
73193       });
73194       containers.selectAll(".issue-message").text("").each(function(d2) {
73195         return d2.message(context)(select_default2(this));
73196       });
73197       var fixLists = containers.selectAll(".issue-fix-list");
73198       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
73199         return d2.fixes ? d2.fixes(context) : [];
73200       }, function(fix) {
73201         return fix.id;
73202       });
73203       fixes.exit().remove();
73204       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
73205       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
73206         if (select_default2(this).attr("disabled") || !d2.onClick) return;
73207         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3) return;
73208         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
73209         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
73210         new Promise(function(resolve, reject) {
73211           d2.onClick(context, resolve, reject);
73212           if (d2.onClick.length <= 1) {
73213             resolve();
73214           }
73215         }).then(function() {
73216           context.validator().validate();
73217         });
73218       }).on("mouseover.highlight", function(d3_event, d2) {
73219         utilHighlightEntities(d2.entityIds, true, context);
73220       }).on("mouseout.highlight", function(d3_event, d2) {
73221         utilHighlightEntities(d2.entityIds, false, context);
73222       });
73223       buttons.each(function(d2) {
73224         var iconName = d2.icon || "iD-icon-wrench";
73225         if (iconName.startsWith("maki")) {
73226           iconName += "-15";
73227         }
73228         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
73229       });
73230       buttons.append("span").attr("class", "fix-message").each(function(d2) {
73231         return d2.title(select_default2(this));
73232       });
73233       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
73234         return d2.onClick;
73235       }).attr("disabled", function(d2) {
73236         return d2.onClick ? null : "true";
73237       }).attr("title", function(d2) {
73238         if (d2.disabledReason) {
73239           return d2.disabledReason;
73240         }
73241         return null;
73242       });
73243     }
73244     section.entityIDs = function(val) {
73245       if (!arguments.length) return _entityIDs;
73246       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
73247         _entityIDs = val;
73248         _activeIssueID = null;
73249         reloadIssues();
73250       }
73251       return section;
73252     };
73253     return section;
73254   }
73255   var init_entity_issues = __esm({
73256     "modules/ui/sections/entity_issues.js"() {
73257       "use strict";
73258       init_src5();
73259       init_preferences();
73260       init_icon();
73261       init_array3();
73262       init_localizer();
73263       init_util();
73264       init_section();
73265     }
73266   });
73267
73268   // modules/ui/preset_icon.js
73269   var preset_icon_exports = {};
73270   __export(preset_icon_exports, {
73271     uiPresetIcon: () => uiPresetIcon
73272   });
73273   function uiPresetIcon() {
73274     let _preset;
73275     let _geometry;
73276     function presetIcon(selection2) {
73277       selection2.each(render);
73278     }
73279     function getIcon(p2, geom) {
73280       if (p2.isFallback && p2.isFallback()) return geom === "vertex" ? "" : "iD-icon-" + p2.id;
73281       if (p2.icon) return p2.icon;
73282       if (geom === "line") return "iD-other-line";
73283       if (geom === "vertex") return "temaki-vertex";
73284       return "maki-marker-stroked";
73285     }
73286     function renderPointBorder(container, drawPoint) {
73287       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
73288       pointBorder.exit().remove();
73289       let pointBorderEnter = pointBorder.enter();
73290       const w3 = 40;
73291       const h3 = 40;
73292       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");
73293       pointBorder = pointBorderEnter.merge(pointBorder);
73294     }
73295     function renderCategoryBorder(container, category) {
73296       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
73297       categoryBorder.exit().remove();
73298       let categoryBorderEnter = categoryBorder.enter();
73299       const d2 = 60;
73300       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}`);
73301       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");
73302       categoryBorder = categoryBorderEnter.merge(categoryBorder);
73303       if (category) {
73304         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
73305       }
73306     }
73307     function renderCircleFill(container, drawVertex) {
73308       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
73309       vertexFill.exit().remove();
73310       let vertexFillEnter = vertexFill.enter();
73311       const w3 = 60;
73312       const h3 = 60;
73313       const d2 = 40;
73314       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);
73315       vertexFill = vertexFillEnter.merge(vertexFill);
73316     }
73317     function renderSquareFill(container, drawArea, tagClasses) {
73318       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
73319       fill.exit().remove();
73320       let fillEnter = fill.enter();
73321       const d2 = 60;
73322       const w3 = d2;
73323       const h3 = d2;
73324       const l2 = d2 * 2 / 3;
73325       const c1 = (w3 - l2) / 2;
73326       const c2 = c1 + l2;
73327       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}`);
73328       ["fill", "stroke"].forEach((klass) => {
73329         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
73330       });
73331       const rVertex = 2.5;
73332       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
73333         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
73334       });
73335       const rMidpoint = 1.25;
73336       [[c1, w3 / 2], [c2, w3 / 2], [h3 / 2, c1], [h3 / 2, c2]].forEach((point) => {
73337         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
73338       });
73339       fill = fillEnter.merge(fill);
73340       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
73341       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
73342     }
73343     function renderLine(container, drawLine, tagClasses) {
73344       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
73345       line.exit().remove();
73346       let lineEnter = line.enter();
73347       const d2 = 60;
73348       const w3 = d2;
73349       const h3 = d2;
73350       const y2 = Math.round(d2 * 0.72);
73351       const l2 = Math.round(d2 * 0.6);
73352       const r2 = 2.5;
73353       const x12 = (w3 - l2) / 2;
73354       const x2 = x12 + l2;
73355       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73356       ["casing", "stroke"].forEach((klass) => {
73357         lineEnter.append("path").attr("d", `M${x12} ${y2} L${x2} ${y2}`).attr("class", `line ${klass}`);
73358       });
73359       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point) => {
73360         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
73361       });
73362       line = lineEnter.merge(line);
73363       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
73364       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
73365     }
73366     function renderRoute(container, drawRoute, p2) {
73367       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
73368       route.exit().remove();
73369       let routeEnter = route.enter();
73370       const d2 = 60;
73371       const w3 = d2;
73372       const h3 = d2;
73373       const y12 = Math.round(d2 * 0.8);
73374       const y2 = Math.round(d2 * 0.68);
73375       const l2 = Math.round(d2 * 0.6);
73376       const r2 = 2;
73377       const x12 = (w3 - l2) / 2;
73378       const x2 = x12 + l2 / 3;
73379       const x3 = x2 + l2 / 3;
73380       const x4 = x3 + l2 / 3;
73381       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73382       ["casing", "stroke"].forEach((klass) => {
73383         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
73384         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
73385         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
73386       });
73387       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
73388         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
73389       });
73390       route = routeEnter.merge(route);
73391       if (drawRoute) {
73392         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
73393         const segmentPresetIDs = routeSegments[routeType];
73394         for (let i3 in segmentPresetIDs) {
73395           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
73396           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
73397           route.selectAll(`path.stroke.segment${i3}`).attr("class", `segment${i3} line stroke ${segmentTagClasses}`);
73398           route.selectAll(`path.casing.segment${i3}`).attr("class", `segment${i3} line casing ${segmentTagClasses}`);
73399         }
73400       }
73401     }
73402     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
73403       const isMaki = picon && /^maki-/.test(picon);
73404       const isTemaki = picon && /^temaki-/.test(picon);
73405       const isFa = picon && /^fa[srb]-/.test(picon);
73406       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
73407       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
73408       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
73409       icon2.exit().remove();
73410       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
73411       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
73412       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
73413       icon2.selectAll("use").attr("href", "#" + picon);
73414     }
73415     function renderImageIcon(container, imageURL) {
73416       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
73417       imageIcon.exit().remove();
73418       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);
73419       imageIcon.attr("src", imageURL);
73420     }
73421     const routeSegments = {
73422       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
73423       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
73424       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
73425       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
73426       ferry: ["route/ferry", "route/ferry", "route/ferry"],
73427       foot: ["highway/footway", "highway/footway", "highway/footway"],
73428       hiking: ["highway/path", "highway/path", "highway/path"],
73429       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
73430       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
73431       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
73432       mtb: ["highway/path", "highway/track", "highway/bridleway"],
73433       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
73434       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
73435       power: ["power/line", "power/line", "power/line"],
73436       road: ["highway/secondary", "highway/primary", "highway/trunk"],
73437       subway: ["railway/subway", "railway/subway", "railway/subway"],
73438       train: ["railway/rail", "railway/rail", "railway/rail"],
73439       tram: ["railway/tram", "railway/tram", "railway/tram"],
73440       railway: ["railway/rail", "railway/rail", "railway/rail"],
73441       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
73442     };
73443     function render() {
73444       let p2 = _preset.apply(this, arguments);
73445       let geom = _geometry ? _geometry.apply(this, arguments) : null;
73446       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
73447         geom = "route";
73448       }
73449       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
73450       const isFallback = p2.isFallback && p2.isFallback();
73451       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
73452       const picon = getIcon(p2, geom);
73453       const isCategory = !p2.setTags;
73454       const drawPoint = false;
73455       const drawVertex = picon !== null && geom === "vertex";
73456       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
73457       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
73458       const drawRoute = picon && geom === "route";
73459       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
73460       let tags = !isCategory ? p2.setTags({}, geom) : {};
73461       for (let k3 in tags) {
73462         if (tags[k3] === "*") {
73463           tags[k3] = "yes";
73464         }
73465       }
73466       let tagClasses = svgTagClasses().getClassesString(tags, "");
73467       let selection2 = select_default2(this);
73468       let container = selection2.selectAll(".preset-icon-container").data([0]);
73469       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
73470       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
73471       renderCategoryBorder(container, isCategory && p2);
73472       renderPointBorder(container, drawPoint);
73473       renderCircleFill(container, drawVertex);
73474       renderSquareFill(container, drawArea, tagClasses);
73475       renderLine(container, drawLine, tagClasses);
73476       renderRoute(container, drawRoute, p2);
73477       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
73478       renderImageIcon(container, imageURL);
73479     }
73480     presetIcon.preset = function(val) {
73481       if (!arguments.length) return _preset;
73482       _preset = utilFunctor(val);
73483       return presetIcon;
73484     };
73485     presetIcon.geometry = function(val) {
73486       if (!arguments.length) return _geometry;
73487       _geometry = utilFunctor(val);
73488       return presetIcon;
73489     };
73490     return presetIcon;
73491   }
73492   var init_preset_icon = __esm({
73493     "modules/ui/preset_icon.js"() {
73494       "use strict";
73495       init_src5();
73496       init_presets();
73497       init_preferences();
73498       init_svg();
73499       init_util();
73500     }
73501   });
73502
73503   // modules/ui/sections/feature_type.js
73504   var feature_type_exports = {};
73505   __export(feature_type_exports, {
73506     uiSectionFeatureType: () => uiSectionFeatureType
73507   });
73508   function uiSectionFeatureType(context) {
73509     var dispatch14 = dispatch_default("choose");
73510     var _entityIDs = [];
73511     var _presets = [];
73512     var _tagReference;
73513     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
73514     function renderDisclosureContent(selection2) {
73515       selection2.classed("preset-list-item", true);
73516       selection2.classed("mixed-types", _presets.length > 1);
73517       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
73518       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
73519         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
73520       );
73521       presetButton.append("div").attr("class", "preset-icon-container");
73522       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
73523       presetButtonWrap.append("div").attr("class", "accessory-buttons");
73524       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
73525       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
73526       if (_tagReference) {
73527         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
73528         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
73529       }
73530       selection2.selectAll(".preset-reset").on("click", function() {
73531         dispatch14.call("choose", this, _presets);
73532       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
73533         d3_event.preventDefault();
73534         d3_event.stopPropagation();
73535       });
73536       var geometries = entityGeometries();
73537       selection2.select(".preset-list-item button").call(
73538         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
73539       );
73540       var names = _presets.length === 1 ? [
73541         _presets[0].nameLabel(),
73542         _presets[0].subtitleLabel()
73543       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
73544       var label = selection2.select(".label-inner");
73545       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
73546       nameparts.exit().remove();
73547       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
73548         d2(select_default2(this));
73549       });
73550     }
73551     section.entityIDs = function(val) {
73552       if (!arguments.length) return _entityIDs;
73553       _entityIDs = val;
73554       return section;
73555     };
73556     section.presets = function(val) {
73557       if (!arguments.length) return _presets;
73558       if (!utilArrayIdentical(val, _presets)) {
73559         _presets = val;
73560         if (_presets.length === 1) {
73561           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
73562         }
73563       }
73564       return section;
73565     };
73566     function entityGeometries() {
73567       var counts = {};
73568       for (var i3 in _entityIDs) {
73569         var geometry = context.graph().geometry(_entityIDs[i3]);
73570         if (!counts[geometry]) counts[geometry] = 0;
73571         counts[geometry] += 1;
73572       }
73573       return Object.keys(counts).sort(function(geom1, geom2) {
73574         return counts[geom2] - counts[geom1];
73575       });
73576     }
73577     return utilRebind(section, dispatch14, "on");
73578   }
73579   var init_feature_type = __esm({
73580     "modules/ui/sections/feature_type.js"() {
73581       "use strict";
73582       init_src4();
73583       init_src5();
73584       init_presets();
73585       init_array3();
73586       init_localizer();
73587       init_tooltip();
73588       init_util();
73589       init_preset_icon();
73590       init_section();
73591       init_tag_reference();
73592     }
73593   });
73594
73595   // modules/ui/form_fields.js
73596   var form_fields_exports = {};
73597   __export(form_fields_exports, {
73598     uiFormFields: () => uiFormFields
73599   });
73600   function uiFormFields(context) {
73601     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
73602     var _fieldsArr = [];
73603     var _lastPlaceholder = "";
73604     var _state = "";
73605     var _klass = "";
73606     function formFields(selection2) {
73607       var allowedFields = _fieldsArr.filter(function(field) {
73608         return field.isAllowed();
73609       });
73610       var shown = allowedFields.filter(function(field) {
73611         return field.isShown();
73612       });
73613       var notShown = allowedFields.filter(function(field) {
73614         return !field.isShown();
73615       }).sort(function(a4, b3) {
73616         return a4.universal === b3.universal ? 0 : a4.universal ? 1 : -1;
73617       });
73618       var container = selection2.selectAll(".form-fields-container").data([0]);
73619       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
73620       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
73621         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
73622       });
73623       fields.exit().remove();
73624       var enter = fields.enter().append("div").attr("class", function(d2) {
73625         return "wrap-form-field wrap-form-field-" + d2.safeid;
73626       });
73627       fields = fields.merge(enter);
73628       fields.order().each(function(d2) {
73629         select_default2(this).call(d2.render);
73630       });
73631       var titles = [];
73632       var moreFields = notShown.map(function(field) {
73633         var title = field.title();
73634         titles.push(title);
73635         var terms = field.terms();
73636         if (field.key) terms.push(field.key);
73637         if (field.keys) terms = terms.concat(field.keys);
73638         return {
73639           display: field.label(),
73640           value: title,
73641           title,
73642           field,
73643           terms
73644         };
73645       });
73646       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
73647       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
73648       more.exit().remove();
73649       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
73650       moreEnter.append("span").call(_t.append("inspector.add_fields"));
73651       more = moreEnter.merge(more);
73652       var input = more.selectAll(".value").data([0]);
73653       input.exit().remove();
73654       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
73655       input.call(utilGetSetValue, "").call(
73656         moreCombo.data(moreFields).on("accept", function(d2) {
73657           if (!d2) return;
73658           var field = d2.field;
73659           field.show();
73660           selection2.call(formFields);
73661           field.focus();
73662         })
73663       );
73664       if (_lastPlaceholder !== placeholder) {
73665         input.attr("placeholder", placeholder);
73666         _lastPlaceholder = placeholder;
73667       }
73668     }
73669     formFields.fieldsArr = function(val) {
73670       if (!arguments.length) return _fieldsArr;
73671       _fieldsArr = val || [];
73672       return formFields;
73673     };
73674     formFields.state = function(val) {
73675       if (!arguments.length) return _state;
73676       _state = val;
73677       return formFields;
73678     };
73679     formFields.klass = function(val) {
73680       if (!arguments.length) return _klass;
73681       _klass = val;
73682       return formFields;
73683     };
73684     return formFields;
73685   }
73686   var init_form_fields = __esm({
73687     "modules/ui/form_fields.js"() {
73688       "use strict";
73689       init_src5();
73690       init_localizer();
73691       init_combobox();
73692       init_util();
73693     }
73694   });
73695
73696   // modules/ui/sections/preset_fields.js
73697   var preset_fields_exports = {};
73698   __export(preset_fields_exports, {
73699     uiSectionPresetFields: () => uiSectionPresetFields
73700   });
73701   function uiSectionPresetFields(context) {
73702     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
73703     var dispatch14 = dispatch_default("change", "revert");
73704     var formFields = uiFormFields(context);
73705     var _state;
73706     var _fieldsArr;
73707     var _presets = [];
73708     var _tags;
73709     var _entityIDs;
73710     function renderDisclosureContent(selection2) {
73711       if (!_fieldsArr) {
73712         var graph = context.graph();
73713         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
73714           geoms[graph.entity(entityID).geometry(graph)] = true;
73715           return geoms;
73716         }, {}));
73717         const loc = _entityIDs.reduce(function(extent, entityID) {
73718           var entity = context.graph().entity(entityID);
73719           return extent.extend(entity.extent(context.graph()));
73720         }, geoExtent()).center();
73721         var presetsManager = _mainPresetIndex;
73722         var allFields = [];
73723         var allMoreFields = [];
73724         var sharedTotalFields;
73725         _presets.forEach(function(preset) {
73726           var fields = preset.fields(loc);
73727           var moreFields = preset.moreFields(loc);
73728           allFields = utilArrayUnion(allFields, fields);
73729           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
73730           if (!sharedTotalFields) {
73731             sharedTotalFields = utilArrayUnion(fields, moreFields);
73732           } else {
73733             sharedTotalFields = sharedTotalFields.filter(function(field) {
73734               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
73735             });
73736           }
73737         });
73738         var sharedFields = allFields.filter(function(field) {
73739           return sharedTotalFields.indexOf(field) !== -1;
73740         });
73741         var sharedMoreFields = allMoreFields.filter(function(field) {
73742           return sharedTotalFields.indexOf(field) !== -1;
73743         });
73744         _fieldsArr = [];
73745         sharedFields.forEach(function(field) {
73746           if (field.matchAllGeometry(geometries)) {
73747             _fieldsArr.push(
73748               uiField(context, field, _entityIDs)
73749             );
73750           }
73751         });
73752         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
73753         if (singularEntity && singularEntity.type === "node" && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
73754           _fieldsArr.push(
73755             uiField(context, presetsManager.field("restrictions"), _entityIDs)
73756           );
73757         }
73758         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
73759         additionalFields.sort(function(field1, field2) {
73760           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
73761         });
73762         additionalFields.forEach(function(field) {
73763           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
73764             _fieldsArr.push(
73765               uiField(context, field, _entityIDs, { show: false })
73766             );
73767           }
73768         });
73769         _fieldsArr.forEach(function(field) {
73770           field.on("change", function(t2, onInput) {
73771             dispatch14.call("change", field, _entityIDs, t2, onInput);
73772           }).on("revert", function(keys2) {
73773             dispatch14.call("revert", field, keys2);
73774           });
73775         });
73776       }
73777       _fieldsArr.forEach(function(field) {
73778         field.state(_state).tags(_tags);
73779       });
73780       selection2.call(
73781         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
73782       );
73783     }
73784     section.presets = function(val) {
73785       if (!arguments.length) return _presets;
73786       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
73787         _presets = val;
73788         _fieldsArr = null;
73789       }
73790       return section;
73791     };
73792     section.state = function(val) {
73793       if (!arguments.length) return _state;
73794       _state = val;
73795       return section;
73796     };
73797     section.tags = function(val) {
73798       if (!arguments.length) return _tags;
73799       _tags = val;
73800       return section;
73801     };
73802     section.entityIDs = function(val) {
73803       if (!arguments.length) return _entityIDs;
73804       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
73805         _entityIDs = val;
73806         _fieldsArr = null;
73807       }
73808       return section;
73809     };
73810     return utilRebind(section, dispatch14, "on");
73811   }
73812   var init_preset_fields = __esm({
73813     "modules/ui/sections/preset_fields.js"() {
73814       "use strict";
73815       init_src4();
73816       init_presets();
73817       init_localizer();
73818       init_array3();
73819       init_util();
73820       init_extent();
73821       init_field2();
73822       init_form_fields();
73823       init_section();
73824     }
73825   });
73826
73827   // modules/ui/sections/raw_member_editor.js
73828   var raw_member_editor_exports = {};
73829   __export(raw_member_editor_exports, {
73830     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor
73831   });
73832   function uiSectionRawMemberEditor(context) {
73833     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
73834       if (!_entityIDs || _entityIDs.length !== 1) return false;
73835       var entity = context.hasEntity(_entityIDs[0]);
73836       return entity && entity.type === "relation";
73837     }).label(function() {
73838       var entity = context.hasEntity(_entityIDs[0]);
73839       if (!entity) return "";
73840       var gt2 = entity.members.length > _maxMembers ? ">" : "";
73841       var count = gt2 + entity.members.slice(0, _maxMembers).length;
73842       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
73843     }).disclosureContent(renderDisclosureContent);
73844     var taginfo = services.taginfo;
73845     var _entityIDs;
73846     var _maxMembers = 1e3;
73847     function downloadMember(d3_event, d2) {
73848       d3_event.preventDefault();
73849       select_default2(this).classed("loading", true);
73850       context.loadEntity(d2.id, function() {
73851         section.reRender();
73852       });
73853     }
73854     function zoomToMember(d3_event, d2) {
73855       d3_event.preventDefault();
73856       var entity = context.entity(d2.id);
73857       context.map().zoomToEase(entity);
73858       utilHighlightEntities([d2.id], true, context);
73859     }
73860     function selectMember(d3_event, d2) {
73861       d3_event.preventDefault();
73862       utilHighlightEntities([d2.id], false, context);
73863       var entity = context.entity(d2.id);
73864       var mapExtent = context.map().extent();
73865       if (!entity.intersects(mapExtent, context.graph())) {
73866         context.map().zoomToEase(entity);
73867       }
73868       context.enter(modeSelect(context, [d2.id]));
73869     }
73870     function changeRole(d3_event, d2) {
73871       var oldRole = d2.role;
73872       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
73873       if (oldRole !== newRole) {
73874         var member = { id: d2.id, type: d2.type, role: newRole };
73875         context.perform(
73876           actionChangeMember(d2.relation.id, member, d2.index),
73877           _t("operations.change_role.annotation", {
73878             n: 1
73879           })
73880         );
73881         context.validator().validate();
73882       }
73883     }
73884     function deleteMember(d3_event, d2) {
73885       utilHighlightEntities([d2.id], false, context);
73886       context.perform(
73887         actionDeleteMember(d2.relation.id, d2.index),
73888         _t("operations.delete_member.annotation", {
73889           n: 1
73890         })
73891       );
73892       if (!context.hasEntity(d2.relation.id)) {
73893         context.enter(modeBrowse(context));
73894       } else {
73895         context.validator().validate();
73896       }
73897     }
73898     function renderDisclosureContent(selection2) {
73899       var entityID = _entityIDs[0];
73900       var memberships = [];
73901       var entity = context.entity(entityID);
73902       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
73903         memberships.push({
73904           index,
73905           id: member.id,
73906           type: member.type,
73907           role: member.role,
73908           relation: entity,
73909           member: context.hasEntity(member.id),
73910           domId: utilUniqueDomId(entityID + "-member-" + index)
73911         });
73912       });
73913       var list = selection2.selectAll(".member-list").data([0]);
73914       list = list.enter().append("ul").attr("class", "member-list").merge(list);
73915       var items = list.selectAll("li").data(memberships, function(d2) {
73916         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
73917       });
73918       items.exit().each(unbind).remove();
73919       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
73920         return !d2.member;
73921       });
73922       itemsEnter.each(function(d2) {
73923         var item = select_default2(this);
73924         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
73925         if (d2.member) {
73926           item.on("mouseover", function() {
73927             utilHighlightEntities([d2.id], true, context);
73928           }).on("mouseout", function() {
73929             utilHighlightEntities([d2.id], false, context);
73930           });
73931           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
73932           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
73933             var matched = _mainPresetIndex.match(d4.member, context.graph());
73934             return matched && matched.name() || utilDisplayType(d4.member.id);
73935           });
73936           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) {
73937             return utilDisplayName(d4.member);
73938           });
73939           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
73940           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
73941         } else {
73942           var labelText = label.append("span").attr("class", "label-text");
73943           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
73944           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
73945           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
73946         }
73947       });
73948       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
73949       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
73950         return d2.domId;
73951       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
73952       if (taginfo) {
73953         wrapEnter.each(bindTypeahead);
73954       }
73955       items = items.merge(itemsEnter).order();
73956       items.select("input.member-role").property("value", function(d2) {
73957         return d2.role;
73958       }).on("blur", changeRole).on("change", changeRole);
73959       items.select("button.member-delete").on("click", deleteMember);
73960       var dragOrigin, targetIndex;
73961       items.call(
73962         drag_default().on("start", function(d3_event) {
73963           dragOrigin = {
73964             x: d3_event.x,
73965             y: d3_event.y
73966           };
73967           targetIndex = null;
73968         }).on("drag", function(d3_event) {
73969           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
73970           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
73971           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
73972           var index = items.nodes().indexOf(this);
73973           select_default2(this).classed("dragging", true);
73974           targetIndex = null;
73975           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
73976             var node = select_default2(this).node();
73977             if (index === index2) {
73978               return "translate(" + x2 + "px, " + y2 + "px)";
73979             } else if (index2 > index && d3_event.y > node.offsetTop) {
73980               if (targetIndex === null || index2 > targetIndex) {
73981                 targetIndex = index2;
73982               }
73983               return "translateY(-100%)";
73984             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
73985               if (targetIndex === null || index2 < targetIndex) {
73986                 targetIndex = index2;
73987               }
73988               return "translateY(100%)";
73989             }
73990             return null;
73991           });
73992         }).on("end", function(d3_event, d2) {
73993           if (!select_default2(this).classed("dragging")) return;
73994           var index = items.nodes().indexOf(this);
73995           select_default2(this).classed("dragging", false);
73996           selection2.selectAll("li.member-row").style("transform", null);
73997           if (targetIndex !== null) {
73998             context.perform(
73999               actionMoveMember(d2.relation.id, index, targetIndex),
74000               _t("operations.reorder_members.annotation")
74001             );
74002             context.validator().validate();
74003           }
74004         })
74005       );
74006       function bindTypeahead(d2) {
74007         var row = select_default2(this);
74008         var role = row.selectAll("input.member-role");
74009         var origValue = role.property("value");
74010         function sort(value, data) {
74011           var sameletter = [];
74012           var other = [];
74013           for (var i3 = 0; i3 < data.length; i3++) {
74014             if (data[i3].value.substring(0, value.length) === value) {
74015               sameletter.push(data[i3]);
74016             } else {
74017               other.push(data[i3]);
74018             }
74019           }
74020           return sameletter.concat(other);
74021         }
74022         role.call(
74023           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
74024             var geometry;
74025             if (d2.member) {
74026               geometry = context.graph().geometry(d2.member.id);
74027             } else if (d2.type === "relation") {
74028               geometry = "relation";
74029             } else if (d2.type === "way") {
74030               geometry = "line";
74031             } else {
74032               geometry = "point";
74033             }
74034             var rtype = entity.tags.type;
74035             taginfo.roles({
74036               debounce: true,
74037               rtype: rtype || "",
74038               geometry,
74039               query: role2
74040             }, function(err, data) {
74041               if (!err) callback(sort(role2, data));
74042             });
74043           }).on("cancel", function() {
74044             role.property("value", origValue);
74045           })
74046         );
74047       }
74048       function unbind() {
74049         var row = select_default2(this);
74050         row.selectAll("input.member-role").call(uiCombobox.off, context);
74051       }
74052     }
74053     section.entityIDs = function(val) {
74054       if (!arguments.length) return _entityIDs;
74055       _entityIDs = val;
74056       return section;
74057     };
74058     return section;
74059   }
74060   var init_raw_member_editor = __esm({
74061     "modules/ui/sections/raw_member_editor.js"() {
74062       "use strict";
74063       init_src6();
74064       init_src5();
74065       init_presets();
74066       init_localizer();
74067       init_change_member();
74068       init_delete_member();
74069       init_move_member();
74070       init_browse();
74071       init_select5();
74072       init_osm();
74073       init_tags();
74074       init_icon();
74075       init_services();
74076       init_combobox();
74077       init_section();
74078       init_util();
74079     }
74080   });
74081
74082   // modules/ui/sections/raw_membership_editor.js
74083   var raw_membership_editor_exports = {};
74084   __export(raw_membership_editor_exports, {
74085     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor
74086   });
74087   function uiSectionRawMembershipEditor(context) {
74088     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
74089       return _entityIDs && _entityIDs.length;
74090     }).label(function() {
74091       var parents = getSharedParentRelations();
74092       var gt2 = parents.length > _maxMemberships ? ">" : "";
74093       var count = gt2 + parents.slice(0, _maxMemberships).length;
74094       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
74095     }).disclosureContent(renderDisclosureContent);
74096     var taginfo = services.taginfo;
74097     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
74098       if (d2.relation) utilHighlightEntities([d2.relation.id], true, context);
74099     }).itemsMouseLeave(function(d3_event, d2) {
74100       if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
74101     });
74102     var _inChange = false;
74103     var _entityIDs = [];
74104     var _showBlank;
74105     var _maxMemberships = 1e3;
74106     const recentlyAdded = /* @__PURE__ */ new Set();
74107     function getSharedParentRelations() {
74108       var parents = [];
74109       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
74110         var entity = context.graph().hasEntity(_entityIDs[i3]);
74111         if (!entity) continue;
74112         if (i3 === 0) {
74113           parents = context.graph().parentRelations(entity);
74114         } else {
74115           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
74116         }
74117         if (!parents.length) break;
74118       }
74119       return parents;
74120     }
74121     function getMemberships() {
74122       var memberships = [];
74123       var relations = getSharedParentRelations().slice(0, _maxMemberships);
74124       var isMultiselect = _entityIDs.length > 1;
74125       var i3, relation, membership, index, member, indexedMember;
74126       for (i3 = 0; i3 < relations.length; i3++) {
74127         relation = relations[i3];
74128         membership = {
74129           relation,
74130           members: [],
74131           hash: osmEntity.key(relation)
74132         };
74133         for (index = 0; index < relation.members.length; index++) {
74134           member = relation.members[index];
74135           if (_entityIDs.indexOf(member.id) !== -1) {
74136             indexedMember = Object.assign({}, member, { index });
74137             membership.members.push(indexedMember);
74138             membership.hash += "," + index.toString();
74139             if (!isMultiselect) {
74140               memberships.push(membership);
74141               membership = {
74142                 relation,
74143                 members: [],
74144                 hash: osmEntity.key(relation)
74145               };
74146             }
74147           }
74148         }
74149         if (membership.members.length) memberships.push(membership);
74150       }
74151       memberships.forEach(function(membership2) {
74152         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
74153         var roles = [];
74154         membership2.members.forEach(function(member2) {
74155           if (roles.indexOf(member2.role) === -1) roles.push(member2.role);
74156         });
74157         membership2.role = roles.length === 1 ? roles[0] : roles;
74158       });
74159       const existingRelations = memberships.filter((membership2) => !recentlyAdded.has(membership2.relation.id)).map((membership2) => ({
74160         ...membership2,
74161         // We only sort relations that were not added just now.
74162         // Sorting uses the same label as shown in the UI.
74163         // If the label is not unique, the relation ID ensures
74164         // that the sort order is still stable.
74165         _sortKey: [
74166           baseDisplayValue(membership2.relation),
74167           membership2.relation.id
74168         ].join("-")
74169       })).sort((a4, b3) => {
74170         return a4._sortKey.localeCompare(
74171           b3._sortKey,
74172           _mainLocalizer.localeCodes(),
74173           { numeric: true }
74174         );
74175       });
74176       const newlyAddedRelations = memberships.filter((membership2) => recentlyAdded.has(membership2.relation.id));
74177       return [
74178         // the sorted relations come first
74179         ...existingRelations,
74180         // then the ones that were just added from this panel
74181         ...newlyAddedRelations
74182       ];
74183     }
74184     function selectRelation(d3_event, d2) {
74185       d3_event.preventDefault();
74186       utilHighlightEntities([d2.relation.id], false, context);
74187       context.enter(modeSelect(context, [d2.relation.id]));
74188     }
74189     function zoomToRelation(d3_event, d2) {
74190       d3_event.preventDefault();
74191       var entity = context.entity(d2.relation.id);
74192       context.map().zoomToEase(entity);
74193       utilHighlightEntities([d2.relation.id], true, context);
74194     }
74195     function changeRole(d3_event, d2) {
74196       if (d2 === 0) return;
74197       if (_inChange) return;
74198       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
74199       if (!newRole.trim() && typeof d2.role !== "string") return;
74200       var membersToUpdate = d2.members.filter(function(member) {
74201         return member.role !== newRole;
74202       });
74203       if (membersToUpdate.length) {
74204         _inChange = true;
74205         context.perform(
74206           function actionChangeMemberRoles(graph) {
74207             membersToUpdate.forEach(function(member) {
74208               var newMember = Object.assign({}, member, { role: newRole });
74209               delete newMember.index;
74210               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
74211             });
74212             return graph;
74213           },
74214           _t("operations.change_role.annotation", {
74215             n: membersToUpdate.length
74216           })
74217         );
74218         context.validator().validate();
74219       }
74220       _inChange = false;
74221     }
74222     function addMembership(d2, role) {
74223       _showBlank = false;
74224       function actionAddMembers(relationId, ids, role2) {
74225         return function(graph) {
74226           for (var i3 in ids) {
74227             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
74228             graph = actionAddMember(relationId, member)(graph);
74229           }
74230           return graph;
74231         };
74232       }
74233       if (d2.relation) {
74234         recentlyAdded.add(d2.relation.id);
74235         context.perform(
74236           actionAddMembers(d2.relation.id, _entityIDs, role),
74237           _t("operations.add_member.annotation", {
74238             n: _entityIDs.length
74239           })
74240         );
74241         context.validator().validate();
74242       } else {
74243         var relation = osmRelation();
74244         context.perform(
74245           actionAddEntity(relation),
74246           actionAddMembers(relation.id, _entityIDs, role),
74247           _t("operations.add.annotation.relation")
74248         );
74249         context.enter(modeSelect(context, [relation.id]).newFeature(true));
74250       }
74251     }
74252     function downloadMembers(d3_event, d2) {
74253       d3_event.preventDefault();
74254       const button = select_default2(this);
74255       button.classed("loading", true);
74256       context.loadEntity(d2.relation.id, function() {
74257         section.reRender();
74258       });
74259     }
74260     function deleteMembership(d3_event, d2) {
74261       this.blur();
74262       if (d2 === 0) return;
74263       utilHighlightEntities([d2.relation.id], false, context);
74264       var indexes = d2.members.map(function(member) {
74265         return member.index;
74266       });
74267       context.perform(
74268         actionDeleteMembers(d2.relation.id, indexes),
74269         _t("operations.delete_member.annotation", {
74270           n: _entityIDs.length
74271         })
74272       );
74273       context.validator().validate();
74274     }
74275     function fetchNearbyRelations(q3, callback) {
74276       var newRelation = {
74277         relation: null,
74278         value: _t("inspector.new_relation"),
74279         display: _t.append("inspector.new_relation")
74280       };
74281       var entityID = _entityIDs[0];
74282       var result = [];
74283       var graph = context.graph();
74284       function baseDisplayLabel(entity) {
74285         var matched = _mainPresetIndex.match(entity, graph);
74286         var presetName = matched && matched.name() || _t("inspector.relation");
74287         var entityName = utilDisplayName(entity) || "";
74288         return (selection2) => {
74289           selection2.append("b").text(presetName + " ");
74290           selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
74291         };
74292       }
74293       var explicitRelation = q3 && context.hasEntity(q3.toLowerCase());
74294       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
74295         result.push({
74296           relation: explicitRelation,
74297           value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
74298           display: baseDisplayLabel(explicitRelation)
74299         });
74300       } else {
74301         context.history().intersects(context.map().extent()).forEach(function(entity) {
74302           if (entity.type !== "relation" || entity.id === entityID) return;
74303           var value = baseDisplayValue(entity);
74304           if (q3 && (value + " " + entity.id).toLowerCase().indexOf(q3.toLowerCase()) === -1) return;
74305           result.push({
74306             relation: entity,
74307             value,
74308             display: baseDisplayLabel(entity)
74309           });
74310         });
74311         result.sort(function(a4, b3) {
74312           return osmRelation.creationOrder(a4.relation, b3.relation);
74313         });
74314         Object.values(utilArrayGroupBy(result, "value")).filter((v3) => v3.length > 1).flat().forEach((obj) => obj.value += " " + obj.relation.id);
74315       }
74316       result.forEach(function(obj) {
74317         obj.title = obj.value;
74318       });
74319       result.unshift(newRelation);
74320       callback(result);
74321     }
74322     function baseDisplayValue(entity) {
74323       const graph = context.graph();
74324       var matched = _mainPresetIndex.match(entity, graph);
74325       var presetName = matched && matched.name() || _t("inspector.relation");
74326       var entityName = utilDisplayName(entity) || "";
74327       return presetName + " " + entityName;
74328     }
74329     function renderDisclosureContent(selection2) {
74330       var memberships = getMemberships();
74331       var list = selection2.selectAll(".member-list").data([0]);
74332       list = list.enter().append("ul").attr("class", "member-list").merge(list);
74333       var items = list.selectAll("li.member-row-normal").data(memberships, function(d2) {
74334         return d2.hash;
74335       });
74336       items.exit().each(unbind).remove();
74337       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
74338       itemsEnter.on("mouseover", function(d3_event, d2) {
74339         utilHighlightEntities([d2.relation.id], true, context);
74340       }).on("mouseout", function(d3_event, d2) {
74341         utilHighlightEntities([d2.relation.id], false, context);
74342       });
74343       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
74344         return d2.domId;
74345       });
74346       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
74347       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
74348         var matched = _mainPresetIndex.match(d2.relation, context.graph());
74349         return matched && matched.name() || _t.html("inspector.relation");
74350       });
74351       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) {
74352         const matched = _mainPresetIndex.match(d2.relation, context.graph());
74353         return utilDisplayName(d2.relation, matched.suggestion);
74354       });
74355       labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
74356       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
74357       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
74358       items = items.merge(itemsEnter);
74359       items.selectAll("button.members-download").classed("hide", (d2) => {
74360         const graph = context.graph();
74361         return d2.relation.members.every((m3) => graph.hasEntity(m3.id));
74362       });
74363       const dupeLabels = new WeakSet(Object.values(
74364         utilArrayGroupBy(items.selectAll(".label-text").nodes(), "textContent")
74365       ).filter((v3) => v3.length > 1).flat());
74366       items.select(".label-text").each(function() {
74367         const label = select_default2(this);
74368         const entityName = label.select(".member-entity-name");
74369         if (dupeLabels.has(this)) {
74370           label.attr("title", (d2) => `${entityName.text()} ${d2.relation.id}`);
74371         } else {
74372           label.attr("title", () => entityName.text());
74373         }
74374       });
74375       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
74376       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
74377         return d2.domId;
74378       }).property("type", "text").property("value", function(d2) {
74379         return typeof d2.role === "string" ? d2.role : "";
74380       }).attr("title", function(d2) {
74381         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
74382       }).attr("placeholder", function(d2) {
74383         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
74384       }).classed("mixed", function(d2) {
74385         return Array.isArray(d2.role);
74386       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
74387       if (taginfo) {
74388         wrapEnter.each(bindTypeahead);
74389       }
74390       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
74391       newMembership.exit().remove();
74392       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
74393       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
74394       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
74395       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
74396         list.selectAll(".member-row-new").remove();
74397       });
74398       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
74399       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
74400       newMembership = newMembership.merge(newMembershipEnter);
74401       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
74402         nearbyCombo.on("accept", function(d2) {
74403           this.blur();
74404           acceptEntity.call(this, d2);
74405         }).on("cancel", cancelEntity)
74406       );
74407       var addRow = selection2.selectAll(".add-row").data([0]);
74408       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
74409       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
74410       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
74411       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
74412       addRowEnter.append("div").attr("class", "space-value");
74413       addRowEnter.append("div").attr("class", "space-buttons");
74414       addRow = addRow.merge(addRowEnter);
74415       addRow.select(".add-relation").on("click", function() {
74416         _showBlank = true;
74417         section.reRender();
74418         list.selectAll(".member-entity-input").node().focus();
74419       });
74420       function acceptEntity(d2) {
74421         if (!d2) {
74422           cancelEntity();
74423           return;
74424         }
74425         if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
74426         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
74427         addMembership(d2, role);
74428       }
74429       function cancelEntity() {
74430         var input = newMembership.selectAll(".member-entity-input");
74431         input.property("value", "");
74432         context.surface().selectAll(".highlighted").classed("highlighted", false);
74433       }
74434       function bindTypeahead(d2) {
74435         var row = select_default2(this);
74436         var role = row.selectAll("input.member-role");
74437         var origValue = role.property("value");
74438         function sort(value, data) {
74439           var sameletter = [];
74440           var other = [];
74441           for (var i3 = 0; i3 < data.length; i3++) {
74442             if (data[i3].value.substring(0, value.length) === value) {
74443               sameletter.push(data[i3]);
74444             } else {
74445               other.push(data[i3]);
74446             }
74447           }
74448           return sameletter.concat(other);
74449         }
74450         role.call(
74451           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
74452             var rtype = d2.relation.tags.type;
74453             taginfo.roles({
74454               debounce: true,
74455               rtype: rtype || "",
74456               geometry: context.graph().geometry(_entityIDs[0]),
74457               query: role2
74458             }, function(err, data) {
74459               if (!err) callback(sort(role2, data));
74460             });
74461           }).on("cancel", function() {
74462             role.property("value", origValue);
74463           })
74464         );
74465       }
74466       function unbind() {
74467         var row = select_default2(this);
74468         row.selectAll("input.member-role").call(uiCombobox.off, context);
74469       }
74470     }
74471     section.entityIDs = function(val) {
74472       if (!arguments.length) return _entityIDs;
74473       const didChange = _entityIDs.join(",") !== val.join(",");
74474       _entityIDs = val;
74475       _showBlank = false;
74476       if (didChange) {
74477         recentlyAdded.clear();
74478       }
74479       return section;
74480     };
74481     return section;
74482   }
74483   var init_raw_membership_editor = __esm({
74484     "modules/ui/sections/raw_membership_editor.js"() {
74485       "use strict";
74486       init_src5();
74487       init_presets();
74488       init_localizer();
74489       init_add_entity();
74490       init_add_member();
74491       init_change_member();
74492       init_delete_members();
74493       init_select5();
74494       init_osm();
74495       init_tags();
74496       init_services();
74497       init_icon();
74498       init_combobox();
74499       init_section();
74500       init_tooltip();
74501       init_array3();
74502       init_util();
74503     }
74504   });
74505
74506   // modules/ui/sections/selection_list.js
74507   var selection_list_exports = {};
74508   __export(selection_list_exports, {
74509     uiSectionSelectionList: () => uiSectionSelectionList
74510   });
74511   function uiSectionSelectionList(context) {
74512     var _selectedIDs = [];
74513     var section = uiSection("selected-features", context).shouldDisplay(function() {
74514       return _selectedIDs.length > 1;
74515     }).label(function() {
74516       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
74517     }).disclosureContent(renderDisclosureContent);
74518     context.history().on("change.selectionList", function(difference2) {
74519       if (difference2) {
74520         section.reRender();
74521       }
74522     });
74523     section.entityIDs = function(val) {
74524       if (!arguments.length) return _selectedIDs;
74525       _selectedIDs = val;
74526       return section;
74527     };
74528     function selectEntity(d3_event, entity) {
74529       context.enter(modeSelect(context, [entity.id]));
74530     }
74531     function deselectEntity(d3_event, entity) {
74532       var selectedIDs = _selectedIDs.slice();
74533       var index = selectedIDs.indexOf(entity.id);
74534       if (index > -1) {
74535         selectedIDs.splice(index, 1);
74536         context.enter(modeSelect(context, selectedIDs));
74537       }
74538     }
74539     function renderDisclosureContent(selection2) {
74540       var list = selection2.selectAll(".feature-list").data([0]);
74541       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
74542       var entities = _selectedIDs.map(function(id2) {
74543         return context.hasEntity(id2);
74544       }).filter(Boolean);
74545       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
74546       items.exit().remove();
74547       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
74548         select_default2(this).on("mouseover", function() {
74549           utilHighlightEntities([d2.id], true, context);
74550         }).on("mouseout", function() {
74551           utilHighlightEntities([d2.id], false, context);
74552         });
74553       });
74554       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
74555       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
74556       label.append("span").attr("class", "entity-type");
74557       label.append("span").attr("class", "entity-name");
74558       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
74559       items = items.merge(enter);
74560       items.selectAll(".entity-geom-icon use").attr("href", function() {
74561         var entity = this.parentNode.parentNode.__data__;
74562         return "#iD-icon-" + entity.geometry(context.graph());
74563       });
74564       items.selectAll(".entity-type").text(function(entity) {
74565         return _mainPresetIndex.match(entity, context.graph()).name();
74566       });
74567       items.selectAll(".entity-name").text(function(d2) {
74568         var entity = context.entity(d2.id);
74569         return utilDisplayName(entity);
74570       });
74571     }
74572     return section;
74573   }
74574   var init_selection_list = __esm({
74575     "modules/ui/sections/selection_list.js"() {
74576       "use strict";
74577       init_src5();
74578       init_presets();
74579       init_select5();
74580       init_osm();
74581       init_icon();
74582       init_section();
74583       init_localizer();
74584       init_util();
74585     }
74586   });
74587
74588   // modules/ui/entity_editor.js
74589   var entity_editor_exports = {};
74590   __export(entity_editor_exports, {
74591     uiEntityEditor: () => uiEntityEditor
74592   });
74593   function uiEntityEditor(context) {
74594     var dispatch14 = dispatch_default("choose");
74595     var _state = "select";
74596     var _coalesceChanges = false;
74597     var _modified = false;
74598     var _base;
74599     var _entityIDs;
74600     var _activePresets = [];
74601     var _newFeature;
74602     var _sections;
74603     function entityEditor(selection2) {
74604       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
74605       var header = selection2.selectAll(".header").data([0]);
74606       var headerEnter = header.enter().append("div").attr("class", "header fillL");
74607       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
74608       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
74609       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
74610         context.enter(modeBrowse(context));
74611       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
74612       headerEnter.append("h2");
74613       header = header.merge(headerEnter);
74614       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
74615       header.selectAll(".preset-reset").on("click", function() {
74616         dispatch14.call("choose", this, _activePresets);
74617       });
74618       var body = selection2.selectAll(".inspector-body").data([0]);
74619       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
74620       body = body.merge(bodyEnter);
74621       if (!_sections) {
74622         _sections = [
74623           uiSectionSelectionList(context),
74624           uiSectionFeatureType(context).on("choose", function(presets) {
74625             dispatch14.call("choose", this, presets);
74626           }),
74627           uiSectionEntityIssues(context),
74628           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
74629           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
74630           uiSectionRawMemberEditor(context),
74631           uiSectionRawMembershipEditor(context)
74632         ];
74633       }
74634       _sections.forEach(function(section) {
74635         if (section.entityIDs) {
74636           section.entityIDs(_entityIDs);
74637         }
74638         if (section.presets) {
74639           section.presets(_activePresets);
74640         }
74641         if (section.tags) {
74642           section.tags(combinedTags);
74643         }
74644         if (section.state) {
74645           section.state(_state);
74646         }
74647         body.call(section.render);
74648       });
74649       context.history().on("change.entity-editor", historyChanged);
74650       function historyChanged(difference2) {
74651         if (selection2.selectAll(".entity-editor").empty()) return;
74652         if (_state === "hide") return;
74653         var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
74654         if (!significant) return;
74655         _entityIDs = _entityIDs.filter(context.hasEntity);
74656         if (!_entityIDs.length) return;
74657         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
74658         loadActivePresets();
74659         var graph = context.graph();
74660         entityEditor.modified(_base !== graph);
74661         entityEditor(selection2);
74662         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
74663           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
74664         }
74665       }
74666     }
74667     function changeTags(entityIDs, changed, onInput) {
74668       var actions = [];
74669       for (var i3 in entityIDs) {
74670         var entityID = entityIDs[i3];
74671         var entity = context.entity(entityID);
74672         var tags = Object.assign({}, entity.tags);
74673         if (typeof changed === "function") {
74674           tags = changed(tags);
74675         } else {
74676           for (var k3 in changed) {
74677             if (!k3) continue;
74678             var v3 = changed[k3];
74679             if (typeof v3 === "object") {
74680               tags[k3] = tags[v3.oldKey];
74681             } else if (v3 !== void 0 || tags.hasOwnProperty(k3)) {
74682               tags[k3] = v3;
74683             }
74684           }
74685         }
74686         if (!onInput) {
74687           tags = utilCleanTags(tags);
74688         }
74689         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
74690           actions.push(actionChangeTags(entityID, tags));
74691         }
74692       }
74693       if (actions.length) {
74694         var combinedAction = function(graph) {
74695           actions.forEach(function(action) {
74696             graph = action(graph);
74697           });
74698           return graph;
74699         };
74700         var annotation = _t("operations.change_tags.annotation");
74701         if (_coalesceChanges) {
74702           context.replace(combinedAction, annotation);
74703         } else {
74704           context.perform(combinedAction, annotation);
74705         }
74706         _coalesceChanges = !!onInput;
74707       }
74708       if (!onInput) {
74709         context.validator().validate();
74710       }
74711     }
74712     function revertTags(keys2) {
74713       var actions = [];
74714       for (var i3 in _entityIDs) {
74715         var entityID = _entityIDs[i3];
74716         var original = context.graph().base().entities[entityID];
74717         var changed = {};
74718         for (var j3 in keys2) {
74719           var key = keys2[j3];
74720           changed[key] = original ? original.tags[key] : void 0;
74721         }
74722         var entity = context.entity(entityID);
74723         var tags = Object.assign({}, entity.tags);
74724         for (var k3 in changed) {
74725           if (!k3) continue;
74726           var v3 = changed[k3];
74727           if (v3 !== void 0 || tags.hasOwnProperty(k3)) {
74728             tags[k3] = v3;
74729           }
74730         }
74731         tags = utilCleanTags(tags);
74732         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
74733           actions.push(actionChangeTags(entityID, tags));
74734         }
74735       }
74736       if (actions.length) {
74737         var combinedAction = function(graph) {
74738           actions.forEach(function(action) {
74739             graph = action(graph);
74740           });
74741           return graph;
74742         };
74743         var annotation = _t("operations.change_tags.annotation");
74744         if (_coalesceChanges) {
74745           context.replace(combinedAction, annotation);
74746         } else {
74747           context.perform(combinedAction, annotation);
74748         }
74749       }
74750       context.validator().validate();
74751     }
74752     entityEditor.modified = function(val) {
74753       if (!arguments.length) return _modified;
74754       _modified = val;
74755       return entityEditor;
74756     };
74757     entityEditor.state = function(val) {
74758       if (!arguments.length) return _state;
74759       _state = val;
74760       return entityEditor;
74761     };
74762     entityEditor.entityIDs = function(val) {
74763       if (!arguments.length) return _entityIDs;
74764       _base = context.graph();
74765       _coalesceChanges = false;
74766       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor;
74767       _entityIDs = val;
74768       loadActivePresets(true);
74769       return entityEditor.modified(false);
74770     };
74771     entityEditor.newFeature = function(val) {
74772       if (!arguments.length) return _newFeature;
74773       _newFeature = val;
74774       return entityEditor;
74775     };
74776     function loadActivePresets(isForNewSelection) {
74777       var graph = context.graph();
74778       var counts = {};
74779       for (var i3 in _entityIDs) {
74780         var entity = graph.hasEntity(_entityIDs[i3]);
74781         if (!entity) return;
74782         var match = _mainPresetIndex.match(entity, graph);
74783         if (!counts[match.id]) counts[match.id] = 0;
74784         counts[match.id] += 1;
74785       }
74786       var matches = Object.keys(counts).sort(function(p1, p2) {
74787         return counts[p2] - counts[p1];
74788       }).map(function(pID) {
74789         return _mainPresetIndex.item(pID);
74790       });
74791       if (!isForNewSelection) {
74792         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
74793         if (weakPreset && matches.length === 1 && matches[0].isFallback()) return;
74794       }
74795       entityEditor.presets(matches);
74796     }
74797     entityEditor.presets = function(val) {
74798       if (!arguments.length) return _activePresets;
74799       if (!utilArrayIdentical(val, _activePresets)) {
74800         _activePresets = val;
74801       }
74802       return entityEditor;
74803     };
74804     return utilRebind(entityEditor, dispatch14, "on");
74805   }
74806   var import_fast_deep_equal10;
74807   var init_entity_editor = __esm({
74808     "modules/ui/entity_editor.js"() {
74809       "use strict";
74810       init_src4();
74811       import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
74812       init_presets();
74813       init_localizer();
74814       init_change_tags();
74815       init_browse();
74816       init_icon();
74817       init_array3();
74818       init_util();
74819       init_entity_issues();
74820       init_feature_type();
74821       init_preset_fields();
74822       init_raw_member_editor();
74823       init_raw_membership_editor();
74824       init_raw_tag_editor();
74825       init_selection_list();
74826     }
74827   });
74828
74829   // modules/ui/preset_list.js
74830   var preset_list_exports = {};
74831   __export(preset_list_exports, {
74832     uiPresetList: () => uiPresetList
74833   });
74834   function uiPresetList(context) {
74835     var dispatch14 = dispatch_default("cancel", "choose");
74836     var _entityIDs;
74837     var _currLoc;
74838     var _currentPresets;
74839     var _autofocus = false;
74840     function presetList(selection2) {
74841       if (!_entityIDs) return;
74842       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
74843       selection2.html("");
74844       var messagewrap = selection2.append("div").attr("class", "header fillL");
74845       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
74846       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
74847         dispatch14.call("cancel", this);
74848       }).call(svgIcon("#iD-icon-close"));
74849       function initialKeydown(d3_event) {
74850         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
74851           d3_event.preventDefault();
74852           d3_event.stopPropagation();
74853           operationDelete(context, _entityIDs)();
74854         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
74855           d3_event.preventDefault();
74856           d3_event.stopPropagation();
74857           context.undo();
74858         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
74859           select_default2(this).on("keydown", keydown);
74860           keydown.call(this, d3_event);
74861         }
74862       }
74863       function keydown(d3_event) {
74864         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
74865         search.node().selectionStart === search.property("value").length) {
74866           d3_event.preventDefault();
74867           d3_event.stopPropagation();
74868           var buttons = list.selectAll(".preset-list-button");
74869           if (!buttons.empty()) buttons.nodes()[0].focus();
74870         }
74871       }
74872       function keypress(d3_event) {
74873         var value = search.property("value");
74874         if (d3_event.keyCode === 13 && // ↩ Return
74875         value.length) {
74876           list.selectAll(".preset-list-item:first-child").each(function(d2) {
74877             d2.choose.call(this);
74878           });
74879         }
74880       }
74881       function inputevent() {
74882         var value = search.property("value");
74883         list.classed("filtered", value.length);
74884         var results, messageText;
74885         if (value.length) {
74886           results = presets.search(value, entityGeometries()[0], _currLoc);
74887           messageText = _t.html("inspector.results", {
74888             n: results.collection.length,
74889             search: value
74890           });
74891         } else {
74892           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
74893           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
74894           messageText = _t.html("inspector.choose");
74895         }
74896         list.call(drawList, results);
74897         message.html(messageText);
74898       }
74899       var searchWrap = selection2.append("div").attr("class", "search-header");
74900       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
74901       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));
74902       if (_autofocus) {
74903         search.node().focus();
74904         setTimeout(function() {
74905           search.node().focus();
74906         }, 0);
74907       }
74908       var listWrap = selection2.append("div").attr("class", "inspector-body");
74909       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
74910       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
74911       context.features().on("change.preset-list", updateForFeatureHiddenState);
74912     }
74913     function drawList(list, presets) {
74914       presets = presets.matchAllGeometry(entityGeometries());
74915       var collection = presets.collection.reduce(function(collection2, preset) {
74916         if (!preset) return collection2;
74917         if (preset.members) {
74918           if (preset.members.collection.filter(function(preset2) {
74919             return preset2.addable();
74920           }).length > 1) {
74921             collection2.push(CategoryItem(preset));
74922           }
74923         } else if (preset.addable()) {
74924           collection2.push(PresetItem(preset));
74925         }
74926         return collection2;
74927       }, []);
74928       var items = list.selectAll(".preset-list-item").data(collection, function(d2) {
74929         return d2.preset.id;
74930       });
74931       items.order();
74932       items.exit().remove();
74933       items.enter().append("div").attr("class", function(item) {
74934         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
74935       }).classed("current", function(item) {
74936         return _currentPresets.indexOf(item.preset) !== -1;
74937       }).each(function(item) {
74938         select_default2(this).call(item);
74939       }).style("opacity", 0).transition().style("opacity", 1);
74940       updateForFeatureHiddenState();
74941     }
74942     function itemKeydown(d3_event) {
74943       var item = select_default2(this.closest(".preset-list-item"));
74944       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
74945       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
74946         d3_event.preventDefault();
74947         d3_event.stopPropagation();
74948         var nextItem = select_default2(item.node().nextElementSibling);
74949         if (nextItem.empty()) {
74950           if (!parentItem.empty()) {
74951             nextItem = select_default2(parentItem.node().nextElementSibling);
74952           }
74953         } else if (select_default2(this).classed("expanded")) {
74954           nextItem = item.select(".subgrid .preset-list-item:first-child");
74955         }
74956         if (!nextItem.empty()) {
74957           nextItem.select(".preset-list-button").node().focus();
74958         }
74959       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
74960         d3_event.preventDefault();
74961         d3_event.stopPropagation();
74962         var previousItem = select_default2(item.node().previousElementSibling);
74963         if (previousItem.empty()) {
74964           if (!parentItem.empty()) {
74965             previousItem = parentItem;
74966           }
74967         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
74968           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
74969         }
74970         if (!previousItem.empty()) {
74971           previousItem.select(".preset-list-button").node().focus();
74972         } else {
74973           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
74974           search.node().focus();
74975         }
74976       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
74977         d3_event.preventDefault();
74978         d3_event.stopPropagation();
74979         if (!parentItem.empty()) {
74980           parentItem.select(".preset-list-button").node().focus();
74981         }
74982       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
74983         d3_event.preventDefault();
74984         d3_event.stopPropagation();
74985         item.datum().choose.call(select_default2(this).node());
74986       }
74987     }
74988     function CategoryItem(preset) {
74989       var box, sublist, shown = false;
74990       function item(selection2) {
74991         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
74992         function click() {
74993           var isExpanded = select_default2(this).classed("expanded");
74994           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
74995           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
74996           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
74997           item.choose();
74998         }
74999         var geometries = entityGeometries();
75000         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) {
75001           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
75002             d3_event.preventDefault();
75003             d3_event.stopPropagation();
75004             if (!select_default2(this).classed("expanded")) {
75005               click.call(this, d3_event);
75006             }
75007           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
75008             d3_event.preventDefault();
75009             d3_event.stopPropagation();
75010             if (select_default2(this).classed("expanded")) {
75011               click.call(this, d3_event);
75012             }
75013           } else {
75014             itemKeydown.call(this, d3_event);
75015           }
75016         });
75017         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
75018         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");
75019         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
75020         box.append("div").attr("class", "arrow");
75021         sublist = box.append("div").attr("class", "preset-list fillL3");
75022       }
75023       item.choose = function() {
75024         if (!box || !sublist) return;
75025         if (shown) {
75026           shown = false;
75027           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
75028         } else {
75029           shown = true;
75030           var members = preset.members.matchAllGeometry(entityGeometries());
75031           sublist.call(drawList, members);
75032           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
75033         }
75034       };
75035       item.preset = preset;
75036       return item;
75037     }
75038     function PresetItem(preset) {
75039       function item(selection2) {
75040         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
75041         var geometries = entityGeometries();
75042         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);
75043         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
75044         var nameparts = [
75045           preset.nameLabel(),
75046           preset.subtitleLabel()
75047         ].filter(Boolean);
75048         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
75049           d2(select_default2(this));
75050         });
75051         wrap2.call(item.reference.button);
75052         selection2.call(item.reference.body);
75053       }
75054       item.choose = function() {
75055         if (select_default2(this).classed("disabled")) return;
75056         if (!context.inIntro()) {
75057           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
75058         }
75059         context.perform(
75060           function(graph) {
75061             for (var i3 in _entityIDs) {
75062               var entityID = _entityIDs[i3];
75063               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
75064               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
75065             }
75066             return graph;
75067           },
75068           _t("operations.change_tags.annotation")
75069         );
75070         context.validator().validate();
75071         dispatch14.call("choose", this, preset);
75072       };
75073       item.help = function(d3_event) {
75074         d3_event.stopPropagation();
75075         item.reference.toggle();
75076       };
75077       item.preset = preset;
75078       item.reference = uiTagReference(preset.reference(), context);
75079       return item;
75080     }
75081     function updateForFeatureHiddenState() {
75082       if (!_entityIDs.every(context.hasEntity)) return;
75083       var geometries = entityGeometries();
75084       var button = context.container().selectAll(".preset-list .preset-list-button");
75085       button.call(uiTooltip().destroyAny);
75086       button.each(function(item, index) {
75087         var hiddenPresetFeaturesId;
75088         for (var i3 in geometries) {
75089           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
75090           if (hiddenPresetFeaturesId) break;
75091         }
75092         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
75093         select_default2(this).classed("disabled", isHiddenPreset);
75094         if (isHiddenPreset) {
75095           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
75096           select_default2(this).call(
75097             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
75098               features: _t("feature." + hiddenPresetFeaturesId + ".description")
75099             })).placement(index < 2 ? "bottom" : "top")
75100           );
75101         }
75102       });
75103     }
75104     presetList.autofocus = function(val) {
75105       if (!arguments.length) return _autofocus;
75106       _autofocus = val;
75107       return presetList;
75108     };
75109     presetList.entityIDs = function(val) {
75110       if (!arguments.length) return _entityIDs;
75111       _entityIDs = val;
75112       _currLoc = null;
75113       if (_entityIDs && _entityIDs.length) {
75114         const extent = _entityIDs.reduce(function(extent2, entityID) {
75115           var entity = context.graph().entity(entityID);
75116           return extent2.extend(entity.extent(context.graph()));
75117         }, geoExtent());
75118         _currLoc = extent.center();
75119         var presets = _entityIDs.map(function(entityID) {
75120           return _mainPresetIndex.match(context.entity(entityID), context.graph());
75121         });
75122         presetList.presets(presets);
75123       }
75124       return presetList;
75125     };
75126     presetList.presets = function(val) {
75127       if (!arguments.length) return _currentPresets;
75128       _currentPresets = val;
75129       return presetList;
75130     };
75131     function entityGeometries() {
75132       var counts = {};
75133       for (var i3 in _entityIDs) {
75134         var entityID = _entityIDs[i3];
75135         var entity = context.entity(entityID);
75136         var geometry = entity.geometry(context.graph());
75137         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
75138           geometry = "point";
75139         }
75140         if (!counts[geometry]) counts[geometry] = 0;
75141         counts[geometry] += 1;
75142       }
75143       return Object.keys(counts).sort(function(geom1, geom2) {
75144         return counts[geom2] - counts[geom1];
75145       });
75146     }
75147     return utilRebind(presetList, dispatch14, "on");
75148   }
75149   var init_preset_list = __esm({
75150     "modules/ui/preset_list.js"() {
75151       "use strict";
75152       init_src4();
75153       init_src5();
75154       init_debounce();
75155       init_presets();
75156       init_localizer();
75157       init_change_preset();
75158       init_delete();
75159       init_svg();
75160       init_tooltip();
75161       init_extent();
75162       init_preset_icon();
75163       init_tag_reference();
75164       init_util();
75165     }
75166   });
75167
75168   // modules/ui/inspector.js
75169   var inspector_exports = {};
75170   __export(inspector_exports, {
75171     uiInspector: () => uiInspector
75172   });
75173   function uiInspector(context) {
75174     var presetList = uiPresetList(context);
75175     var entityEditor = uiEntityEditor(context);
75176     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
75177     var _state = "select";
75178     var _entityIDs;
75179     var _newFeature = false;
75180     function inspector(selection2) {
75181       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
75182         inspector.setPreset();
75183       });
75184       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
75185       wrap2 = selection2.selectAll(".panewrap").data([0]);
75186       var enter = wrap2.enter().append("div").attr("class", "panewrap");
75187       enter.append("div").attr("class", "preset-list-pane pane");
75188       enter.append("div").attr("class", "entity-editor-pane pane");
75189       wrap2 = wrap2.merge(enter);
75190       presetPane = wrap2.selectAll(".preset-list-pane");
75191       editorPane = wrap2.selectAll(".entity-editor-pane");
75192       function shouldDefaultToPresetList() {
75193         if (_state !== "select") return false;
75194         if (_entityIDs.length !== 1) return false;
75195         var entityID = _entityIDs[0];
75196         var entity = context.hasEntity(entityID);
75197         if (!entity) return false;
75198         if (entity.hasNonGeometryTags()) return false;
75199         if (_newFeature) return true;
75200         if (entity.geometry(context.graph()) !== "vertex") return false;
75201         if (context.graph().parentRelations(entity).length) return false;
75202         if (context.validator().getEntityIssues(entityID).length) return false;
75203         if (entity.type === "node" && entity.isHighwayIntersection(context.graph())) return false;
75204         return true;
75205       }
75206       if (shouldDefaultToPresetList()) {
75207         wrap2.style("right", "-100%");
75208         editorPane.classed("hide", true);
75209         presetPane.classed("hide", false).call(presetList);
75210       } else {
75211         wrap2.style("right", "0%");
75212         presetPane.classed("hide", true);
75213         editorPane.classed("hide", false).call(entityEditor);
75214       }
75215       var footer = selection2.selectAll(".footer").data([0]);
75216       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
75217       footer.call(
75218         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
75219       );
75220     }
75221     inspector.showList = function(presets) {
75222       presetPane.classed("hide", false);
75223       wrap2.transition().styleTween("right", function() {
75224         return value_default("0%", "-100%");
75225       }).on("end", function() {
75226         editorPane.classed("hide", true);
75227       });
75228       if (presets) {
75229         presetList.presets(presets);
75230       }
75231       presetPane.call(presetList.autofocus(true));
75232     };
75233     inspector.setPreset = function(preset) {
75234       if (preset && preset.id === "type/multipolygon") {
75235         presetPane.call(presetList.autofocus(true));
75236       } else {
75237         editorPane.classed("hide", false);
75238         wrap2.transition().styleTween("right", function() {
75239           return value_default("-100%", "0%");
75240         }).on("end", function() {
75241           presetPane.classed("hide", true);
75242         });
75243         if (preset) {
75244           entityEditor.presets([preset]);
75245         }
75246         editorPane.call(entityEditor);
75247       }
75248     };
75249     inspector.state = function(val) {
75250       if (!arguments.length) return _state;
75251       _state = val;
75252       entityEditor.state(_state);
75253       context.container().selectAll(".field-help-body").remove();
75254       return inspector;
75255     };
75256     inspector.entityIDs = function(val) {
75257       if (!arguments.length) return _entityIDs;
75258       _entityIDs = val;
75259       return inspector;
75260     };
75261     inspector.newFeature = function(val) {
75262       if (!arguments.length) return _newFeature;
75263       _newFeature = val;
75264       return inspector;
75265     };
75266     return inspector;
75267   }
75268   var init_inspector = __esm({
75269     "modules/ui/inspector.js"() {
75270       "use strict";
75271       init_src8();
75272       init_src5();
75273       init_entity_editor();
75274       init_preset_list();
75275       init_view_on_osm();
75276     }
75277   });
75278
75279   // modules/ui/sidebar.js
75280   var sidebar_exports = {};
75281   __export(sidebar_exports, {
75282     uiSidebar: () => uiSidebar
75283   });
75284   function uiSidebar(context) {
75285     var inspector = uiInspector(context);
75286     var dataEditor = uiDataEditor(context);
75287     var noteEditor = uiNoteEditor(context);
75288     var keepRightEditor = uiKeepRightEditor(context);
75289     var osmoseEditor = uiOsmoseEditor(context);
75290     var _current;
75291     var _wasData = false;
75292     var _wasNote = false;
75293     var _wasQaItem = false;
75294     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
75295     function sidebar(selection2) {
75296       var container = context.container();
75297       var minWidth = 240;
75298       var sidebarWidth;
75299       var containerWidth;
75300       var dragOffset;
75301       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
75302       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
75303       var downPointerId, lastClientX, containerLocGetter;
75304       function pointerdown(d3_event) {
75305         if (downPointerId) return;
75306         if ("button" in d3_event && d3_event.button !== 0) return;
75307         downPointerId = d3_event.pointerId || "mouse";
75308         lastClientX = d3_event.clientX;
75309         containerLocGetter = utilFastMouse(container.node());
75310         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
75311         sidebarWidth = selection2.node().getBoundingClientRect().width;
75312         containerWidth = container.node().getBoundingClientRect().width;
75313         var widthPct = sidebarWidth / containerWidth * 100;
75314         selection2.style("width", widthPct + "%").style("max-width", "85%");
75315         resizer.classed("dragging", true);
75316         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
75317           d3_event2.preventDefault();
75318         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
75319       }
75320       function pointermove(d3_event) {
75321         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
75322         d3_event.preventDefault();
75323         var dx = d3_event.clientX - lastClientX;
75324         lastClientX = d3_event.clientX;
75325         var isRTL = _mainLocalizer.textDirection() === "rtl";
75326         var scaleX = isRTL ? 0 : 1;
75327         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
75328         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
75329         sidebarWidth = isRTL ? containerWidth - x2 : x2;
75330         var isCollapsed = selection2.classed("collapsed");
75331         var shouldCollapse = sidebarWidth < minWidth;
75332         selection2.classed("collapsed", shouldCollapse);
75333         if (shouldCollapse) {
75334           if (!isCollapsed) {
75335             selection2.style(xMarginProperty, "-400px").style("width", "400px");
75336             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
75337           }
75338         } else {
75339           var widthPct = sidebarWidth / containerWidth * 100;
75340           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
75341           if (isCollapsed) {
75342             context.ui().onResize([-sidebarWidth * scaleX, 0]);
75343           } else {
75344             context.ui().onResize([-dx * scaleX, 0]);
75345           }
75346         }
75347       }
75348       function pointerup(d3_event) {
75349         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
75350         downPointerId = null;
75351         resizer.classed("dragging", false);
75352         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
75353       }
75354       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
75355       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
75356       var hoverModeSelect = function(targets) {
75357         context.container().selectAll(".feature-list-item button").classed("hover", false);
75358         if (context.selectedIDs().length > 1 && targets && targets.length) {
75359           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
75360             return targets.indexOf(node) !== -1;
75361           });
75362           if (!elements.empty()) {
75363             elements.classed("hover", true);
75364           }
75365         }
75366       };
75367       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
75368       function hover(targets) {
75369         var datum2 = targets && targets.length && targets[0];
75370         if (datum2 && datum2.__featurehash__) {
75371           _wasData = true;
75372           sidebar.show(dataEditor.datum(datum2));
75373           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75374         } else if (datum2 instanceof osmNote) {
75375           if (context.mode().id === "drag-note") return;
75376           _wasNote = true;
75377           var osm = services.osm;
75378           if (osm) {
75379             datum2 = osm.getNote(datum2.id);
75380           }
75381           sidebar.show(noteEditor.note(datum2));
75382           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75383         } else if (datum2 instanceof QAItem) {
75384           _wasQaItem = true;
75385           var errService = services[datum2.service];
75386           if (errService) {
75387             datum2 = errService.getError(datum2.id);
75388           }
75389           var errEditor;
75390           if (datum2.service === "keepRight") {
75391             errEditor = keepRightEditor;
75392           } else {
75393             errEditor = osmoseEditor;
75394           }
75395           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
75396             return d2.id === datum2.id;
75397           });
75398           sidebar.show(errEditor.error(datum2));
75399           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75400         } else if (!_current && datum2 instanceof osmEntity) {
75401           featureListWrap.classed("inspector-hidden", true);
75402           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
75403           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
75404             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
75405             inspectorWrap.call(inspector);
75406           }
75407         } else if (!_current) {
75408           featureListWrap.classed("inspector-hidden", false);
75409           inspectorWrap.classed("inspector-hidden", true);
75410           inspector.state("hide");
75411         } else if (_wasData || _wasNote || _wasQaItem) {
75412           _wasNote = false;
75413           _wasData = false;
75414           _wasQaItem = false;
75415           context.container().selectAll(".note").classed("hover", false);
75416           context.container().selectAll(".qaItem").classed("hover", false);
75417           sidebar.hide();
75418         }
75419       }
75420       sidebar.hover = throttle_default(hover, 200);
75421       sidebar.intersects = function(extent) {
75422         var rect = selection2.node().getBoundingClientRect();
75423         return extent.intersects([
75424           context.projection.invert([0, rect.height]),
75425           context.projection.invert([rect.width, 0])
75426         ]);
75427       };
75428       sidebar.select = function(ids, newFeature) {
75429         sidebar.hide();
75430         if (ids && ids.length) {
75431           var entity = ids.length === 1 && context.entity(ids[0]);
75432           if (entity && newFeature && selection2.classed("collapsed")) {
75433             var extent = entity.extent(context.graph());
75434             sidebar.expand(sidebar.intersects(extent));
75435           }
75436           featureListWrap.classed("inspector-hidden", true);
75437           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
75438           inspector.state("select").entityIDs(ids).newFeature(newFeature);
75439           inspectorWrap.call(inspector);
75440         } else {
75441           inspector.state("hide");
75442         }
75443       };
75444       sidebar.showPresetList = function() {
75445         inspector.showList();
75446       };
75447       sidebar.show = function(component, element) {
75448         featureListWrap.classed("inspector-hidden", true);
75449         inspectorWrap.classed("inspector-hidden", true);
75450         if (_current) _current.remove();
75451         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
75452       };
75453       sidebar.hide = function() {
75454         featureListWrap.classed("inspector-hidden", false);
75455         inspectorWrap.classed("inspector-hidden", true);
75456         if (_current) _current.remove();
75457         _current = null;
75458       };
75459       sidebar.expand = function(moveMap) {
75460         if (selection2.classed("collapsed")) {
75461           sidebar.toggle(moveMap);
75462         }
75463       };
75464       sidebar.collapse = function(moveMap) {
75465         if (!selection2.classed("collapsed")) {
75466           sidebar.toggle(moveMap);
75467         }
75468       };
75469       sidebar.toggle = function(moveMap) {
75470         if (context.inIntro()) return;
75471         var isCollapsed = selection2.classed("collapsed");
75472         var isCollapsing = !isCollapsed;
75473         var isRTL = _mainLocalizer.textDirection() === "rtl";
75474         var scaleX = isRTL ? 0 : 1;
75475         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
75476         sidebarWidth = selection2.node().getBoundingClientRect().width;
75477         selection2.style("width", sidebarWidth + "px");
75478         var startMargin, endMargin, lastMargin;
75479         if (isCollapsing) {
75480           startMargin = lastMargin = 0;
75481           endMargin = -sidebarWidth;
75482         } else {
75483           startMargin = lastMargin = -sidebarWidth;
75484           endMargin = 0;
75485         }
75486         if (!isCollapsing) {
75487           selection2.classed("collapsed", isCollapsing);
75488         }
75489         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
75490           var i3 = number_default(startMargin, endMargin);
75491           return function(t2) {
75492             var dx = lastMargin - Math.round(i3(t2));
75493             lastMargin = lastMargin - dx;
75494             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
75495           };
75496         }).on("end", function() {
75497           if (isCollapsing) {
75498             selection2.classed("collapsed", isCollapsing);
75499           }
75500           if (!isCollapsing) {
75501             var containerWidth2 = container.node().getBoundingClientRect().width;
75502             var widthPct = sidebarWidth / containerWidth2 * 100;
75503             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
75504           }
75505         });
75506       };
75507       resizer.on("dblclick", function(d3_event) {
75508         d3_event.preventDefault();
75509         if (d3_event.sourceEvent) {
75510           d3_event.sourceEvent.preventDefault();
75511         }
75512         sidebar.toggle();
75513       });
75514       context.map().on("crossEditableZoom.sidebar", function(within) {
75515         if (!within && !selection2.select(".inspector-hover").empty()) {
75516           hover([]);
75517         }
75518       });
75519     }
75520     sidebar.showPresetList = function() {
75521     };
75522     sidebar.hover = function() {
75523     };
75524     sidebar.hover.cancel = function() {
75525     };
75526     sidebar.intersects = function() {
75527     };
75528     sidebar.select = function() {
75529     };
75530     sidebar.show = function() {
75531     };
75532     sidebar.hide = function() {
75533     };
75534     sidebar.expand = function() {
75535     };
75536     sidebar.collapse = function() {
75537     };
75538     sidebar.toggle = function() {
75539     };
75540     return sidebar;
75541   }
75542   var init_sidebar = __esm({
75543     "modules/ui/sidebar.js"() {
75544       "use strict";
75545       init_throttle();
75546       init_src8();
75547       init_src5();
75548       init_array3();
75549       init_util();
75550       init_osm();
75551       init_services();
75552       init_data_editor();
75553       init_feature_list();
75554       init_inspector();
75555       init_keepRight_editor();
75556       init_osmose_editor();
75557       init_note_editor();
75558       init_localizer();
75559     }
75560   });
75561
75562   // modules/ui/source_switch.js
75563   var source_switch_exports = {};
75564   __export(source_switch_exports, {
75565     uiSourceSwitch: () => uiSourceSwitch
75566   });
75567   function uiSourceSwitch(context) {
75568     var keys2;
75569     function click(d3_event) {
75570       d3_event.preventDefault();
75571       var osm = context.connection();
75572       if (!osm) return;
75573       if (context.inIntro()) return;
75574       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes"))) return;
75575       var isLive = select_default2(this).classed("live");
75576       isLive = !isLive;
75577       context.enter(modeBrowse(context));
75578       context.history().clearSaved();
75579       context.flush();
75580       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
75581       osm.switch(isLive ? keys2[0] : keys2[1]);
75582     }
75583     var sourceSwitch = function(selection2) {
75584       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
75585     };
75586     sourceSwitch.keys = function(_3) {
75587       if (!arguments.length) return keys2;
75588       keys2 = _3;
75589       return sourceSwitch;
75590     };
75591     return sourceSwitch;
75592   }
75593   var init_source_switch = __esm({
75594     "modules/ui/source_switch.js"() {
75595       "use strict";
75596       init_src5();
75597       init_localizer();
75598       init_browse();
75599     }
75600   });
75601
75602   // modules/ui/spinner.js
75603   var spinner_exports = {};
75604   __export(spinner_exports, {
75605     uiSpinner: () => uiSpinner
75606   });
75607   function uiSpinner(context) {
75608     var osm = context.connection();
75609     return function(selection2) {
75610       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
75611       if (osm) {
75612         osm.on("loading.spinner", function() {
75613           img.transition().style("opacity", 1);
75614         }).on("loaded.spinner", function() {
75615           img.transition().style("opacity", 0);
75616         });
75617       }
75618     };
75619   }
75620   var init_spinner = __esm({
75621     "modules/ui/spinner.js"() {
75622       "use strict";
75623     }
75624   });
75625
75626   // modules/ui/sections/privacy.js
75627   var privacy_exports = {};
75628   __export(privacy_exports, {
75629     uiSectionPrivacy: () => uiSectionPrivacy
75630   });
75631   function uiSectionPrivacy(context) {
75632     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
75633     function renderDisclosureContent(selection2) {
75634       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
75635       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(
75636         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
75637       );
75638       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
75639         d3_event.preventDefault();
75640         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
75641       });
75642       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
75643       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
75644       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"));
75645     }
75646     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
75647     return section;
75648   }
75649   var init_privacy = __esm({
75650     "modules/ui/sections/privacy.js"() {
75651       "use strict";
75652       init_preferences();
75653       init_localizer();
75654       init_tooltip();
75655       init_icon();
75656       init_section();
75657     }
75658   });
75659
75660   // modules/ui/splash.js
75661   var splash_exports = {};
75662   __export(splash_exports, {
75663     uiSplash: () => uiSplash
75664   });
75665   function uiSplash(context) {
75666     return (selection2) => {
75667       if (context.history().hasRestorableChanges()) return;
75668       let updateMessage = "";
75669       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
75670       let showSplash = !corePreferences("sawSplash");
75671       if (sawPrivacyVersion && sawPrivacyVersion !== context.privacyVersion) {
75672         updateMessage = _t("splash.privacy_update");
75673         showSplash = true;
75674       }
75675       if (!showSplash) return;
75676       corePreferences("sawSplash", true);
75677       corePreferences("sawPrivacyVersion", context.privacyVersion);
75678       _mainFileFetcher.get("intro_graph");
75679       let modalSelection = uiModal(selection2);
75680       modalSelection.select(".modal").attr("class", "modal-splash modal");
75681       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
75682       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
75683       let modalSection = introModal.append("div").attr("class", "modal-section");
75684       modalSection.append("p").html(_t.html("splash.text", {
75685         version: context.version,
75686         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
75687         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
75688       }));
75689       modalSection.append("p").html(_t.html("splash.privacy", {
75690         updateMessage,
75691         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
75692       }));
75693       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
75694       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
75695       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
75696         context.container().call(uiIntro(context));
75697         modalSelection.close();
75698       });
75699       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
75700       walkthrough.append("div").call(_t.append("splash.walkthrough"));
75701       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
75702       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
75703       startEditing.append("div").call(_t.append("splash.start"));
75704       modalSelection.select("button.close").attr("class", "hide");
75705     };
75706   }
75707   var init_splash = __esm({
75708     "modules/ui/splash.js"() {
75709       "use strict";
75710       init_preferences();
75711       init_file_fetcher();
75712       init_localizer();
75713       init_intro2();
75714       init_modal();
75715       init_privacy();
75716     }
75717   });
75718
75719   // modules/ui/status.js
75720   var status_exports = {};
75721   __export(status_exports, {
75722     uiStatus: () => uiStatus
75723   });
75724   function uiStatus(context) {
75725     var osm = context.connection();
75726     return function(selection2) {
75727       if (!osm) return;
75728       function update(err, apiStatus) {
75729         selection2.html("");
75730         if (err) {
75731           if (apiStatus === "connectionSwitched") {
75732             return;
75733           } else if (apiStatus === "rateLimited") {
75734             if (!osm.authenticated()) {
75735               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) {
75736                 d3_event.preventDefault();
75737                 osm.authenticate();
75738               });
75739             } else {
75740               selection2.call(_t.append("osm_api_status.message.rateLimited"));
75741             }
75742           } else {
75743             var throttledRetry = throttle_default(function() {
75744               context.loadTiles(context.projection);
75745               osm.reloadApiStatus();
75746             }, 2e3);
75747             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) {
75748               d3_event.preventDefault();
75749               throttledRetry();
75750             });
75751           }
75752         } else if (apiStatus === "readonly") {
75753           selection2.call(_t.append("osm_api_status.message.readonly"));
75754         } else if (apiStatus === "offline") {
75755           selection2.call(_t.append("osm_api_status.message.offline"));
75756         }
75757         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
75758       }
75759       osm.on("apiStatusChange.uiStatus", update);
75760       context.history().on("storage_error", () => {
75761         selection2.selectAll("span.local-storage-full").remove();
75762         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
75763         selection2.classed("error", true);
75764       });
75765       window.setInterval(function() {
75766         osm.reloadApiStatus();
75767       }, 9e4);
75768       osm.reloadApiStatus();
75769     };
75770   }
75771   var init_status = __esm({
75772     "modules/ui/status.js"() {
75773       "use strict";
75774       init_throttle();
75775       init_localizer();
75776       init_icon();
75777     }
75778   });
75779
75780   // modules/ui/tools/modes.js
75781   var modes_exports = {};
75782   __export(modes_exports, {
75783     uiToolDrawModes: () => uiToolDrawModes
75784   });
75785   function uiToolDrawModes(context) {
75786     var tool = {
75787       id: "old_modes",
75788       label: _t.append("toolbar.add_feature")
75789     };
75790     var modes = [
75791       modeAddPoint(context, {
75792         title: _t.append("modes.add_point.title"),
75793         button: "point",
75794         description: _t.append("modes.add_point.description"),
75795         preset: _mainPresetIndex.item("point"),
75796         key: "1"
75797       }),
75798       modeAddLine(context, {
75799         title: _t.append("modes.add_line.title"),
75800         button: "line",
75801         description: _t.append("modes.add_line.description"),
75802         preset: _mainPresetIndex.item("line"),
75803         key: "2"
75804       }),
75805       modeAddArea(context, {
75806         title: _t.append("modes.add_area.title"),
75807         button: "area",
75808         description: _t.append("modes.add_area.description"),
75809         preset: _mainPresetIndex.item("area"),
75810         key: "3"
75811       })
75812     ];
75813     function enabled(_mode) {
75814       return osmEditable();
75815     }
75816     function osmEditable() {
75817       return context.editable();
75818     }
75819     modes.forEach(function(mode) {
75820       context.keybinding().on(mode.key, function() {
75821         if (!enabled(mode)) return;
75822         if (mode.id === context.mode().id) {
75823           context.enter(modeBrowse(context));
75824         } else {
75825           context.enter(mode);
75826         }
75827       });
75828     });
75829     tool.render = function(selection2) {
75830       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
75831       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
75832       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
75833       context.on("enter.modes", update);
75834       update();
75835       function update() {
75836         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
75837           return d2.id;
75838         });
75839         buttons.exit().remove();
75840         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
75841           return d2.id + " add-button bar-button";
75842         }).on("click.mode-buttons", function(d3_event, d2) {
75843           if (!enabled(d2)) return;
75844           var currMode = context.mode().id;
75845           if (/^draw/.test(currMode)) return;
75846           if (d2.id === currMode) {
75847             context.enter(modeBrowse(context));
75848           } else {
75849             context.enter(d2);
75850           }
75851         }).call(
75852           uiTooltip().placement("bottom").title(function(d2) {
75853             return d2.description;
75854           }).keys(function(d2) {
75855             return [d2.key];
75856           }).scrollContainer(context.container().select(".top-toolbar"))
75857         );
75858         buttonsEnter.each(function(d2) {
75859           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
75860         });
75861         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
75862           mode.title(select_default2(this));
75863         });
75864         if (buttons.enter().size() || buttons.exit().size()) {
75865           context.ui().checkOverflow(".top-toolbar", true);
75866         }
75867         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
75868           return !enabled(d2);
75869         }).classed("disabled", function(d2) {
75870           return !enabled(d2);
75871         }).attr("aria-pressed", function(d2) {
75872           return context.mode() && context.mode().button === d2.button;
75873         }).classed("active", function(d2) {
75874           return context.mode() && context.mode().button === d2.button;
75875         });
75876       }
75877     };
75878     return tool;
75879   }
75880   var init_modes = __esm({
75881     "modules/ui/tools/modes.js"() {
75882       "use strict";
75883       init_debounce();
75884       init_src5();
75885       init_modes2();
75886       init_presets();
75887       init_localizer();
75888       init_svg();
75889       init_tooltip();
75890     }
75891   });
75892
75893   // modules/ui/tools/notes.js
75894   var notes_exports2 = {};
75895   __export(notes_exports2, {
75896     uiToolNotes: () => uiToolNotes
75897   });
75898   function uiToolNotes(context) {
75899     var tool = {
75900       id: "notes",
75901       label: _t.append("modes.add_note.label")
75902     };
75903     var mode = modeAddNote(context);
75904     function enabled() {
75905       return notesEnabled() && notesEditable();
75906     }
75907     function notesEnabled() {
75908       var noteLayer = context.layers().layer("notes");
75909       return noteLayer && noteLayer.enabled();
75910     }
75911     function notesEditable() {
75912       var mode2 = context.mode();
75913       return context.map().notesEditable() && mode2 && mode2.id !== "save";
75914     }
75915     context.keybinding().on(mode.key, function() {
75916       if (!enabled()) return;
75917       if (mode.id === context.mode().id) {
75918         context.enter(modeBrowse(context));
75919       } else {
75920         context.enter(mode);
75921       }
75922     });
75923     tool.render = function(selection2) {
75924       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
75925       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
75926       context.on("enter.notes", update);
75927       update();
75928       function update() {
75929         var showNotes = notesEnabled();
75930         var data = showNotes ? [mode] : [];
75931         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
75932           return d2.id;
75933         });
75934         buttons.exit().remove();
75935         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
75936           return d2.id + " add-button bar-button";
75937         }).on("click.notes", function(d3_event, d2) {
75938           if (!enabled()) return;
75939           var currMode = context.mode().id;
75940           if (/^draw/.test(currMode)) return;
75941           if (d2.id === currMode) {
75942             context.enter(modeBrowse(context));
75943           } else {
75944             context.enter(d2);
75945           }
75946         }).call(
75947           uiTooltip().placement("bottom").title(function(d2) {
75948             return d2.description;
75949           }).keys(function(d2) {
75950             return [d2.key];
75951           }).scrollContainer(context.container().select(".top-toolbar"))
75952         );
75953         buttonsEnter.each(function(d2) {
75954           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
75955         });
75956         if (buttons.enter().size() || buttons.exit().size()) {
75957           context.ui().checkOverflow(".top-toolbar", true);
75958         }
75959         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
75960           return !enabled();
75961         }).attr("aria-disabled", function() {
75962           return !enabled();
75963         }).classed("active", function(d2) {
75964           return context.mode() && context.mode().button === d2.button;
75965         }).attr("aria-pressed", function(d2) {
75966           return context.mode() && context.mode().button === d2.button;
75967         });
75968       }
75969     };
75970     tool.uninstall = function() {
75971       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
75972       context.map().on("move.notes", null).on("drawn.notes", null);
75973     };
75974     return tool;
75975   }
75976   var init_notes2 = __esm({
75977     "modules/ui/tools/notes.js"() {
75978       "use strict";
75979       init_debounce();
75980       init_src5();
75981       init_modes2();
75982       init_localizer();
75983       init_svg();
75984       init_tooltip();
75985     }
75986   });
75987
75988   // modules/ui/tools/save.js
75989   var save_exports = {};
75990   __export(save_exports, {
75991     uiToolSave: () => uiToolSave
75992   });
75993   function uiToolSave(context) {
75994     var tool = {
75995       id: "save",
75996       label: _t.append("save.title")
75997     };
75998     var button = null;
75999     var tooltipBehavior = null;
76000     var history = context.history();
76001     var key = uiCmd("\u2318S");
76002     var _numChanges = 0;
76003     function isSaving() {
76004       var mode = context.mode();
76005       return mode && mode.id === "save";
76006     }
76007     function isDisabled() {
76008       return _numChanges === 0 || isSaving();
76009     }
76010     function save(d3_event) {
76011       d3_event.preventDefault();
76012       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
76013         context.enter(modeSave(context));
76014       }
76015     }
76016     function bgColor(numChanges) {
76017       var step;
76018       if (numChanges === 0) {
76019         return null;
76020       } else if (numChanges <= 50) {
76021         step = numChanges / 50;
76022         return rgb_default("#fff", "#ff8")(step);
76023       } else {
76024         step = Math.min((numChanges - 50) / 50, 1);
76025         return rgb_default("#ff8", "#f88")(step);
76026       }
76027     }
76028     function updateCount() {
76029       var val = history.difference().summary().length;
76030       if (val === _numChanges) return;
76031       _numChanges = val;
76032       if (tooltipBehavior) {
76033         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
76034       }
76035       if (button) {
76036         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
76037         button.select("span.count").text(_numChanges);
76038       }
76039     }
76040     tool.render = function(selection2) {
76041       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
76042       var lastPointerUpType;
76043       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
76044         lastPointerUpType = d3_event.pointerType;
76045       }).on("click", function(d3_event) {
76046         save(d3_event);
76047         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
76048           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
76049         }
76050         lastPointerUpType = null;
76051       }).call(tooltipBehavior);
76052       button.call(svgIcon("#iD-icon-save"));
76053       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
76054       updateCount();
76055       context.keybinding().on(key, save, true);
76056       context.history().on("change.save", updateCount);
76057       context.on("enter.save", function() {
76058         if (button) {
76059           button.classed("disabled", isDisabled());
76060           if (isSaving()) {
76061             button.call(tooltipBehavior.hide);
76062           }
76063         }
76064       });
76065     };
76066     tool.uninstall = function() {
76067       context.keybinding().off(key, true);
76068       context.history().on("change.save", null);
76069       context.on("enter.save", null);
76070       button = null;
76071       tooltipBehavior = null;
76072     };
76073     return tool;
76074   }
76075   var init_save = __esm({
76076     "modules/ui/tools/save.js"() {
76077       "use strict";
76078       init_src8();
76079       init_localizer();
76080       init_modes2();
76081       init_svg();
76082       init_cmd();
76083       init_tooltip();
76084     }
76085   });
76086
76087   // modules/ui/tools/sidebar_toggle.js
76088   var sidebar_toggle_exports = {};
76089   __export(sidebar_toggle_exports, {
76090     uiToolSidebarToggle: () => uiToolSidebarToggle
76091   });
76092   function uiToolSidebarToggle(context) {
76093     var tool = {
76094       id: "sidebar_toggle",
76095       label: _t.append("toolbar.inspect")
76096     };
76097     tool.render = function(selection2) {
76098       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
76099         context.ui().sidebar.toggle();
76100       }).call(
76101         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
76102       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
76103     };
76104     return tool;
76105   }
76106   var init_sidebar_toggle = __esm({
76107     "modules/ui/tools/sidebar_toggle.js"() {
76108       "use strict";
76109       init_localizer();
76110       init_svg();
76111       init_tooltip();
76112     }
76113   });
76114
76115   // modules/ui/tools/undo_redo.js
76116   var undo_redo_exports = {};
76117   __export(undo_redo_exports, {
76118     uiToolUndoRedo: () => uiToolUndoRedo
76119   });
76120   function uiToolUndoRedo(context) {
76121     var tool = {
76122       id: "undo_redo",
76123       label: _t.append("toolbar.undo_redo")
76124     };
76125     var commands = [{
76126       id: "undo",
76127       cmd: uiCmd("\u2318Z"),
76128       action: function() {
76129         context.undo();
76130       },
76131       annotation: function() {
76132         return context.history().undoAnnotation();
76133       },
76134       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
76135     }, {
76136       id: "redo",
76137       cmd: uiCmd("\u2318\u21E7Z"),
76138       action: function() {
76139         context.redo();
76140       },
76141       annotation: function() {
76142         return context.history().redoAnnotation();
76143       },
76144       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
76145     }];
76146     function editable() {
76147       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
76148         true
76149         /* ignore min zoom */
76150       );
76151     }
76152     tool.render = function(selection2) {
76153       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
76154         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
76155       }).keys(function(d2) {
76156         return [d2.cmd];
76157       }).scrollContainer(context.container().select(".top-toolbar"));
76158       var lastPointerUpType;
76159       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
76160         return "disabled " + d2.id + "-button bar-button";
76161       }).on("pointerup", function(d3_event) {
76162         lastPointerUpType = d3_event.pointerType;
76163       }).on("click", function(d3_event, d2) {
76164         d3_event.preventDefault();
76165         var annotation = d2.annotation();
76166         if (editable() && annotation) {
76167           d2.action();
76168         }
76169         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
76170           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
76171           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
76172         }
76173         lastPointerUpType = null;
76174       }).call(tooltipBehavior);
76175       buttons.each(function(d2) {
76176         select_default2(this).call(svgIcon("#" + d2.icon));
76177       });
76178       context.keybinding().on(commands[0].cmd, function(d3_event) {
76179         d3_event.preventDefault();
76180         if (editable()) commands[0].action();
76181       }).on(commands[1].cmd, function(d3_event) {
76182         d3_event.preventDefault();
76183         if (editable()) commands[1].action();
76184       });
76185       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
76186       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
76187       context.history().on("change.undo_redo", function(difference2) {
76188         if (difference2) update();
76189       });
76190       context.on("enter.undo_redo", update);
76191       function update() {
76192         buttons.classed("disabled", function(d2) {
76193           return !editable() || !d2.annotation();
76194         }).each(function() {
76195           var selection3 = select_default2(this);
76196           if (!selection3.select(".tooltip.in").empty()) {
76197             selection3.call(tooltipBehavior.updateContent);
76198           }
76199         });
76200       }
76201     };
76202     tool.uninstall = function() {
76203       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
76204       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
76205       context.history().on("change.undo_redo", null);
76206       context.on("enter.undo_redo", null);
76207     };
76208     return tool;
76209   }
76210   var init_undo_redo = __esm({
76211     "modules/ui/tools/undo_redo.js"() {
76212       "use strict";
76213       init_debounce();
76214       init_src5();
76215       init_localizer();
76216       init_svg();
76217       init_cmd();
76218       init_tooltip();
76219     }
76220   });
76221
76222   // modules/ui/tools/index.js
76223   var tools_exports = {};
76224   __export(tools_exports, {
76225     uiToolDrawModes: () => uiToolDrawModes,
76226     uiToolNotes: () => uiToolNotes,
76227     uiToolSave: () => uiToolSave,
76228     uiToolSidebarToggle: () => uiToolSidebarToggle,
76229     uiToolUndoRedo: () => uiToolUndoRedo
76230   });
76231   var init_tools = __esm({
76232     "modules/ui/tools/index.js"() {
76233       "use strict";
76234       init_modes();
76235       init_notes2();
76236       init_save();
76237       init_sidebar_toggle();
76238       init_undo_redo();
76239     }
76240   });
76241
76242   // modules/ui/top_toolbar.js
76243   var top_toolbar_exports = {};
76244   __export(top_toolbar_exports, {
76245     uiTopToolbar: () => uiTopToolbar
76246   });
76247   function uiTopToolbar(context) {
76248     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
76249     function notesEnabled() {
76250       var noteLayer = context.layers().layer("notes");
76251       return noteLayer && noteLayer.enabled();
76252     }
76253     function topToolbar(bar) {
76254       bar.on("wheel.topToolbar", function(d3_event) {
76255         if (!d3_event.deltaX) {
76256           bar.node().scrollLeft += d3_event.deltaY;
76257         }
76258       });
76259       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
76260       context.layers().on("change.topToolbar", debouncedUpdate);
76261       update();
76262       function update() {
76263         var tools = [
76264           sidebarToggle,
76265           "spacer",
76266           modes
76267         ];
76268         tools.push("spacer");
76269         if (notesEnabled()) {
76270           tools = tools.concat([notes, "spacer"]);
76271         }
76272         tools = tools.concat([undoRedo, save]);
76273         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
76274           return d2.id || d2;
76275         });
76276         toolbarItems.exit().each(function(d2) {
76277           if (d2.uninstall) {
76278             d2.uninstall();
76279           }
76280         }).remove();
76281         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
76282           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
76283           if (d2.klass) classes += " " + d2.klass;
76284           return classes;
76285         });
76286         var actionableItems = itemsEnter.filter(function(d2) {
76287           return d2 !== "spacer";
76288         });
76289         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
76290           select_default2(this).call(d2.render, bar);
76291         });
76292         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
76293           d2.label(select_default2(this));
76294         });
76295       }
76296     }
76297     return topToolbar;
76298   }
76299   var init_top_toolbar = __esm({
76300     "modules/ui/top_toolbar.js"() {
76301       "use strict";
76302       init_src5();
76303       init_debounce();
76304       init_tools();
76305     }
76306   });
76307
76308   // modules/ui/version.js
76309   var version_exports = {};
76310   __export(version_exports, {
76311     uiVersion: () => uiVersion
76312   });
76313   function uiVersion(context) {
76314     var currVersion = context.version;
76315     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
76316     if (sawVersion === null && matchedVersion !== null) {
76317       if (corePreferences("sawVersion")) {
76318         isNewUser = false;
76319         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
76320       } else {
76321         isNewUser = true;
76322         isNewVersion = true;
76323       }
76324       corePreferences("sawVersion", currVersion);
76325       sawVersion = currVersion;
76326     }
76327     return function(selection2) {
76328       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
76329       if (isNewVersion && !isNewUser) {
76330         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(
76331           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
76332         );
76333       }
76334     };
76335   }
76336   var sawVersion, isNewVersion, isNewUser;
76337   var init_version = __esm({
76338     "modules/ui/version.js"() {
76339       "use strict";
76340       init_preferences();
76341       init_localizer();
76342       init_icon();
76343       init_tooltip();
76344       sawVersion = null;
76345       isNewVersion = false;
76346       isNewUser = false;
76347     }
76348   });
76349
76350   // modules/ui/zoom.js
76351   var zoom_exports = {};
76352   __export(zoom_exports, {
76353     uiZoom: () => uiZoom
76354   });
76355   function uiZoom(context) {
76356     var zooms = [{
76357       id: "zoom-in",
76358       icon: "iD-icon-plus",
76359       title: _t.append("zoom.in"),
76360       action: zoomIn,
76361       disabled: function() {
76362         return !context.map().canZoomIn();
76363       },
76364       disabledTitle: _t.append("zoom.disabled.in"),
76365       key: "+"
76366     }, {
76367       id: "zoom-out",
76368       icon: "iD-icon-minus",
76369       title: _t.append("zoom.out"),
76370       action: zoomOut,
76371       disabled: function() {
76372         return !context.map().canZoomOut();
76373       },
76374       disabledTitle: _t.append("zoom.disabled.out"),
76375       key: "-"
76376     }];
76377     function zoomIn(d3_event) {
76378       if (d3_event.shiftKey) return;
76379       d3_event.preventDefault();
76380       context.map().zoomIn();
76381     }
76382     function zoomOut(d3_event) {
76383       if (d3_event.shiftKey) return;
76384       d3_event.preventDefault();
76385       context.map().zoomOut();
76386     }
76387     function zoomInFurther(d3_event) {
76388       if (d3_event.shiftKey) return;
76389       d3_event.preventDefault();
76390       context.map().zoomInFurther();
76391     }
76392     function zoomOutFurther(d3_event) {
76393       if (d3_event.shiftKey) return;
76394       d3_event.preventDefault();
76395       context.map().zoomOutFurther();
76396     }
76397     return function(selection2) {
76398       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
76399         if (d2.disabled()) {
76400           return d2.disabledTitle;
76401         }
76402         return d2.title;
76403       }).keys(function(d2) {
76404         return [d2.key];
76405       });
76406       var lastPointerUpType;
76407       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
76408         return d2.id;
76409       }).on("pointerup.editor", function(d3_event) {
76410         lastPointerUpType = d3_event.pointerType;
76411       }).on("click.editor", function(d3_event, d2) {
76412         if (!d2.disabled()) {
76413           d2.action(d3_event);
76414         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
76415           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
76416         }
76417         lastPointerUpType = null;
76418       }).call(tooltipBehavior);
76419       buttons.each(function(d2) {
76420         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
76421       });
76422       utilKeybinding.plusKeys.forEach(function(key) {
76423         context.keybinding().on([key], zoomIn);
76424         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
76425       });
76426       utilKeybinding.minusKeys.forEach(function(key) {
76427         context.keybinding().on([key], zoomOut);
76428         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
76429       });
76430       function updateButtonStates() {
76431         buttons.classed("disabled", function(d2) {
76432           return d2.disabled();
76433         }).each(function() {
76434           var selection3 = select_default2(this);
76435           if (!selection3.select(".tooltip.in").empty()) {
76436             selection3.call(tooltipBehavior.updateContent);
76437           }
76438         });
76439       }
76440       updateButtonStates();
76441       context.map().on("move.uiZoom", updateButtonStates);
76442     };
76443   }
76444   var init_zoom3 = __esm({
76445     "modules/ui/zoom.js"() {
76446       "use strict";
76447       init_src5();
76448       init_localizer();
76449       init_icon();
76450       init_cmd();
76451       init_tooltip();
76452       init_keybinding();
76453     }
76454   });
76455
76456   // modules/ui/zoom_to_selection.js
76457   var zoom_to_selection_exports = {};
76458   __export(zoom_to_selection_exports, {
76459     uiZoomToSelection: () => uiZoomToSelection
76460   });
76461   function uiZoomToSelection(context) {
76462     function isDisabled() {
76463       var mode = context.mode();
76464       return !mode || !mode.zoomToSelected;
76465     }
76466     var _lastPointerUpType;
76467     function pointerup(d3_event) {
76468       _lastPointerUpType = d3_event.pointerType;
76469     }
76470     function click(d3_event) {
76471       d3_event.preventDefault();
76472       if (isDisabled()) {
76473         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
76474           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
76475         }
76476       } else {
76477         var mode = context.mode();
76478         if (mode && mode.zoomToSelected) {
76479           mode.zoomToSelected();
76480         }
76481       }
76482       _lastPointerUpType = null;
76483     }
76484     return function(selection2) {
76485       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
76486         if (isDisabled()) {
76487           return _t.append("inspector.zoom_to.no_selection");
76488         }
76489         return _t.append("inspector.zoom_to.title");
76490       }).keys([_t("inspector.zoom_to.key")]);
76491       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
76492       function setEnabledState() {
76493         button.classed("disabled", isDisabled());
76494         if (!button.select(".tooltip.in").empty()) {
76495           button.call(tooltipBehavior.updateContent);
76496         }
76497       }
76498       context.on("enter.uiZoomToSelection", setEnabledState);
76499       setEnabledState();
76500     };
76501   }
76502   var init_zoom_to_selection = __esm({
76503     "modules/ui/zoom_to_selection.js"() {
76504       "use strict";
76505       init_localizer();
76506       init_tooltip();
76507       init_icon();
76508     }
76509   });
76510
76511   // modules/ui/pane.js
76512   var pane_exports = {};
76513   __export(pane_exports, {
76514     uiPane: () => uiPane
76515   });
76516   function uiPane(id2, context) {
76517     var _key;
76518     var _label = "";
76519     var _description = "";
76520     var _iconName = "";
76521     var _sections;
76522     var _paneSelection = select_default2(null);
76523     var _paneTooltip;
76524     var pane = {
76525       id: id2
76526     };
76527     pane.label = function(val) {
76528       if (!arguments.length) return _label;
76529       _label = val;
76530       return pane;
76531     };
76532     pane.key = function(val) {
76533       if (!arguments.length) return _key;
76534       _key = val;
76535       return pane;
76536     };
76537     pane.description = function(val) {
76538       if (!arguments.length) return _description;
76539       _description = val;
76540       return pane;
76541     };
76542     pane.iconName = function(val) {
76543       if (!arguments.length) return _iconName;
76544       _iconName = val;
76545       return pane;
76546     };
76547     pane.sections = function(val) {
76548       if (!arguments.length) return _sections;
76549       _sections = val;
76550       return pane;
76551     };
76552     pane.selection = function() {
76553       return _paneSelection;
76554     };
76555     function hidePane() {
76556       context.ui().togglePanes();
76557     }
76558     pane.togglePane = function(d3_event) {
76559       if (d3_event) d3_event.preventDefault();
76560       _paneTooltip.hide();
76561       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
76562     };
76563     pane.renderToggleButton = function(selection2) {
76564       if (!_paneTooltip) {
76565         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
76566       }
76567       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
76568     };
76569     pane.renderContent = function(selection2) {
76570       if (_sections) {
76571         _sections.forEach(function(section) {
76572           selection2.call(section.render);
76573         });
76574       }
76575     };
76576     pane.renderPane = function(selection2) {
76577       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
76578       var heading = _paneSelection.append("div").attr("class", "pane-heading");
76579       heading.append("h2").text("").call(_label);
76580       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
76581       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
76582       if (_key) {
76583         context.keybinding().on(_key, pane.togglePane);
76584       }
76585     };
76586     return pane;
76587   }
76588   var init_pane = __esm({
76589     "modules/ui/pane.js"() {
76590       "use strict";
76591       init_src5();
76592       init_icon();
76593       init_localizer();
76594       init_tooltip();
76595     }
76596   });
76597
76598   // modules/ui/sections/background_display_options.js
76599   var background_display_options_exports = {};
76600   __export(background_display_options_exports, {
76601     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions
76602   });
76603   function uiSectionBackgroundDisplayOptions(context) {
76604     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
76605     var _storedOpacity = corePreferences("background-opacity");
76606     var _minVal = 0;
76607     var _maxVal = 3;
76608     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
76609     var _options = {
76610       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
76611       contrast: 1,
76612       saturation: 1,
76613       sharpness: 1
76614     };
76615     function updateValue(d2, val) {
76616       val = clamp_default(val, _minVal, _maxVal);
76617       _options[d2] = val;
76618       context.background()[d2](val);
76619       if (d2 === "brightness") {
76620         corePreferences("background-opacity", val);
76621       }
76622       section.reRender();
76623     }
76624     function renderDisclosureContent(selection2) {
76625       var container = selection2.selectAll(".display-options-container").data([0]);
76626       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
76627       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
76628         return "display-control display-control-" + d2;
76629       });
76630       slidersEnter.html(function(d2) {
76631         return _t.html("background." + d2);
76632       }).append("span").attr("class", function(d2) {
76633         return "display-option-value display-option-value-" + d2;
76634       });
76635       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
76636       sildersControlEnter.append("input").attr("class", function(d2) {
76637         return "display-option-input display-option-input-" + d2;
76638       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.01").on("input", function(d3_event, d2) {
76639         var val = select_default2(this).property("value");
76640         if (!val && d3_event && d3_event.target) {
76641           val = d3_event.target.value;
76642         }
76643         updateValue(d2, val);
76644       });
76645       sildersControlEnter.append("button").attr("title", function(d2) {
76646         return `${_t("background.reset")} ${_t("background." + d2)}`;
76647       }).attr("class", function(d2) {
76648         return "display-option-reset display-option-reset-" + d2;
76649       }).on("click", function(d3_event, d2) {
76650         if (d3_event.button !== 0) return;
76651         updateValue(d2, 1);
76652       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
76653       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
76654         d3_event.preventDefault();
76655         for (var i3 = 0; i3 < _sliders.length; i3++) {
76656           updateValue(_sliders[i3], 1);
76657         }
76658       });
76659       container = containerEnter.merge(container);
76660       container.selectAll(".display-option-input").property("value", function(d2) {
76661         return _options[d2];
76662       });
76663       container.selectAll(".display-option-value").text(function(d2) {
76664         return Math.floor(_options[d2] * 100) + "%";
76665       });
76666       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
76667         return _options[d2] === 1;
76668       });
76669       if (containerEnter.size() && _options.brightness !== 1) {
76670         context.background().brightness(_options.brightness);
76671       }
76672     }
76673     return section;
76674   }
76675   var init_background_display_options = __esm({
76676     "modules/ui/sections/background_display_options.js"() {
76677       "use strict";
76678       init_src5();
76679       init_lodash();
76680       init_preferences();
76681       init_localizer();
76682       init_icon();
76683       init_section();
76684     }
76685   });
76686
76687   // modules/ui/settings/custom_background.js
76688   var custom_background_exports = {};
76689   __export(custom_background_exports, {
76690     uiSettingsCustomBackground: () => uiSettingsCustomBackground
76691   });
76692   function uiSettingsCustomBackground() {
76693     var dispatch14 = dispatch_default("change");
76694     function render(selection2) {
76695       var _origSettings = {
76696         template: corePreferences("background-custom-template")
76697       };
76698       var _currSettings = {
76699         template: corePreferences("background-custom-template")
76700       };
76701       var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
76702       var modal = uiConfirm(selection2).okButton();
76703       modal.classed("settings-modal settings-custom-background", true);
76704       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
76705       var textSection = modal.select(".modal-section.message-text");
76706       var instructions = `${_t.html("settings.custom_background.instructions.info")}
76707
76708 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
76709 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
76710 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
76711 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
76712 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
76713
76714 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
76715 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
76716 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
76717 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
76718 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
76719 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
76720
76721 #### ${_t.html("settings.custom_background.instructions.example")}
76722 \`${example}\``;
76723       textSection.append("div").attr("class", "instructions-template").html(k(instructions));
76724       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
76725       var buttonSection = modal.select(".modal-section.buttons");
76726       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
76727       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
76728       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
76729       function isSaveDisabled() {
76730         return null;
76731       }
76732       function clickCancel() {
76733         textSection.select(".field-template").property("value", _origSettings.template);
76734         corePreferences("background-custom-template", _origSettings.template);
76735         this.blur();
76736         modal.close();
76737       }
76738       function clickSave() {
76739         _currSettings.template = textSection.select(".field-template").property("value");
76740         corePreferences("background-custom-template", _currSettings.template);
76741         this.blur();
76742         modal.close();
76743         dispatch14.call("change", this, _currSettings);
76744       }
76745     }
76746     return utilRebind(render, dispatch14, "on");
76747   }
76748   var init_custom_background = __esm({
76749     "modules/ui/settings/custom_background.js"() {
76750       "use strict";
76751       init_src4();
76752       init_marked_esm();
76753       init_preferences();
76754       init_localizer();
76755       init_confirm();
76756       init_util();
76757     }
76758   });
76759
76760   // modules/ui/sections/background_list.js
76761   var background_list_exports = {};
76762   __export(background_list_exports, {
76763     uiSectionBackgroundList: () => uiSectionBackgroundList
76764   });
76765   function uiSectionBackgroundList(context) {
76766     var _backgroundList = select_default2(null);
76767     var _customSource = context.background().findSource("custom");
76768     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
76769     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
76770     function previousBackgroundID() {
76771       return corePreferences("background-last-used-toggle");
76772     }
76773     function renderDisclosureContent(selection2) {
76774       var container = selection2.selectAll(".layer-background-list").data([0]);
76775       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
76776       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
76777       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
76778         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
76779       );
76780       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76781         d3_event.preventDefault();
76782         uiMapInMap.toggle();
76783       });
76784       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
76785       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
76786         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
76787       );
76788       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76789         d3_event.preventDefault();
76790         context.ui().info.toggle("background");
76791       });
76792       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
76793       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
76794         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
76795       );
76796       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76797         d3_event.preventDefault();
76798         context.ui().info.toggle("location");
76799       });
76800       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
76801       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"));
76802       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
76803         chooseBackground(d2);
76804       }, function(d2) {
76805         return !d2.isHidden() && !d2.overlay;
76806       });
76807     }
76808     function setTooltips(selection2) {
76809       selection2.each(function(d2, i3, nodes) {
76810         var item = select_default2(this).select("label");
76811         var span = item.select("span");
76812         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
76813         var hasDescription = d2.hasDescription();
76814         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
76815         item.call(uiTooltip().destroyAny);
76816         if (d2.id === previousBackgroundID()) {
76817           item.call(
76818             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
76819           );
76820         } else if (hasDescription || isOverflowing) {
76821           item.call(
76822             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
76823           );
76824         }
76825       });
76826     }
76827     function drawListItems(layerList, type2, change, filter2) {
76828       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a4, b3) {
76829         return a4.best() && !b3.best() ? -1 : b3.best() && !a4.best() ? 1 : descending(a4.area(), b3.area()) || ascending(a4.name(), b3.name()) || 0;
76830       });
76831       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
76832         return d2.id + "---" + i3;
76833       });
76834       layerLinks.exit().remove();
76835       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
76836         return d2.id === "custom";
76837       }).classed("best", function(d2) {
76838         return d2.best();
76839       });
76840       var label = enter.append("label");
76841       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
76842         return d2.id;
76843       }).on("change", change);
76844       label.append("span").each(function(d2) {
76845         d2.label()(select_default2(this));
76846       });
76847       enter.filter(function(d2) {
76848         return d2.id === "custom";
76849       }).append("button").attr("class", "layer-browse").call(
76850         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76851       ).on("click", function(d3_event) {
76852         d3_event.preventDefault();
76853         editCustom();
76854       }).call(svgIcon("#iD-icon-more"));
76855       enter.filter(function(d2) {
76856         return d2.best();
76857       }).append("div").attr("class", "best").call(
76858         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76859       ).append("span").text("\u2605");
76860       layerList.call(updateLayerSelections);
76861     }
76862     function updateLayerSelections(selection2) {
76863       function active(d2) {
76864         return context.background().showsLayer(d2);
76865       }
76866       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
76867         return d2.id === previousBackgroundID();
76868       }).call(setTooltips).selectAll("input").property("checked", active);
76869     }
76870     function chooseBackground(d2) {
76871       if (d2.id === "custom" && !d2.template()) {
76872         return editCustom();
76873       }
76874       var previousBackground = context.background().baseLayerSource();
76875       corePreferences("background-last-used-toggle", previousBackground.id);
76876       corePreferences("background-last-used", d2.id);
76877       context.background().baseLayerSource(d2);
76878     }
76879     function customChanged(d2) {
76880       if (d2 && d2.template) {
76881         _customSource.template(d2.template);
76882         chooseBackground(_customSource);
76883       } else {
76884         _customSource.template("");
76885         chooseBackground(context.background().findSource("none"));
76886       }
76887     }
76888     function editCustom() {
76889       context.container().call(_settingsCustomBackground);
76890     }
76891     context.background().on("change.background_list", function() {
76892       _backgroundList.call(updateLayerSelections);
76893     });
76894     context.map().on(
76895       "move.background_list",
76896       debounce_default(function() {
76897         window.requestIdleCallback(section.reRender);
76898       }, 1e3)
76899     );
76900     return section;
76901   }
76902   var init_background_list = __esm({
76903     "modules/ui/sections/background_list.js"() {
76904       "use strict";
76905       init_debounce();
76906       init_src();
76907       init_src5();
76908       init_preferences();
76909       init_localizer();
76910       init_tooltip();
76911       init_icon();
76912       init_cmd();
76913       init_custom_background();
76914       init_map_in_map();
76915       init_section();
76916     }
76917   });
76918
76919   // modules/ui/sections/background_offset.js
76920   var background_offset_exports = {};
76921   __export(background_offset_exports, {
76922     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset
76923   });
76924   function uiSectionBackgroundOffset(context) {
76925     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
76926     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
76927     var _directions = [
76928       ["top", [0, -0.5]],
76929       ["left", [-0.5, 0]],
76930       ["right", [0.5, 0]],
76931       ["bottom", [0, 0.5]]
76932     ];
76933     function updateValue() {
76934       var meters = geoOffsetToMeters(context.background().offset());
76935       var x2 = +meters[0].toFixed(2);
76936       var y2 = +meters[1].toFixed(2);
76937       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
76938       context.container().selectAll(".nudge-reset").classed("disabled", function() {
76939         return x2 === 0 && y2 === 0;
76940       });
76941     }
76942     function resetOffset() {
76943       context.background().offset([0, 0]);
76944       updateValue();
76945     }
76946     function nudge(d2) {
76947       context.background().nudge(d2, context.map().zoom());
76948       updateValue();
76949     }
76950     function inputOffset() {
76951       var input = select_default2(this);
76952       var d2 = input.node().value;
76953       if (d2 === "") return resetOffset();
76954       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
76955         return !isNaN(n3) && n3;
76956       });
76957       if (d2.length !== 2 || !d2[0] || !d2[1]) {
76958         input.classed("error", true);
76959         return;
76960       }
76961       context.background().offset(geoMetersToOffset(d2));
76962       updateValue();
76963     }
76964     function dragOffset(d3_event) {
76965       if (d3_event.button !== 0) return;
76966       var origin = [d3_event.clientX, d3_event.clientY];
76967       var pointerId = d3_event.pointerId || "mouse";
76968       context.container().append("div").attr("class", "nudge-surface");
76969       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
76970       if (_pointerPrefix === "pointer") {
76971         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
76972       }
76973       function pointermove(d3_event2) {
76974         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
76975         var latest = [d3_event2.clientX, d3_event2.clientY];
76976         var d2 = [
76977           -(origin[0] - latest[0]) / 4,
76978           -(origin[1] - latest[1]) / 4
76979         ];
76980         origin = latest;
76981         nudge(d2);
76982       }
76983       function pointerup(d3_event2) {
76984         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
76985         if (d3_event2.button !== 0) return;
76986         context.container().selectAll(".nudge-surface").remove();
76987         select_default2(window).on(".drag-bg-offset", null);
76988       }
76989     }
76990     function renderDisclosureContent(selection2) {
76991       var container = selection2.selectAll(".nudge-container").data([0]);
76992       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
76993       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
76994       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
76995       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
76996       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
76997       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
76998         return _t(`background.nudge.${d2[0]}`);
76999       }).attr("class", function(d2) {
77000         return d2[0] + " nudge";
77001       }).on("click", function(d3_event, d2) {
77002         nudge(d2[1]);
77003       });
77004       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
77005         d3_event.preventDefault();
77006         resetOffset();
77007       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
77008       updateValue();
77009     }
77010     context.background().on("change.backgroundOffset-update", updateValue);
77011     return section;
77012   }
77013   var init_background_offset = __esm({
77014     "modules/ui/sections/background_offset.js"() {
77015       "use strict";
77016       init_src5();
77017       init_localizer();
77018       init_geo2();
77019       init_icon();
77020       init_section();
77021     }
77022   });
77023
77024   // modules/ui/sections/overlay_list.js
77025   var overlay_list_exports = {};
77026   __export(overlay_list_exports, {
77027     uiSectionOverlayList: () => uiSectionOverlayList
77028   });
77029   function uiSectionOverlayList(context) {
77030     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
77031     var _overlayList = select_default2(null);
77032     function setTooltips(selection2) {
77033       selection2.each(function(d2, i3, nodes) {
77034         var item = select_default2(this).select("label");
77035         var span = item.select("span");
77036         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
77037         var description = d2.description();
77038         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
77039         item.call(uiTooltip().destroyAny);
77040         if (description || isOverflowing) {
77041           item.call(
77042             uiTooltip().placement(placement).title(() => description || d2.name())
77043           );
77044         }
77045       });
77046     }
77047     function updateLayerSelections(selection2) {
77048       function active(d2) {
77049         return context.background().showsLayer(d2);
77050       }
77051       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
77052     }
77053     function chooseOverlay(d3_event, d2) {
77054       d3_event.preventDefault();
77055       context.background().toggleOverlayLayer(d2);
77056       _overlayList.call(updateLayerSelections);
77057       document.activeElement.blur();
77058     }
77059     function drawListItems(layerList, type2, change, filter2) {
77060       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
77061       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
77062         return d2.name();
77063       });
77064       layerLinks.exit().remove();
77065       var enter = layerLinks.enter().append("li");
77066       var label = enter.append("label");
77067       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
77068       label.append("span").each(function(d2) {
77069         d2.label()(select_default2(this));
77070       });
77071       layerList.selectAll("li").sort(sortSources);
77072       layerList.call(updateLayerSelections);
77073       function sortSources(a4, b3) {
77074         return a4.best() && !b3.best() ? -1 : b3.best() && !a4.best() ? 1 : descending(a4.area(), b3.area()) || ascending(a4.name(), b3.name()) || 0;
77075       }
77076     }
77077     function renderDisclosureContent(selection2) {
77078       var container = selection2.selectAll(".layer-overlay-list").data([0]);
77079       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
77080       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
77081         return !d2.isHidden() && d2.overlay;
77082       });
77083     }
77084     context.map().on(
77085       "move.overlay_list",
77086       debounce_default(function() {
77087         window.requestIdleCallback(section.reRender);
77088       }, 1e3)
77089     );
77090     return section;
77091   }
77092   var init_overlay_list = __esm({
77093     "modules/ui/sections/overlay_list.js"() {
77094       "use strict";
77095       init_debounce();
77096       init_src();
77097       init_src5();
77098       init_localizer();
77099       init_tooltip();
77100       init_section();
77101     }
77102   });
77103
77104   // modules/ui/panes/background.js
77105   var background_exports3 = {};
77106   __export(background_exports3, {
77107     uiPaneBackground: () => uiPaneBackground
77108   });
77109   function uiPaneBackground(context) {
77110     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
77111       uiSectionBackgroundList(context),
77112       uiSectionOverlayList(context),
77113       uiSectionBackgroundDisplayOptions(context),
77114       uiSectionBackgroundOffset(context)
77115     ]);
77116     return backgroundPane;
77117   }
77118   var init_background3 = __esm({
77119     "modules/ui/panes/background.js"() {
77120       "use strict";
77121       init_localizer();
77122       init_pane();
77123       init_background_display_options();
77124       init_background_list();
77125       init_background_offset();
77126       init_overlay_list();
77127     }
77128   });
77129
77130   // modules/ui/panes/help.js
77131   var help_exports = {};
77132   __export(help_exports, {
77133     uiPaneHelp: () => uiPaneHelp
77134   });
77135   function uiPaneHelp(context) {
77136     var docKeys = [
77137       ["help", [
77138         "welcome",
77139         "open_data_h",
77140         "open_data",
77141         "before_start_h",
77142         "before_start",
77143         "open_source_h",
77144         "open_source",
77145         "open_source_attribution",
77146         "open_source_help"
77147       ]],
77148       ["overview", [
77149         "navigation_h",
77150         "navigation_drag",
77151         "navigation_zoom",
77152         "features_h",
77153         "features",
77154         "nodes_ways"
77155       ]],
77156       ["editing", [
77157         "select_h",
77158         "select_left_click",
77159         "select_right_click",
77160         "select_space",
77161         "multiselect_h",
77162         "multiselect",
77163         "multiselect_shift_click",
77164         "multiselect_lasso",
77165         "undo_redo_h",
77166         "undo_redo",
77167         "save_h",
77168         "save",
77169         "save_validation",
77170         "upload_h",
77171         "upload",
77172         "backups_h",
77173         "backups",
77174         "keyboard_h",
77175         "keyboard"
77176       ]],
77177       ["feature_editor", [
77178         "intro",
77179         "definitions",
77180         "type_h",
77181         "type",
77182         "type_picker",
77183         "fields_h",
77184         "fields_all_fields",
77185         "fields_example",
77186         "fields_add_field",
77187         "tags_h",
77188         "tags_all_tags",
77189         "tags_resources"
77190       ]],
77191       ["points", [
77192         "intro",
77193         "add_point_h",
77194         "add_point",
77195         "add_point_finish",
77196         "move_point_h",
77197         "move_point",
77198         "delete_point_h",
77199         "delete_point",
77200         "delete_point_command"
77201       ]],
77202       ["lines", [
77203         "intro",
77204         "add_line_h",
77205         "add_line",
77206         "add_line_draw",
77207         "add_line_continue",
77208         "add_line_finish",
77209         "modify_line_h",
77210         "modify_line_dragnode",
77211         "modify_line_addnode",
77212         "connect_line_h",
77213         "connect_line",
77214         "connect_line_display",
77215         "connect_line_drag",
77216         "connect_line_tag",
77217         "disconnect_line_h",
77218         "disconnect_line_command",
77219         "move_line_h",
77220         "move_line_command",
77221         "move_line_connected",
77222         "delete_line_h",
77223         "delete_line",
77224         "delete_line_command"
77225       ]],
77226       ["areas", [
77227         "intro",
77228         "point_or_area_h",
77229         "point_or_area",
77230         "add_area_h",
77231         "add_area_command",
77232         "add_area_draw",
77233         "add_area_continue",
77234         "add_area_finish",
77235         "square_area_h",
77236         "square_area_command",
77237         "modify_area_h",
77238         "modify_area_dragnode",
77239         "modify_area_addnode",
77240         "delete_area_h",
77241         "delete_area",
77242         "delete_area_command"
77243       ]],
77244       ["relations", [
77245         "intro",
77246         "edit_relation_h",
77247         "edit_relation",
77248         "edit_relation_add",
77249         "edit_relation_delete",
77250         "maintain_relation_h",
77251         "maintain_relation",
77252         "relation_types_h",
77253         "multipolygon_h",
77254         "multipolygon",
77255         "multipolygon_create",
77256         "multipolygon_merge",
77257         "turn_restriction_h",
77258         "turn_restriction",
77259         "turn_restriction_field",
77260         "turn_restriction_editing",
77261         "route_h",
77262         "route",
77263         "route_add",
77264         "boundary_h",
77265         "boundary",
77266         "boundary_add"
77267       ]],
77268       ["operations", [
77269         "intro",
77270         "intro_2",
77271         "straighten",
77272         "orthogonalize",
77273         "circularize",
77274         "move",
77275         "rotate",
77276         "reflect",
77277         "continue",
77278         "reverse",
77279         "disconnect",
77280         "split",
77281         "extract",
77282         "merge",
77283         "delete",
77284         "downgrade",
77285         "copy_paste"
77286       ]],
77287       ["notes", [
77288         "intro",
77289         "add_note_h",
77290         "add_note",
77291         "place_note",
77292         "move_note",
77293         "update_note_h",
77294         "update_note",
77295         "save_note_h",
77296         "save_note"
77297       ]],
77298       ["imagery", [
77299         "intro",
77300         "sources_h",
77301         "choosing",
77302         "sources",
77303         "offsets_h",
77304         "offset",
77305         "offset_change"
77306       ]],
77307       ["streetlevel", [
77308         "intro",
77309         "using_h",
77310         "using",
77311         "photos",
77312         "viewer"
77313       ]],
77314       ["gps", [
77315         "intro",
77316         "survey",
77317         "using_h",
77318         "using",
77319         "tracing",
77320         "upload"
77321       ]],
77322       ["qa", [
77323         "intro",
77324         "tools_h",
77325         "tools",
77326         "issues_h",
77327         "issues"
77328       ]]
77329     ];
77330     var headings = {
77331       "help.help.open_data_h": 3,
77332       "help.help.before_start_h": 3,
77333       "help.help.open_source_h": 3,
77334       "help.overview.navigation_h": 3,
77335       "help.overview.features_h": 3,
77336       "help.editing.select_h": 3,
77337       "help.editing.multiselect_h": 3,
77338       "help.editing.undo_redo_h": 3,
77339       "help.editing.save_h": 3,
77340       "help.editing.upload_h": 3,
77341       "help.editing.backups_h": 3,
77342       "help.editing.keyboard_h": 3,
77343       "help.feature_editor.type_h": 3,
77344       "help.feature_editor.fields_h": 3,
77345       "help.feature_editor.tags_h": 3,
77346       "help.points.add_point_h": 3,
77347       "help.points.move_point_h": 3,
77348       "help.points.delete_point_h": 3,
77349       "help.lines.add_line_h": 3,
77350       "help.lines.modify_line_h": 3,
77351       "help.lines.connect_line_h": 3,
77352       "help.lines.disconnect_line_h": 3,
77353       "help.lines.move_line_h": 3,
77354       "help.lines.delete_line_h": 3,
77355       "help.areas.point_or_area_h": 3,
77356       "help.areas.add_area_h": 3,
77357       "help.areas.square_area_h": 3,
77358       "help.areas.modify_area_h": 3,
77359       "help.areas.delete_area_h": 3,
77360       "help.relations.edit_relation_h": 3,
77361       "help.relations.maintain_relation_h": 3,
77362       "help.relations.relation_types_h": 2,
77363       "help.relations.multipolygon_h": 3,
77364       "help.relations.turn_restriction_h": 3,
77365       "help.relations.route_h": 3,
77366       "help.relations.boundary_h": 3,
77367       "help.notes.add_note_h": 3,
77368       "help.notes.update_note_h": 3,
77369       "help.notes.save_note_h": 3,
77370       "help.imagery.sources_h": 3,
77371       "help.imagery.offsets_h": 3,
77372       "help.streetlevel.using_h": 3,
77373       "help.gps.using_h": 3,
77374       "help.qa.tools_h": 3,
77375       "help.qa.issues_h": 3
77376     };
77377     var docs = docKeys.map(function(key) {
77378       var helpkey = "help." + key[0];
77379       var helpPaneReplacements = { version: context.version };
77380       var text = key[1].reduce(function(all, part) {
77381         var subkey = helpkey + "." + part;
77382         var depth = headings[subkey];
77383         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
77384         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
77385       }, "");
77386       return {
77387         title: _t.html(helpkey + ".title"),
77388         content: k(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
77389       };
77390     });
77391     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
77392     helpPane.renderContent = function(content) {
77393       function clickHelp(d2, i3) {
77394         var rtl = _mainLocalizer.textDirection() === "rtl";
77395         content.property("scrollTop", 0);
77396         helpPane.selection().select(".pane-heading h2").html(d2.title);
77397         body.html(d2.content);
77398         body.selectAll("a").attr("target", "_blank");
77399         menuItems.classed("selected", function(m3) {
77400           return m3.title === d2.title;
77401         });
77402         nav.html("");
77403         if (rtl) {
77404           nav.call(drawNext).call(drawPrevious);
77405         } else {
77406           nav.call(drawPrevious).call(drawNext);
77407         }
77408         function drawNext(selection2) {
77409           if (i3 < docs.length - 1) {
77410             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
77411               d3_event.preventDefault();
77412               clickHelp(docs[i3 + 1], i3 + 1);
77413             });
77414             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
77415           }
77416         }
77417         function drawPrevious(selection2) {
77418           if (i3 > 0) {
77419             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
77420               d3_event.preventDefault();
77421               clickHelp(docs[i3 - 1], i3 - 1);
77422             });
77423             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
77424           }
77425         }
77426       }
77427       function clickWalkthrough(d3_event) {
77428         d3_event.preventDefault();
77429         if (context.inIntro()) return;
77430         context.container().call(uiIntro(context));
77431         context.ui().togglePanes();
77432       }
77433       function clickShortcuts(d3_event) {
77434         d3_event.preventDefault();
77435         context.container().call(context.ui().shortcuts, true);
77436       }
77437       var toc = content.append("ul").attr("class", "toc");
77438       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
77439         return d2.title;
77440       }).on("click", function(d3_event, d2) {
77441         d3_event.preventDefault();
77442         clickHelp(d2, docs.indexOf(d2));
77443       });
77444       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
77445         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
77446       ).append("a").attr("href", "#").on("click", clickShortcuts);
77447       shortcuts.append("div").call(_t.append("shortcuts.title"));
77448       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
77449       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
77450       walkthrough.append("div").call(_t.append("splash.walkthrough"));
77451       var helpContent = content.append("div").attr("class", "left-content");
77452       var body = helpContent.append("div").attr("class", "body");
77453       var nav = helpContent.append("div").attr("class", "nav");
77454       clickHelp(docs[0], 0);
77455     };
77456     return helpPane;
77457   }
77458   var init_help = __esm({
77459     "modules/ui/panes/help.js"() {
77460       "use strict";
77461       init_marked_esm();
77462       init_icon();
77463       init_intro();
77464       init_pane();
77465       init_localizer();
77466       init_tooltip();
77467       init_helper();
77468     }
77469   });
77470
77471   // modules/ui/sections/validation_issues.js
77472   var validation_issues_exports = {};
77473   __export(validation_issues_exports, {
77474     uiSectionValidationIssues: () => uiSectionValidationIssues
77475   });
77476   function uiSectionValidationIssues(id2, severity, context) {
77477     var _issues = [];
77478     var section = uiSection(id2, context).label(function() {
77479       if (!_issues) return "";
77480       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
77481       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
77482     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
77483       return _issues && _issues.length;
77484     });
77485     function getOptions() {
77486       return {
77487         what: corePreferences("validate-what") || "edited",
77488         where: corePreferences("validate-where") || "all"
77489       };
77490     }
77491     function reloadIssues() {
77492       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
77493     }
77494     function renderDisclosureContent(selection2) {
77495       var center = context.map().center();
77496       var graph = context.graph();
77497       var issues = _issues.map(function withDistance(issue) {
77498         var extent = issue.extent(graph);
77499         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
77500         return Object.assign(issue, { dist });
77501       }).sort(function byDistance(a4, b3) {
77502         return a4.dist - b3.dist;
77503       });
77504       issues = issues.slice(0, 1e3);
77505       selection2.call(drawIssuesList, issues);
77506     }
77507     function drawIssuesList(selection2, issues) {
77508       var list = selection2.selectAll(".issues-list").data([0]);
77509       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
77510       var items = list.selectAll("li").data(issues, function(d2) {
77511         return d2.key;
77512       });
77513       items.exit().remove();
77514       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
77515         return "issue severity-" + d2.severity;
77516       });
77517       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
77518         context.validator().focusIssue(d2);
77519       }).on("mouseover", function(d3_event, d2) {
77520         utilHighlightEntities(d2.entityIds, true, context);
77521       }).on("mouseout", function(d3_event, d2) {
77522         utilHighlightEntities(d2.entityIds, false, context);
77523       });
77524       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
77525       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
77526         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
77527         select_default2(this).call(svgIcon(iconName));
77528       });
77529       textEnter.append("span").attr("class", "issue-message");
77530       items = items.merge(itemsEnter).order();
77531       items.selectAll(".issue-message").text("").each(function(d2) {
77532         return d2.message(context)(select_default2(this));
77533       });
77534     }
77535     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
77536       window.requestIdleCallback(function() {
77537         reloadIssues();
77538         section.reRender();
77539       });
77540     });
77541     context.map().on(
77542       "move.uiSectionValidationIssues" + id2,
77543       debounce_default(function() {
77544         window.requestIdleCallback(function() {
77545           if (getOptions().where === "visible") {
77546             reloadIssues();
77547           }
77548           section.reRender();
77549         });
77550       }, 1e3)
77551     );
77552     return section;
77553   }
77554   var init_validation_issues = __esm({
77555     "modules/ui/sections/validation_issues.js"() {
77556       "use strict";
77557       init_debounce();
77558       init_src5();
77559       init_geo2();
77560       init_icon();
77561       init_preferences();
77562       init_localizer();
77563       init_util();
77564       init_section();
77565     }
77566   });
77567
77568   // modules/ui/sections/validation_options.js
77569   var validation_options_exports = {};
77570   __export(validation_options_exports, {
77571     uiSectionValidationOptions: () => uiSectionValidationOptions
77572   });
77573   function uiSectionValidationOptions(context) {
77574     var section = uiSection("issues-options", context).content(renderContent);
77575     function renderContent(selection2) {
77576       var container = selection2.selectAll(".issues-options-container").data([0]);
77577       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
77578       var data = [
77579         { key: "what", values: ["edited", "all"] },
77580         { key: "where", values: ["visible", "all"] }
77581       ];
77582       var options = container.selectAll(".issues-option").data(data, function(d2) {
77583         return d2.key;
77584       });
77585       var optionsEnter = options.enter().append("div").attr("class", function(d2) {
77586         return "issues-option issues-option-" + d2.key;
77587       });
77588       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
77589         return _t.html("issues.options." + d2.key + ".title");
77590       });
77591       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
77592         return d2.values.map(function(val) {
77593           return { value: val, key: d2.key };
77594         });
77595       }).enter().append("label");
77596       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
77597         return "issues-option-" + d2.key;
77598       }).attr("value", function(d2) {
77599         return d2.value;
77600       }).property("checked", function(d2) {
77601         return getOptions()[d2.key] === d2.value;
77602       }).on("change", function(d3_event, d2) {
77603         updateOptionValue(d3_event, d2.key, d2.value);
77604       });
77605       valuesEnter.append("span").html(function(d2) {
77606         return _t.html("issues.options." + d2.key + "." + d2.value);
77607       });
77608     }
77609     function getOptions() {
77610       return {
77611         what: corePreferences("validate-what") || "edited",
77612         // 'all', 'edited'
77613         where: corePreferences("validate-where") || "all"
77614         // 'all', 'visible'
77615       };
77616     }
77617     function updateOptionValue(d3_event, d2, val) {
77618       if (!val && d3_event && d3_event.target) {
77619         val = d3_event.target.value;
77620       }
77621       corePreferences("validate-" + d2, val);
77622       context.validator().validate();
77623     }
77624     return section;
77625   }
77626   var init_validation_options = __esm({
77627     "modules/ui/sections/validation_options.js"() {
77628       "use strict";
77629       init_preferences();
77630       init_localizer();
77631       init_section();
77632     }
77633   });
77634
77635   // modules/ui/sections/validation_rules.js
77636   var validation_rules_exports = {};
77637   __export(validation_rules_exports, {
77638     uiSectionValidationRules: () => uiSectionValidationRules
77639   });
77640   function uiSectionValidationRules(context) {
77641     var MINSQUARE = 0;
77642     var MAXSQUARE = 20;
77643     var DEFAULTSQUARE = 5;
77644     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
77645     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
77646       return key !== "maprules";
77647     }).sort(function(key1, key2) {
77648       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
77649     });
77650     function renderDisclosureContent(selection2) {
77651       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
77652       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
77653       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
77654       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
77655       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
77656         d3_event.preventDefault();
77657         context.validator().disableRules(_ruleKeys);
77658       });
77659       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
77660         d3_event.preventDefault();
77661         context.validator().disableRules([]);
77662       });
77663       container = container.merge(containerEnter);
77664       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
77665     }
77666     function drawListItems(selection2, data, type2, name, change, active) {
77667       var items = selection2.selectAll("li").data(data);
77668       items.exit().remove();
77669       var enter = items.enter().append("li");
77670       if (name === "rule") {
77671         enter.call(
77672           uiTooltip().title(function(d2) {
77673             return _t.append("issues." + d2 + ".tip");
77674           }).placement("top")
77675         );
77676       }
77677       var label = enter.append("label");
77678       label.append("input").attr("type", type2).attr("name", name).on("change", change);
77679       label.append("span").html(function(d2) {
77680         var params = {};
77681         if (d2 === "unsquare_way") {
77682           params.val = { html: '<span class="square-degrees"></span>' };
77683         }
77684         return _t.html("issues." + d2 + ".title", params);
77685       });
77686       items = items.merge(enter);
77687       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
77688       var degStr = corePreferences("validate-square-degrees");
77689       if (degStr === null) {
77690         degStr = DEFAULTSQUARE.toString();
77691       }
77692       var span = items.selectAll(".square-degrees");
77693       var input = span.selectAll(".square-degrees-input").data([0]);
77694       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) {
77695         d3_event.preventDefault();
77696         d3_event.stopPropagation();
77697         this.select();
77698       }).on("keyup", function(d3_event) {
77699         if (d3_event.keyCode === 13) {
77700           this.blur();
77701           this.select();
77702         }
77703       }).on("blur", changeSquare).merge(input).property("value", degStr);
77704     }
77705     function changeSquare() {
77706       var input = select_default2(this);
77707       var degStr = utilGetSetValue(input).trim();
77708       var degNum = Number(degStr);
77709       if (!isFinite(degNum)) {
77710         degNum = DEFAULTSQUARE;
77711       } else if (degNum > MAXSQUARE) {
77712         degNum = MAXSQUARE;
77713       } else if (degNum < MINSQUARE) {
77714         degNum = MINSQUARE;
77715       }
77716       degNum = Math.round(degNum * 10) / 10;
77717       degStr = degNum.toString();
77718       input.property("value", degStr);
77719       corePreferences("validate-square-degrees", degStr);
77720       context.validator().revalidateUnsquare();
77721     }
77722     function isRuleEnabled(d2) {
77723       return context.validator().isRuleEnabled(d2);
77724     }
77725     function toggleRule(d3_event, d2) {
77726       context.validator().toggleRule(d2);
77727     }
77728     context.validator().on("validated.uiSectionValidationRules", function() {
77729       window.requestIdleCallback(section.reRender);
77730     });
77731     return section;
77732   }
77733   var init_validation_rules = __esm({
77734     "modules/ui/sections/validation_rules.js"() {
77735       "use strict";
77736       init_src5();
77737       init_preferences();
77738       init_localizer();
77739       init_util();
77740       init_tooltip();
77741       init_section();
77742     }
77743   });
77744
77745   // modules/ui/sections/validation_status.js
77746   var validation_status_exports = {};
77747   __export(validation_status_exports, {
77748     uiSectionValidationStatus: () => uiSectionValidationStatus
77749   });
77750   function uiSectionValidationStatus(context) {
77751     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
77752       var issues = context.validator().getIssues(getOptions());
77753       return issues.length === 0;
77754     });
77755     function getOptions() {
77756       return {
77757         what: corePreferences("validate-what") || "edited",
77758         where: corePreferences("validate-where") || "all"
77759       };
77760     }
77761     function renderContent(selection2) {
77762       var box = selection2.selectAll(".box").data([0]);
77763       var boxEnter = box.enter().append("div").attr("class", "box");
77764       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
77765       var noIssuesMessage = boxEnter.append("span");
77766       noIssuesMessage.append("strong").attr("class", "message");
77767       noIssuesMessage.append("br");
77768       noIssuesMessage.append("span").attr("class", "details");
77769       renderIgnoredIssuesReset(selection2);
77770       setNoIssuesText(selection2);
77771     }
77772     function renderIgnoredIssuesReset(selection2) {
77773       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
77774       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
77775       resetIgnored.exit().remove();
77776       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
77777       resetIgnoredEnter.append("a").attr("href", "#");
77778       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
77779       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
77780       resetIgnored.on("click", function(d3_event) {
77781         d3_event.preventDefault();
77782         context.validator().resetIgnoredIssues();
77783       });
77784     }
77785     function setNoIssuesText(selection2) {
77786       var opts = getOptions();
77787       function checkForHiddenIssues(cases) {
77788         for (var type2 in cases) {
77789           var hiddenOpts = cases[type2];
77790           var hiddenIssues = context.validator().getIssues(hiddenOpts);
77791           if (hiddenIssues.length) {
77792             selection2.select(".box .details").html("").call(_t.append(
77793               "issues.no_issues.hidden_issues." + type2,
77794               { count: hiddenIssues.length.toString() }
77795             ));
77796             return;
77797           }
77798         }
77799         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
77800       }
77801       var messageType;
77802       if (opts.what === "edited" && opts.where === "visible") {
77803         messageType = "edits_in_view";
77804         checkForHiddenIssues({
77805           elsewhere: { what: "edited", where: "all" },
77806           everything_else: { what: "all", where: "visible" },
77807           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
77808           everything_else_elsewhere: { what: "all", where: "all" },
77809           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
77810           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
77811           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
77812         });
77813       } else if (opts.what === "edited" && opts.where === "all") {
77814         messageType = "edits";
77815         checkForHiddenIssues({
77816           everything_else: { what: "all", where: "all" },
77817           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
77818           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
77819         });
77820       } else if (opts.what === "all" && opts.where === "visible") {
77821         messageType = "everything_in_view";
77822         checkForHiddenIssues({
77823           elsewhere: { what: "all", where: "all" },
77824           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
77825           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
77826           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
77827           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
77828         });
77829       } else if (opts.what === "all" && opts.where === "all") {
77830         messageType = "everything";
77831         checkForHiddenIssues({
77832           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
77833           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
77834         });
77835       }
77836       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
77837         messageType = "no_edits";
77838       }
77839       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
77840     }
77841     context.validator().on("validated.uiSectionValidationStatus", function() {
77842       window.requestIdleCallback(section.reRender);
77843     });
77844     context.map().on(
77845       "move.uiSectionValidationStatus",
77846       debounce_default(function() {
77847         window.requestIdleCallback(section.reRender);
77848       }, 1e3)
77849     );
77850     return section;
77851   }
77852   var init_validation_status = __esm({
77853     "modules/ui/sections/validation_status.js"() {
77854       "use strict";
77855       init_debounce();
77856       init_icon();
77857       init_preferences();
77858       init_localizer();
77859       init_section();
77860     }
77861   });
77862
77863   // modules/ui/panes/issues.js
77864   var issues_exports = {};
77865   __export(issues_exports, {
77866     uiPaneIssues: () => uiPaneIssues
77867   });
77868   function uiPaneIssues(context) {
77869     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
77870       uiSectionValidationOptions(context),
77871       uiSectionValidationStatus(context),
77872       uiSectionValidationIssues("issues-errors", "error", context),
77873       uiSectionValidationIssues("issues-warnings", "warning", context),
77874       uiSectionValidationRules(context)
77875     ]);
77876     return issuesPane;
77877   }
77878   var init_issues = __esm({
77879     "modules/ui/panes/issues.js"() {
77880       "use strict";
77881       init_localizer();
77882       init_pane();
77883       init_validation_issues();
77884       init_validation_options();
77885       init_validation_rules();
77886       init_validation_status();
77887     }
77888   });
77889
77890   // modules/ui/settings/custom_data.js
77891   var custom_data_exports = {};
77892   __export(custom_data_exports, {
77893     uiSettingsCustomData: () => uiSettingsCustomData
77894   });
77895   function uiSettingsCustomData(context) {
77896     var dispatch14 = dispatch_default("change");
77897     function render(selection2) {
77898       var dataLayer = context.layers().layer("data");
77899       var _origSettings = {
77900         fileList: dataLayer && dataLayer.fileList() || null,
77901         url: corePreferences("settings-custom-data-url")
77902       };
77903       var _currSettings = {
77904         fileList: dataLayer && dataLayer.fileList() || null
77905         // url: prefs('settings-custom-data-url')
77906       };
77907       var modal = uiConfirm(selection2).okButton();
77908       modal.classed("settings-modal settings-custom-data", true);
77909       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
77910       var textSection = modal.select(".modal-section.message-text");
77911       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
77912       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) {
77913         var files = d3_event.target.files;
77914         if (files && files.length) {
77915           _currSettings.url = "";
77916           textSection.select(".field-url").property("value", "");
77917           _currSettings.fileList = files;
77918         } else {
77919           _currSettings.fileList = null;
77920         }
77921       });
77922       textSection.append("h4").call(_t.append("settings.custom_data.or"));
77923       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
77924       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
77925       var buttonSection = modal.select(".modal-section.buttons");
77926       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
77927       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
77928       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
77929       function isSaveDisabled() {
77930         return null;
77931       }
77932       function clickCancel() {
77933         textSection.select(".field-url").property("value", _origSettings.url);
77934         corePreferences("settings-custom-data-url", _origSettings.url);
77935         this.blur();
77936         modal.close();
77937       }
77938       function clickSave() {
77939         _currSettings.url = textSection.select(".field-url").property("value").trim();
77940         if (_currSettings.url) {
77941           _currSettings.fileList = null;
77942         }
77943         if (_currSettings.fileList) {
77944           _currSettings.url = "";
77945         }
77946         corePreferences("settings-custom-data-url", _currSettings.url);
77947         this.blur();
77948         modal.close();
77949         dispatch14.call("change", this, _currSettings);
77950       }
77951     }
77952     return utilRebind(render, dispatch14, "on");
77953   }
77954   var init_custom_data = __esm({
77955     "modules/ui/settings/custom_data.js"() {
77956       "use strict";
77957       init_src4();
77958       init_preferences();
77959       init_localizer();
77960       init_confirm();
77961       init_util();
77962     }
77963   });
77964
77965   // modules/ui/sections/data_layers.js
77966   var data_layers_exports = {};
77967   __export(data_layers_exports, {
77968     uiSectionDataLayers: () => uiSectionDataLayers
77969   });
77970   function uiSectionDataLayers(context) {
77971     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
77972     var layers = context.layers();
77973     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
77974     function renderDisclosureContent(selection2) {
77975       var container = selection2.selectAll(".data-layer-container").data([0]);
77976       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
77977     }
77978     function showsLayer(which) {
77979       var layer = layers.layer(which);
77980       if (layer) {
77981         return layer.enabled();
77982       }
77983       return false;
77984     }
77985     function setLayer(which, enabled) {
77986       var mode = context.mode();
77987       if (mode && /^draw/.test(mode.id)) return;
77988       var layer = layers.layer(which);
77989       if (layer) {
77990         layer.enabled(enabled);
77991         if (!enabled && (which === "osm" || which === "notes")) {
77992           context.enter(modeBrowse(context));
77993         }
77994       }
77995     }
77996     function toggleLayer(which) {
77997       setLayer(which, !showsLayer(which));
77998     }
77999     function drawOsmItems(selection2) {
78000       var osmKeys = ["osm", "notes"];
78001       var osmLayers = layers.all().filter(function(obj) {
78002         return osmKeys.indexOf(obj.id) !== -1;
78003       });
78004       var ul = selection2.selectAll(".layer-list-osm").data([0]);
78005       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
78006       var li = ul.selectAll(".list-item").data(osmLayers);
78007       li.exit().remove();
78008       var liEnter = li.enter().append("li").attr("class", function(d2) {
78009         return "list-item list-item-" + d2.id;
78010       });
78011       var labelEnter = liEnter.append("label").each(function(d2) {
78012         if (d2.id === "osm") {
78013           select_default2(this).call(
78014             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
78015           );
78016         } else {
78017           select_default2(this).call(
78018             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
78019           );
78020         }
78021       });
78022       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78023         toggleLayer(d2.id);
78024       });
78025       labelEnter.append("span").html(function(d2) {
78026         return _t.html("map_data.layers." + d2.id + ".title");
78027       });
78028       li.merge(liEnter).classed("active", function(d2) {
78029         return d2.layer.enabled();
78030       }).selectAll("input").property("checked", function(d2) {
78031         return d2.layer.enabled();
78032       });
78033     }
78034     function drawQAItems(selection2) {
78035       var qaKeys = ["keepRight", "osmose"];
78036       var qaLayers = layers.all().filter(function(obj) {
78037         return qaKeys.indexOf(obj.id) !== -1;
78038       });
78039       var ul = selection2.selectAll(".layer-list-qa").data([0]);
78040       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
78041       var li = ul.selectAll(".list-item").data(qaLayers);
78042       li.exit().remove();
78043       var liEnter = li.enter().append("li").attr("class", function(d2) {
78044         return "list-item list-item-" + d2.id;
78045       });
78046       var labelEnter = liEnter.append("label").each(function(d2) {
78047         select_default2(this).call(
78048           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
78049         );
78050       });
78051       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78052         toggleLayer(d2.id);
78053       });
78054       labelEnter.append("span").each(function(d2) {
78055         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
78056       });
78057       li.merge(liEnter).classed("active", function(d2) {
78058         return d2.layer.enabled();
78059       }).selectAll("input").property("checked", function(d2) {
78060         return d2.layer.enabled();
78061       });
78062     }
78063     function drawVectorItems(selection2) {
78064       var dataLayer = layers.layer("data");
78065       var vtData = [
78066         {
78067           name: "Detroit Neighborhoods/Parks",
78068           src: "neighborhoods-parks",
78069           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
78070           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"
78071         },
78072         {
78073           name: "Detroit Composite POIs",
78074           src: "composite-poi",
78075           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
78076           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"
78077         },
78078         {
78079           name: "Detroit All-The-Places POIs",
78080           src: "alltheplaces-poi",
78081           tooltip: "Public domain business location data created by web scrapers.",
78082           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"
78083         }
78084       ];
78085       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
78086       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
78087       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
78088       container.exit().remove();
78089       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
78090       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
78091       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
78092       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");
78093       container = container.merge(containerEnter);
78094       var ul = container.selectAll(".layer-list-vectortile");
78095       var li = ul.selectAll(".list-item").data(vtData);
78096       li.exit().remove();
78097       var liEnter = li.enter().append("li").attr("class", function(d2) {
78098         return "list-item list-item-" + d2.src;
78099       });
78100       var labelEnter = liEnter.append("label").each(function(d2) {
78101         select_default2(this).call(
78102           uiTooltip().title(d2.tooltip).placement("top")
78103         );
78104       });
78105       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
78106       labelEnter.append("span").text(function(d2) {
78107         return d2.name;
78108       });
78109       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
78110       function isVTLayerSelected(d2) {
78111         return dataLayer && dataLayer.template() === d2.template;
78112       }
78113       function selectVTLayer(d3_event, d2) {
78114         corePreferences("settings-custom-data-url", d2.template);
78115         if (dataLayer) {
78116           dataLayer.template(d2.template, d2.src);
78117           dataLayer.enabled(true);
78118         }
78119       }
78120     }
78121     function drawCustomDataItems(selection2) {
78122       var dataLayer = layers.layer("data");
78123       var hasData = dataLayer && dataLayer.hasData();
78124       var showsData = hasData && dataLayer.enabled();
78125       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
78126       ul.exit().remove();
78127       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
78128       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
78129       var labelEnter = liEnter.append("label").call(
78130         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
78131       );
78132       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
78133         toggleLayer("data");
78134       });
78135       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
78136       liEnter.append("button").attr("class", "open-data-options").call(
78137         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78138       ).on("click", function(d3_event) {
78139         d3_event.preventDefault();
78140         editCustom();
78141       }).call(svgIcon("#iD-icon-more"));
78142       liEnter.append("button").attr("class", "zoom-to-data").call(
78143         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78144       ).on("click", function(d3_event) {
78145         if (select_default2(this).classed("disabled")) return;
78146         d3_event.preventDefault();
78147         d3_event.stopPropagation();
78148         dataLayer.fitZoom();
78149       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
78150       ul = ul.merge(ulEnter);
78151       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
78152       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
78153     }
78154     function editCustom() {
78155       context.container().call(settingsCustomData);
78156     }
78157     function customChanged(d2) {
78158       var dataLayer = layers.layer("data");
78159       if (d2 && d2.url) {
78160         dataLayer.url(d2.url);
78161       } else if (d2 && d2.fileList) {
78162         dataLayer.fileList(d2.fileList);
78163       }
78164     }
78165     function drawPanelItems(selection2) {
78166       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
78167       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
78168         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
78169       );
78170       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
78171         d3_event.preventDefault();
78172         context.ui().info.toggle("history");
78173       });
78174       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
78175       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
78176         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
78177       );
78178       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
78179         d3_event.preventDefault();
78180         context.ui().info.toggle("measurement");
78181       });
78182       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
78183     }
78184     context.layers().on("change.uiSectionDataLayers", section.reRender);
78185     context.map().on(
78186       "move.uiSectionDataLayers",
78187       debounce_default(function() {
78188         window.requestIdleCallback(section.reRender);
78189       }, 1e3)
78190     );
78191     return section;
78192   }
78193   var init_data_layers = __esm({
78194     "modules/ui/sections/data_layers.js"() {
78195       "use strict";
78196       init_debounce();
78197       init_src5();
78198       init_preferences();
78199       init_localizer();
78200       init_tooltip();
78201       init_icon();
78202       init_geo2();
78203       init_browse();
78204       init_cmd();
78205       init_section();
78206       init_custom_data();
78207     }
78208   });
78209
78210   // modules/ui/sections/map_features.js
78211   var map_features_exports = {};
78212   __export(map_features_exports, {
78213     uiSectionMapFeatures: () => uiSectionMapFeatures
78214   });
78215   function uiSectionMapFeatures(context) {
78216     var _features = context.features().keys();
78217     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78218     function renderDisclosureContent(selection2) {
78219       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
78220       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
78221       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
78222       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
78223       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
78224         d3_event.preventDefault();
78225         context.features().disableAll();
78226       });
78227       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
78228         d3_event.preventDefault();
78229         context.features().enableAll();
78230       });
78231       container = container.merge(containerEnter);
78232       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
78233     }
78234     function drawListItems(selection2, data, type2, name, change, active) {
78235       var items = selection2.selectAll("li").data(data);
78236       items.exit().remove();
78237       var enter = items.enter().append("li").call(
78238         uiTooltip().title(function(d2) {
78239           var tip = _t.append(name + "." + d2 + ".tooltip");
78240           if (autoHiddenFeature(d2)) {
78241             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
78242             return (selection3) => {
78243               selection3.call(tip);
78244               selection3.append("div").call(msg);
78245             };
78246           }
78247           return tip;
78248         }).placement("top")
78249       );
78250       var label = enter.append("label");
78251       label.append("input").attr("type", type2).attr("name", name).on("change", change);
78252       label.append("span").html(function(d2) {
78253         return _t.html(name + "." + d2 + ".description");
78254       });
78255       items = items.merge(enter);
78256       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
78257     }
78258     function autoHiddenFeature(d2) {
78259       return context.features().autoHidden(d2);
78260     }
78261     function showsFeature(d2) {
78262       return context.features().enabled(d2);
78263     }
78264     function clickFeature(d3_event, d2) {
78265       context.features().toggle(d2);
78266     }
78267     function showsLayer(id2) {
78268       var layer = context.layers().layer(id2);
78269       return layer && layer.enabled();
78270     }
78271     context.features().on("change.map_features", section.reRender);
78272     return section;
78273   }
78274   var init_map_features = __esm({
78275     "modules/ui/sections/map_features.js"() {
78276       "use strict";
78277       init_localizer();
78278       init_tooltip();
78279       init_section();
78280     }
78281   });
78282
78283   // modules/ui/sections/map_style_options.js
78284   var map_style_options_exports = {};
78285   __export(map_style_options_exports, {
78286     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions
78287   });
78288   function uiSectionMapStyleOptions(context) {
78289     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78290     function renderDisclosureContent(selection2) {
78291       var container = selection2.selectAll(".layer-fill-list").data([0]);
78292       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
78293       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
78294       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
78295         return context.surface().classed("highlight-edited");
78296       });
78297     }
78298     function drawListItems(selection2, data, type2, name, change, active) {
78299       var items = selection2.selectAll("li").data(data);
78300       items.exit().remove();
78301       var enter = items.enter().append("li").call(
78302         uiTooltip().title(function(d2) {
78303           return _t.append(name + "." + d2 + ".tooltip");
78304         }).keys(function(d2) {
78305           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
78306           if (d2 === "highlight_edits") key = _t("map_data.highlight_edits.key");
78307           return key ? [key] : null;
78308         }).placement("top")
78309       );
78310       var label = enter.append("label");
78311       label.append("input").attr("type", type2).attr("name", name).on("change", change);
78312       label.append("span").html(function(d2) {
78313         return _t.html(name + "." + d2 + ".description");
78314       });
78315       items = items.merge(enter);
78316       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
78317     }
78318     function isActiveFill(d2) {
78319       return context.map().activeAreaFill() === d2;
78320     }
78321     function toggleHighlightEdited(d3_event) {
78322       d3_event.preventDefault();
78323       context.map().toggleHighlightEdited();
78324     }
78325     function setFill(d3_event, d2) {
78326       context.map().activeAreaFill(d2);
78327     }
78328     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
78329     return section;
78330   }
78331   var init_map_style_options = __esm({
78332     "modules/ui/sections/map_style_options.js"() {
78333       "use strict";
78334       init_localizer();
78335       init_tooltip();
78336       init_section();
78337     }
78338   });
78339
78340   // modules/ui/settings/local_photos.js
78341   var local_photos_exports2 = {};
78342   __export(local_photos_exports2, {
78343     uiSettingsLocalPhotos: () => uiSettingsLocalPhotos
78344   });
78345   function uiSettingsLocalPhotos(context) {
78346     var dispatch14 = dispatch_default("change");
78347     var photoLayer = context.layers().layer("local-photos");
78348     var modal;
78349     function render(selection2) {
78350       modal = uiConfirm(selection2).okButton();
78351       modal.classed("settings-modal settings-local-photos", true);
78352       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
78353       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
78354       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
78355       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
78356       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) {
78357         var files = d3_event.target.files;
78358         if (files && files.length) {
78359           photoList.select("ul").append("li").classed("placeholder", true).append("div");
78360           dispatch14.call("change", this, files);
78361         }
78362         d3_event.target.value = null;
78363       });
78364       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
78365       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
78366       photoList.append("ul");
78367       updatePhotoList(photoList.select("ul"));
78368       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
78369     }
78370     function updatePhotoList(container) {
78371       var _a4;
78372       function locationUnavailable(d2) {
78373         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
78374       }
78375       container.selectAll("li.placeholder").remove();
78376       let selection2 = container.selectAll("li").data((_a4 = photoLayer.getPhotos()) != null ? _a4 : [], (d2) => d2.id);
78377       selection2.exit().remove();
78378       const selectionEnter = selection2.enter().append("li");
78379       selectionEnter.append("span").classed("filename", true);
78380       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
78381       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
78382         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
78383       );
78384       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
78385       selection2 = selection2.merge(selectionEnter);
78386       selection2.classed("invalid", locationUnavailable);
78387       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
78388       selection2.select("span.filename").on("click", (d3_event, d2) => {
78389         photoLayer.openPhoto(d3_event, d2, false);
78390       });
78391       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
78392         photoLayer.openPhoto(d3_event, d2, true);
78393       });
78394       selection2.select("button.remove").on("click", (d3_event, d2) => {
78395         photoLayer.removePhoto(d2.id);
78396         updatePhotoList(container);
78397       });
78398     }
78399     return utilRebind(render, dispatch14, "on");
78400   }
78401   var init_local_photos2 = __esm({
78402     "modules/ui/settings/local_photos.js"() {
78403       "use strict";
78404       init_src4();
78405       init_lodash();
78406       init_localizer();
78407       init_confirm();
78408       init_util();
78409       init_tooltip();
78410       init_svg();
78411     }
78412   });
78413
78414   // modules/ui/sections/photo_overlays.js
78415   var photo_overlays_exports = {};
78416   __export(photo_overlays_exports, {
78417     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays
78418   });
78419   function uiSectionPhotoOverlays(context) {
78420     let _savedLayers = [];
78421     let _layersHidden = false;
78422     const _streetLayerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
78423     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
78424     var layers = context.layers();
78425     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78426     const photoDates = {};
78427     const now3 = +/* @__PURE__ */ new Date();
78428     function renderDisclosureContent(selection2) {
78429       var container = selection2.selectAll(".photo-overlay-container").data([0]);
78430       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateSlider).call(drawUsernameFilter).call(drawLocalPhotos);
78431     }
78432     function drawPhotoItems(selection2) {
78433       var photoKeys = context.photos().overlayLayerIDs();
78434       var photoLayers = layers.all().filter(function(obj) {
78435         return photoKeys.indexOf(obj.id) !== -1;
78436       });
78437       var data = photoLayers.filter(function(obj) {
78438         if (!obj.layer.supported()) return false;
78439         if (layerEnabled(obj)) return true;
78440         if (typeof obj.layer.validHere === "function") {
78441           return obj.layer.validHere(context.map().extent(), context.map().zoom());
78442         }
78443         return true;
78444       });
78445       function layerSupported(d2) {
78446         return d2.layer && d2.layer.supported();
78447       }
78448       function layerEnabled(d2) {
78449         return layerSupported(d2) && (d2.layer.enabled() || _savedLayers.includes(d2.id));
78450       }
78451       function layerRendered(d2) {
78452         var _a4, _b2, _c;
78453         return (_c = (_b2 = (_a4 = d2.layer).rendered) == null ? void 0 : _b2.call(_a4, context.map().zoom())) != null ? _c : true;
78454       }
78455       var ul = selection2.selectAll(".layer-list-photos").data([0]);
78456       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
78457       var li = ul.selectAll(".list-item-photos").data(data, (d2) => d2.id);
78458       li.exit().remove();
78459       var liEnter = li.enter().append("li").attr("class", function(d2) {
78460         var classes = "list-item-photos list-item-" + d2.id;
78461         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
78462           classes += " indented";
78463         }
78464         return classes;
78465       });
78466       var labelEnter = liEnter.append("label").each(function(d2) {
78467         var titleID;
78468         if (d2.id === "mapillary-signs") titleID = "mapillary.signs.tooltip";
78469         else if (d2.id === "mapillary") titleID = "mapillary_images.tooltip";
78470         else if (d2.id === "kartaview") titleID = "kartaview_images.tooltip";
78471         else titleID = d2.id.replace(/-/g, "_") + ".tooltip";
78472         select_default2(this).call(
78473           uiTooltip().title(() => {
78474             if (!layerRendered(d2)) {
78475               return _t.append("street_side.minzoom_tooltip");
78476             } else {
78477               return _t.append(titleID);
78478             }
78479           }).placement("top")
78480         );
78481       });
78482       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78483         toggleLayer(d2.id);
78484       });
78485       labelEnter.append("span").html(function(d2) {
78486         var id2 = d2.id;
78487         if (id2 === "mapillary-signs") id2 = "photo_overlays.traffic_signs";
78488         return _t.html(id2.replace(/-/g, "_") + ".title");
78489       });
78490       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
78491     }
78492     function drawPhotoTypeItems(selection2) {
78493       var data = context.photos().allPhotoTypes();
78494       function typeEnabled(d2) {
78495         return context.photos().showsPhotoType(d2);
78496       }
78497       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
78498       ul.exit().remove();
78499       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
78500       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
78501       li.exit().remove();
78502       var liEnter = li.enter().append("li").attr("class", function(d2) {
78503         return "list-item-photo-types list-item-" + d2;
78504       });
78505       var labelEnter = liEnter.append("label").each(function(d2) {
78506         select_default2(this).call(
78507           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
78508         );
78509       });
78510       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78511         context.photos().togglePhotoType(d2, true);
78512       });
78513       labelEnter.append("span").html(function(d2) {
78514         return _t.html("photo_overlays.photo_type." + d2 + ".title");
78515       });
78516       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
78517     }
78518     function drawDateSlider(selection2) {
78519       var ul = selection2.selectAll(".layer-list-date-slider").data([0]);
78520       ul.exit().remove();
78521       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-slider").merge(ul);
78522       var li = ul.selectAll(".list-item-date-slider").data(context.photos().shouldFilterDateBySlider() ? ["date-slider"] : []);
78523       li.exit().remove();
78524       var liEnter = li.enter().append("li").attr("class", "list-item-date-slider");
78525       var labelEnter = liEnter.append("label").each(function() {
78526         select_default2(this).call(
78527           uiTooltip().title(() => _t.append("photo_overlays.age_slider_filter.tooltip")).placement("top")
78528         );
78529       });
78530       labelEnter.append("span").attr("class", "dateSliderSpan").call(_t.append("photo_overlays.age_slider_filter.title"));
78531       let sliderWrap = labelEnter.append("div").attr("class", "slider-wrap");
78532       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() {
78533         let value = select_default2(this).property("value");
78534         setYearFilter(value, true, "from");
78535       });
78536       selection2.select("input.from-date").each(function() {
78537         this.value = dateSliderValue("from");
78538       });
78539       sliderWrap.append("div").attr("class", "date-slider-label");
78540       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() {
78541         let value = select_default2(this).property("value");
78542         setYearFilter(1 - value, true, "to");
78543       });
78544       selection2.select("input.to-date").each(function() {
78545         this.value = 1 - dateSliderValue("to");
78546       });
78547       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", {
78548         date: new Date(now3 - Math.pow(dateSliderValue("from"), 1.45) * 10 * 365.25 * 86400 * 1e3).toLocaleDateString(_mainLocalizer.localeCode())
78549       }));
78550       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range");
78551       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range-inverted");
78552       const dateTicks = /* @__PURE__ */ new Set();
78553       for (const dates of Object.values(photoDates)) {
78554         dates.forEach((date) => {
78555           dateTicks.add(Math.round(1e3 * Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45)) / 1e3);
78556         });
78557       }
78558       const ticks2 = selection2.select("datalist#photo-overlay-data-range").selectAll("option").data([...dateTicks].concat([1, 0]));
78559       ticks2.exit().remove();
78560       ticks2.enter().append("option").merge(ticks2).attr("value", (d2) => d2);
78561       const ticksInverted = selection2.select("datalist#photo-overlay-data-range-inverted").selectAll("option").data([...dateTicks].concat([1, 0]));
78562       ticksInverted.exit().remove();
78563       ticksInverted.enter().append("option").merge(ticksInverted).attr("value", (d2) => 1 - d2);
78564       li.merge(liEnter).classed("active", filterEnabled);
78565       function filterEnabled() {
78566         return !!context.photos().fromDate();
78567       }
78568     }
78569     function dateSliderValue(which) {
78570       const val = which === "from" ? context.photos().fromDate() : context.photos().toDate();
78571       if (val) {
78572         const date = +new Date(val);
78573         return Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45);
78574       } else return which === "from" ? 1 : 0;
78575     }
78576     function setYearFilter(value, updateUrl, which) {
78577       value = +value + (which === "from" ? 1e-3 : -1e-3);
78578       if (value < 1 && value > 0) {
78579         const date = new Date(now3 - Math.pow(value, 1.45) * 10 * 365.25 * 86400 * 1e3).toISOString().substring(0, 10);
78580         context.photos().setDateFilter(`${which}Date`, date, updateUrl);
78581       } else {
78582         context.photos().setDateFilter(`${which}Date`, null, updateUrl);
78583       }
78584     }
78585     ;
78586     function drawUsernameFilter(selection2) {
78587       function filterEnabled() {
78588         return context.photos().usernames();
78589       }
78590       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
78591       ul.exit().remove();
78592       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
78593       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
78594       li.exit().remove();
78595       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
78596       var labelEnter = liEnter.append("label").each(function() {
78597         select_default2(this).call(
78598           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
78599         );
78600       });
78601       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
78602       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
78603         var value = select_default2(this).property("value");
78604         context.photos().setUsernameFilter(value, true);
78605         select_default2(this).property("value", usernameValue);
78606       });
78607       li.merge(liEnter).classed("active", filterEnabled);
78608       function usernameValue() {
78609         var usernames = context.photos().usernames();
78610         if (usernames) return usernames.join("; ");
78611         return usernames;
78612       }
78613     }
78614     function toggleLayer(which) {
78615       setLayer(which, !showsLayer(which));
78616     }
78617     function showsLayer(which) {
78618       var layer = layers.layer(which);
78619       if (layer) {
78620         return layer.enabled();
78621       }
78622       return false;
78623     }
78624     function setLayer(which, enabled) {
78625       var layer = layers.layer(which);
78626       if (layer) {
78627         layer.enabled(enabled);
78628       }
78629     }
78630     function drawLocalPhotos(selection2) {
78631       var photoLayer = layers.layer("local-photos");
78632       var hasData = photoLayer && photoLayer.hasData();
78633       var showsData = hasData && photoLayer.enabled();
78634       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
78635       ul.exit().remove();
78636       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
78637       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
78638       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
78639       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
78640         toggleLayer("local-photos");
78641       });
78642       localPhotosLabelEnter.call(_t.append("local_photos.header"));
78643       localPhotosEnter.append("button").attr("class", "open-data-options").call(
78644         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78645       ).on("click", function(d3_event) {
78646         d3_event.preventDefault();
78647         editLocalPhotos();
78648       }).call(svgIcon("#iD-icon-more"));
78649       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
78650         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78651       ).on("click", function(d3_event) {
78652         if (select_default2(this).classed("disabled")) return;
78653         d3_event.preventDefault();
78654         d3_event.stopPropagation();
78655         photoLayer.fitZoom();
78656       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
78657       ul = ul.merge(ulEnter);
78658       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
78659       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
78660     }
78661     function editLocalPhotos() {
78662       context.container().call(settingsLocalPhotos);
78663     }
78664     function localPhotosChanged(d2) {
78665       var localPhotosLayer = layers.layer("local-photos");
78666       localPhotosLayer.fileList(d2);
78667     }
78668     function toggleStreetSide() {
78669       let layerContainer = select_default2(".photo-overlay-container");
78670       if (!_layersHidden) {
78671         layers.all().forEach((d2) => {
78672           if (_streetLayerIDs.includes(d2.id)) {
78673             if (showsLayer(d2.id)) _savedLayers.push(d2.id);
78674             setLayer(d2.id, false);
78675           }
78676         });
78677         layerContainer.classed("disabled-panel", true);
78678       } else {
78679         _savedLayers.forEach((d2) => {
78680           setLayer(d2, true);
78681         });
78682         _savedLayers = [];
78683         layerContainer.classed("disabled-panel", false);
78684       }
78685       _layersHidden = !_layersHidden;
78686     }
78687     ;
78688     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
78689     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
78690     context.layers().on("photoDatesChanged.uiSectionPhotoOverlays", function(service, dates) {
78691       photoDates[service] = dates.map((date) => +new Date(date));
78692       section.reRender();
78693     });
78694     context.keybinding().on("\u21E7P", toggleStreetSide);
78695     context.map().on(
78696       "move.photo_overlays",
78697       debounce_default(function() {
78698         window.requestIdleCallback(section.reRender);
78699       }, 1e3)
78700     );
78701     return section;
78702   }
78703   var init_photo_overlays = __esm({
78704     "modules/ui/sections/photo_overlays.js"() {
78705       "use strict";
78706       init_debounce();
78707       init_src5();
78708       init_localizer();
78709       init_tooltip();
78710       init_section();
78711       init_util();
78712       init_local_photos2();
78713       init_svg();
78714     }
78715   });
78716
78717   // modules/ui/panes/map_data.js
78718   var map_data_exports = {};
78719   __export(map_data_exports, {
78720     uiPaneMapData: () => uiPaneMapData
78721   });
78722   function uiPaneMapData(context) {
78723     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([
78724       uiSectionDataLayers(context),
78725       uiSectionPhotoOverlays(context),
78726       uiSectionMapStyleOptions(context),
78727       uiSectionMapFeatures(context)
78728     ]);
78729     return mapDataPane;
78730   }
78731   var init_map_data = __esm({
78732     "modules/ui/panes/map_data.js"() {
78733       "use strict";
78734       init_localizer();
78735       init_pane();
78736       init_data_layers();
78737       init_map_features();
78738       init_map_style_options();
78739       init_photo_overlays();
78740     }
78741   });
78742
78743   // modules/ui/panes/preferences.js
78744   var preferences_exports2 = {};
78745   __export(preferences_exports2, {
78746     uiPanePreferences: () => uiPanePreferences
78747   });
78748   function uiPanePreferences(context) {
78749     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
78750       uiSectionPrivacy(context)
78751     ]);
78752     return preferencesPane;
78753   }
78754   var init_preferences2 = __esm({
78755     "modules/ui/panes/preferences.js"() {
78756       "use strict";
78757       init_localizer();
78758       init_pane();
78759       init_privacy();
78760     }
78761   });
78762
78763   // modules/ui/init.js
78764   var init_exports = {};
78765   __export(init_exports, {
78766     uiInit: () => uiInit
78767   });
78768   function uiInit(context) {
78769     var _initCounter = 0;
78770     var _needWidth = {};
78771     var _lastPointerType;
78772     var overMap;
78773     function render(container) {
78774       container.on("click.ui", function(d3_event) {
78775         if (d3_event.button !== 0) return;
78776         if (!d3_event.composedPath) return;
78777         var isOkayTarget = d3_event.composedPath().some(function(node) {
78778           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
78779           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
78780           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
78781           node.nodeName === "A");
78782         });
78783         if (isOkayTarget) return;
78784         d3_event.preventDefault();
78785       });
78786       var detected = utilDetect();
78787       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
78788       // but we only need to do this on desktop Safari anyway. – #7694
78789       !detected.isMobileWebKit) {
78790         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
78791           d3_event.preventDefault();
78792         });
78793       }
78794       if ("PointerEvent" in window) {
78795         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
78796           var pointerType = d3_event.pointerType || "mouse";
78797           if (_lastPointerType !== pointerType) {
78798             _lastPointerType = pointerType;
78799             container.attr("pointer", pointerType);
78800           }
78801         }, true);
78802       } else {
78803         _lastPointerType = "mouse";
78804         container.attr("pointer", "mouse");
78805       }
78806       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
78807       container.call(uiFullScreen(context));
78808       var map2 = context.map();
78809       map2.redrawEnable(false);
78810       map2.on("hitMinZoom.ui", function() {
78811         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
78812       });
78813       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
78814       container.append("div").attr("class", "sidebar").call(ui.sidebar);
78815       var content = container.append("div").attr("class", "main-content active");
78816       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
78817       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
78818       overMap = content.append("div").attr("class", "over-map");
78819       overMap.append("div").attr("class", "select-trap").text("t");
78820       overMap.call(uiMapInMap(context)).call(uiNotice(context));
78821       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
78822       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
78823       var controls = controlsWrap.append("div").attr("class", "map-controls");
78824       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
78825       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
78826       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
78827       controlsWrap.on("wheel.mapControls", function(d3_event) {
78828         if (!d3_event.deltaX) {
78829           controlsWrap.node().scrollTop += d3_event.deltaY;
78830         }
78831       });
78832       var panes = overMap.append("div").attr("class", "map-panes");
78833       var uiPanes = [
78834         uiPaneBackground(context),
78835         uiPaneMapData(context),
78836         uiPaneIssues(context),
78837         uiPanePreferences(context),
78838         uiPaneHelp(context)
78839       ];
78840       uiPanes.forEach(function(pane) {
78841         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
78842         panes.call(pane.renderPane);
78843       });
78844       ui.info = uiInfo(context);
78845       overMap.call(ui.info);
78846       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
78847       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
78848       var about = content.append("div").attr("class", "map-footer");
78849       about.append("div").attr("class", "api-status").call(uiStatus(context));
78850       var footer = about.append("div").attr("class", "map-footer-bar fillD");
78851       footer.append("div").attr("class", "flash-wrap footer-hide");
78852       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
78853       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
78854       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
78855       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
78856       var apiConnections = context.connection().apiConnections();
78857       if (apiConnections && apiConnections.length > 1) {
78858         aboutList.append("li").attr("class", "source-switch").call(
78859           uiSourceSwitch(context).keys(apiConnections)
78860         );
78861       }
78862       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
78863       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
78864       var issueLinks = aboutList.append("li");
78865       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"));
78866       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"));
78867       aboutList.append("li").attr("class", "version").call(uiVersion(context));
78868       if (!context.embed()) {
78869         aboutList.call(uiAccount(context));
78870       }
78871       ui.onResize();
78872       map2.redrawEnable(true);
78873       ui.hash = behaviorHash(context);
78874       ui.hash();
78875       if (!ui.hash.hadLocation) {
78876         map2.centerZoom([0, 0], 2);
78877       }
78878       window.onbeforeunload = function() {
78879         return context.save();
78880       };
78881       window.onunload = function() {
78882         context.history().unlock();
78883       };
78884       select_default2(window).on("resize.editor", function() {
78885         ui.onResize();
78886       });
78887       var panPixels = 80;
78888       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) {
78889         if (d3_event) {
78890           d3_event.stopImmediatePropagation();
78891           d3_event.preventDefault();
78892         }
78893         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
78894         if (previousBackground) {
78895           var currentBackground = context.background().baseLayerSource();
78896           corePreferences("background-last-used-toggle", currentBackground.id);
78897           corePreferences("background-last-used", previousBackground.id);
78898           context.background().baseLayerSource(previousBackground);
78899         }
78900       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
78901         d3_event.preventDefault();
78902         d3_event.stopPropagation();
78903         context.map().toggleWireframe();
78904       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
78905         d3_event.preventDefault();
78906         d3_event.stopPropagation();
78907         var mode = context.mode();
78908         if (mode && /^draw/.test(mode.id)) return;
78909         var layer = context.layers().layer("osm");
78910         if (layer) {
78911           layer.enabled(!layer.enabled());
78912           if (!layer.enabled()) {
78913             context.enter(modeBrowse(context));
78914           }
78915         }
78916       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
78917         d3_event.preventDefault();
78918         context.map().toggleHighlightEdited();
78919       });
78920       context.on("enter.editor", function(entered) {
78921         container.classed("mode-" + entered.id, true);
78922       }).on("exit.editor", function(exited) {
78923         container.classed("mode-" + exited.id, false);
78924       });
78925       context.enter(modeBrowse(context));
78926       if (!_initCounter++) {
78927         if (!ui.hash.startWalkthrough) {
78928           context.container().call(uiSplash(context)).call(uiRestore(context));
78929         }
78930         context.container().call(ui.shortcuts);
78931       }
78932       var osm = context.connection();
78933       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
78934       if (osm && auth) {
78935         osm.on("authLoading.ui", function() {
78936           context.container().call(auth);
78937         }).on("authDone.ui", function() {
78938           auth.close();
78939         });
78940       }
78941       _initCounter++;
78942       if (ui.hash.startWalkthrough) {
78943         ui.hash.startWalkthrough = false;
78944         context.container().call(uiIntro(context));
78945       }
78946       function pan(d2) {
78947         return function(d3_event) {
78948           if (d3_event.shiftKey) return;
78949           if (context.container().select(".combobox").size()) return;
78950           d3_event.preventDefault();
78951           context.map().pan(d2, 100);
78952         };
78953       }
78954     }
78955     let ui = {};
78956     let _loadPromise;
78957     ui.ensureLoaded = () => {
78958       if (_loadPromise) return _loadPromise;
78959       return _loadPromise = Promise.all([
78960         // must have strings and presets before loading the UI
78961         _mainLocalizer.ensureLoaded(),
78962         _mainPresetIndex.ensureLoaded()
78963       ]).then(() => {
78964         if (!context.container().empty()) render(context.container());
78965       }).catch((err) => console.error(err));
78966     };
78967     ui.restart = function() {
78968       context.keybinding().clear();
78969       _loadPromise = null;
78970       context.container().selectAll("*").remove();
78971       ui.ensureLoaded();
78972     };
78973     ui.lastPointerType = function() {
78974       return _lastPointerType;
78975     };
78976     ui.svgDefs = svgDefs(context);
78977     ui.flash = uiFlash(context);
78978     ui.sidebar = uiSidebar(context);
78979     ui.photoviewer = uiPhotoviewer(context);
78980     ui.shortcuts = uiShortcuts(context);
78981     ui.onResize = function(withPan) {
78982       var map2 = context.map();
78983       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
78984       utilGetDimensions(context.container().select(".sidebar"), true);
78985       if (withPan !== void 0) {
78986         map2.redrawEnable(false);
78987         map2.pan(withPan);
78988         map2.redrawEnable(true);
78989       }
78990       map2.dimensions(mapDimensions);
78991       ui.photoviewer.onMapResize();
78992       ui.checkOverflow(".top-toolbar");
78993       ui.checkOverflow(".map-footer-bar");
78994       var resizeWindowEvent = document.createEvent("Event");
78995       resizeWindowEvent.initEvent("resizeWindow", true, true);
78996       document.dispatchEvent(resizeWindowEvent);
78997     };
78998     ui.checkOverflow = function(selector, reset) {
78999       if (reset) {
79000         delete _needWidth[selector];
79001       }
79002       var selection2 = context.container().select(selector);
79003       if (selection2.empty()) return;
79004       var scrollWidth = selection2.property("scrollWidth");
79005       var clientWidth = selection2.property("clientWidth");
79006       var needed = _needWidth[selector] || scrollWidth;
79007       if (scrollWidth > clientWidth) {
79008         selection2.classed("narrow", true);
79009         if (!_needWidth[selector]) {
79010           _needWidth[selector] = scrollWidth;
79011         }
79012       } else if (scrollWidth >= needed) {
79013         selection2.classed("narrow", false);
79014       }
79015     };
79016     ui.togglePanes = function(showPane) {
79017       var hidePanes = context.container().selectAll(".map-pane.shown");
79018       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
79019       hidePanes.classed("shown", false).classed("hide", true);
79020       context.container().selectAll(".map-pane-control button").classed("active", false);
79021       if (showPane) {
79022         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
79023         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
79024         showPane.classed("shown", true).classed("hide", false);
79025         if (hidePanes.empty()) {
79026           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
79027         } else {
79028           showPane.style(side, "0px");
79029         }
79030       } else {
79031         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
79032           select_default2(this).classed("shown", false).classed("hide", true);
79033         });
79034       }
79035     };
79036     var _editMenu = uiEditMenu(context);
79037     ui.editMenu = function() {
79038       return _editMenu;
79039     };
79040     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
79041       ui.closeEditMenu();
79042       if (!operations && context.mode().operations) operations = context.mode().operations();
79043       if (!operations || !operations.length) return;
79044       if (!context.map().editableDataEnabled()) return;
79045       var surfaceNode = context.surface().node();
79046       if (surfaceNode.focus) {
79047         surfaceNode.focus();
79048       }
79049       operations.forEach(function(operation2) {
79050         if (operation2.point) operation2.point(anchorPoint);
79051       });
79052       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
79053       overMap.call(_editMenu);
79054     };
79055     ui.closeEditMenu = function() {
79056       if (overMap !== void 0) {
79057         overMap.select(".edit-menu").remove();
79058       }
79059     };
79060     var _saveLoading = select_default2(null);
79061     context.uploader().on("saveStarted.ui", function() {
79062       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
79063       context.container().call(_saveLoading);
79064     }).on("saveEnded.ui", function() {
79065       _saveLoading.close();
79066       _saveLoading = select_default2(null);
79067     });
79068     k.use({
79069       mangle: false,
79070       headerIds: false
79071     });
79072     return ui;
79073   }
79074   var init_init2 = __esm({
79075     "modules/ui/init.js"() {
79076       "use strict";
79077       init_marked_esm();
79078       init_src5();
79079       init_preferences();
79080       init_localizer();
79081       init_presets();
79082       init_behavior();
79083       init_browse();
79084       init_svg();
79085       init_detect();
79086       init_dimensions();
79087       init_account();
79088       init_attribution();
79089       init_contributors();
79090       init_edit_menu();
79091       init_feature_info();
79092       init_flash();
79093       init_full_screen();
79094       init_geolocate2();
79095       init_info();
79096       init_intro2();
79097       init_issues_info();
79098       init_loading();
79099       init_map_in_map();
79100       init_notice();
79101       init_photoviewer();
79102       init_restore();
79103       init_scale2();
79104       init_shortcuts();
79105       init_sidebar();
79106       init_source_switch();
79107       init_spinner();
79108       init_splash();
79109       init_status();
79110       init_tooltip();
79111       init_top_toolbar();
79112       init_version();
79113       init_zoom3();
79114       init_zoom_to_selection();
79115       init_cmd();
79116       init_background3();
79117       init_help();
79118       init_issues();
79119       init_map_data();
79120       init_preferences2();
79121     }
79122   });
79123
79124   // modules/ui/commit_warnings.js
79125   var commit_warnings_exports = {};
79126   __export(commit_warnings_exports, {
79127     uiCommitWarnings: () => uiCommitWarnings
79128   });
79129   function uiCommitWarnings(context) {
79130     function commitWarnings(selection2) {
79131       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
79132       for (var severity in issuesBySeverity) {
79133         var issues = issuesBySeverity[severity];
79134         if (severity !== "error") {
79135           issues = issues.filter(function(issue) {
79136             return issue.type !== "help_request";
79137           });
79138         }
79139         var section = severity + "-section";
79140         var issueItem = severity + "-item";
79141         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
79142         container.exit().remove();
79143         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
79144         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
79145         containerEnter.append("ul").attr("class", "changeset-list");
79146         container = containerEnter.merge(container);
79147         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
79148           return d2.key;
79149         });
79150         items.exit().remove();
79151         var itemsEnter = items.enter().append("li").attr("class", issueItem);
79152         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
79153           if (d2.entityIds) {
79154             context.surface().selectAll(
79155               utilEntityOrMemberSelector(
79156                 d2.entityIds,
79157                 context.graph()
79158               )
79159             ).classed("hover", true);
79160           }
79161         }).on("mouseout", function() {
79162           context.surface().selectAll(".hover").classed("hover", false);
79163         }).on("click", function(d3_event, d2) {
79164           context.validator().focusIssue(d2);
79165         });
79166         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
79167         buttons.append("strong").attr("class", "issue-message");
79168         buttons.filter(function(d2) {
79169           return d2.tooltip;
79170         }).call(
79171           uiTooltip().title(function(d2) {
79172             return d2.tooltip;
79173           }).placement("top")
79174         );
79175         items = itemsEnter.merge(items);
79176         items.selectAll(".issue-message").text("").each(function(d2) {
79177           return d2.message(context)(select_default2(this));
79178         });
79179       }
79180     }
79181     return commitWarnings;
79182   }
79183   var init_commit_warnings = __esm({
79184     "modules/ui/commit_warnings.js"() {
79185       "use strict";
79186       init_src5();
79187       init_localizer();
79188       init_icon();
79189       init_tooltip();
79190       init_util();
79191     }
79192   });
79193
79194   // modules/ui/lasso.js
79195   var lasso_exports = {};
79196   __export(lasso_exports, {
79197     uiLasso: () => uiLasso
79198   });
79199   function uiLasso(context) {
79200     var group, polygon2;
79201     lasso.coordinates = [];
79202     function lasso(selection2) {
79203       context.container().classed("lasso", true);
79204       group = selection2.append("g").attr("class", "lasso hide");
79205       polygon2 = group.append("path").attr("class", "lasso-path");
79206       group.call(uiToggle(true));
79207     }
79208     function draw() {
79209       if (polygon2) {
79210         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
79211           return "M" + d2.join(" L") + " Z";
79212         });
79213       }
79214     }
79215     lasso.extent = function() {
79216       return lasso.coordinates.reduce(function(extent, point) {
79217         return extent.extend(geoExtent(point));
79218       }, geoExtent());
79219     };
79220     lasso.p = function(_3) {
79221       if (!arguments.length) return lasso;
79222       lasso.coordinates.push(_3);
79223       draw();
79224       return lasso;
79225     };
79226     lasso.close = function() {
79227       if (group) {
79228         group.call(uiToggle(false, function() {
79229           select_default2(this).remove();
79230         }));
79231       }
79232       context.container().classed("lasso", false);
79233     };
79234     return lasso;
79235   }
79236   var init_lasso = __esm({
79237     "modules/ui/lasso.js"() {
79238       "use strict";
79239       init_src5();
79240       init_geo2();
79241       init_toggle();
79242     }
79243   });
79244
79245   // node_modules/osm-community-index/lib/simplify.js
79246   function simplify2(str) {
79247     if (typeof str !== "string") return "";
79248     return import_diacritics2.default.remove(
79249       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()
79250     );
79251   }
79252   var import_diacritics2;
79253   var init_simplify2 = __esm({
79254     "node_modules/osm-community-index/lib/simplify.js"() {
79255       import_diacritics2 = __toESM(require_diacritics(), 1);
79256     }
79257   });
79258
79259   // node_modules/osm-community-index/lib/resolve_strings.js
79260   function resolveStrings(item, defaults, localizerFn) {
79261     let itemStrings = Object.assign({}, item.strings);
79262     let defaultStrings = Object.assign({}, defaults[item.type]);
79263     const anyToken = new RegExp(/(\{\w+\})/, "gi");
79264     if (localizerFn) {
79265       if (itemStrings.community) {
79266         const communityID = simplify2(itemStrings.community);
79267         itemStrings.community = localizerFn(`_communities.${communityID}`);
79268       }
79269       ["name", "description", "extendedDescription"].forEach((prop) => {
79270         if (defaultStrings[prop]) defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
79271         if (itemStrings[prop]) itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
79272       });
79273     }
79274     let replacements = {
79275       account: item.account,
79276       community: itemStrings.community,
79277       signupUrl: itemStrings.signupUrl,
79278       url: itemStrings.url
79279     };
79280     if (!replacements.signupUrl) {
79281       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
79282     }
79283     if (!replacements.url) {
79284       replacements.url = resolve(itemStrings.url || defaultStrings.url);
79285     }
79286     let resolved = {
79287       name: resolve(itemStrings.name || defaultStrings.name),
79288       url: resolve(itemStrings.url || defaultStrings.url),
79289       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
79290       description: resolve(itemStrings.description || defaultStrings.description),
79291       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
79292     };
79293     resolved.nameHTML = linkify(resolved.url, resolved.name);
79294     resolved.urlHTML = linkify(resolved.url);
79295     resolved.signupUrlHTML = linkify(resolved.signupUrl);
79296     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
79297     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
79298     return resolved;
79299     function resolve(s2, addLinks) {
79300       if (!s2) return void 0;
79301       let result = s2;
79302       for (let key in replacements) {
79303         const token = `{${key}}`;
79304         const regex = new RegExp(token, "g");
79305         if (regex.test(result)) {
79306           let replacement = replacements[key];
79307           if (!replacement) {
79308             throw new Error(`Cannot resolve token: ${token}`);
79309           } else {
79310             if (addLinks && (key === "signupUrl" || key === "url")) {
79311               replacement = linkify(replacement);
79312             }
79313             result = result.replace(regex, replacement);
79314           }
79315         }
79316       }
79317       const leftovers = result.match(anyToken);
79318       if (leftovers) {
79319         throw new Error(`Cannot resolve tokens: ${leftovers}`);
79320       }
79321       if (addLinks && item.type === "reddit") {
79322         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
79323       }
79324       return result;
79325     }
79326     function linkify(url, text) {
79327       if (!url) return void 0;
79328       text = text || url;
79329       return `<a target="_blank" href="${url}">${text}</a>`;
79330     }
79331   }
79332   var init_resolve_strings = __esm({
79333     "node_modules/osm-community-index/lib/resolve_strings.js"() {
79334       init_simplify2();
79335     }
79336   });
79337
79338   // node_modules/osm-community-index/index.mjs
79339   var init_osm_community_index = __esm({
79340     "node_modules/osm-community-index/index.mjs"() {
79341       init_resolve_strings();
79342       init_simplify2();
79343     }
79344   });
79345
79346   // modules/ui/success.js
79347   var success_exports = {};
79348   __export(success_exports, {
79349     uiSuccess: () => uiSuccess
79350   });
79351   function uiSuccess(context) {
79352     const MAXEVENTS = 2;
79353     const dispatch14 = dispatch_default("cancel");
79354     let _changeset2;
79355     let _location;
79356     ensureOSMCommunityIndex();
79357     function ensureOSMCommunityIndex() {
79358       const data = _mainFileFetcher;
79359       return Promise.all([
79360         data.get("oci_features"),
79361         data.get("oci_resources"),
79362         data.get("oci_defaults")
79363       ]).then((vals) => {
79364         if (_oci) return _oci;
79365         if (vals[0] && Array.isArray(vals[0].features)) {
79366           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
79367         }
79368         let ociResources = Object.values(vals[1].resources);
79369         if (ociResources.length) {
79370           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
79371             _oci = {
79372               resources: ociResources,
79373               defaults: vals[2].defaults
79374             };
79375             return _oci;
79376           });
79377         } else {
79378           _oci = {
79379             resources: [],
79380             // no resources?
79381             defaults: vals[2].defaults
79382           };
79383           return _oci;
79384         }
79385       });
79386     }
79387     function parseEventDate(when) {
79388       if (!when) return;
79389       let raw = when.trim();
79390       if (!raw) return;
79391       if (!/Z$/.test(raw)) {
79392         raw += "Z";
79393       }
79394       const parsed = new Date(raw);
79395       return new Date(parsed.toUTCString().slice(0, 25));
79396     }
79397     function success(selection2) {
79398       let header = selection2.append("div").attr("class", "header fillL");
79399       header.append("h2").call(_t.append("success.just_edited"));
79400       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
79401       let body = selection2.append("div").attr("class", "body save-success fillL");
79402       let summary = body.append("div").attr("class", "save-summary");
79403       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
79404       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"));
79405       let osm = context.connection();
79406       if (!osm) return;
79407       let changesetURL = osm.changesetURL(_changeset2.id);
79408       let table = summary.append("table").attr("class", "summary-table");
79409       let row = table.append("tr").attr("class", "summary-row");
79410       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");
79411       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
79412       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
79413       summaryDetail.append("div").html(_t.html("success.changeset_id", {
79414         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
79415       }));
79416       if (showDonationMessage !== false) {
79417         const donationUrl = "https://supporting.openstreetmap.org/";
79418         let supporting = body.append("div").attr("class", "save-supporting");
79419         supporting.append("h3").call(_t.append("success.supporting.title"));
79420         supporting.append("p").call(_t.append("success.supporting.details"));
79421         table = supporting.append("table").attr("class", "supporting-table");
79422         row = table.append("tr").attr("class", "supporting-row");
79423         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");
79424         let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
79425         supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
79426         supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
79427       }
79428       ensureOSMCommunityIndex().then((oci) => {
79429         const loc = context.map().center();
79430         const validHere = _sharedLocationManager.locationSetsAt(loc);
79431         let communities = [];
79432         oci.resources.forEach((resource) => {
79433           let area = validHere[resource.locationSetID];
79434           if (!area) return;
79435           const localizer = (stringID) => _t.html(`community.${stringID}`);
79436           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
79437           communities.push({
79438             area,
79439             order: resource.order || 0,
79440             resource
79441           });
79442         });
79443         communities.sort((a4, b3) => a4.area - b3.area || b3.order - a4.order);
79444         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
79445       });
79446     }
79447     function showCommunityLinks(selection2, resources) {
79448       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
79449       communityLinks.append("h3").call(_t.append("success.like_osm"));
79450       let table = communityLinks.append("table").attr("class", "community-table");
79451       let row = table.selectAll(".community-row").data(resources);
79452       let rowEnter = row.enter().append("tr").attr("class", "community-row");
79453       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}`);
79454       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
79455       communityDetail.each(showCommunityDetails);
79456       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"));
79457     }
79458     function showCommunityDetails(d2) {
79459       let selection2 = select_default2(this);
79460       let communityID = d2.id;
79461       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
79462       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
79463       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
79464         selection2.append("div").call(
79465           uiDisclosure(context, `community-more-${d2.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
79466         );
79467       }
79468       let nextEvents = (d2.events || []).map((event) => {
79469         event.date = parseEventDate(event.when);
79470         return event;
79471       }).filter((event) => {
79472         const t2 = event.date.getTime();
79473         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
79474         return !isNaN(t2) && t2 >= now3;
79475       }).sort((a4, b3) => {
79476         return a4.date < b3.date ? -1 : a4.date > b3.date ? 1 : 0;
79477       }).slice(0, MAXEVENTS);
79478       if (nextEvents.length) {
79479         selection2.append("div").call(
79480           uiDisclosure(context, `community-events-${d2.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
79481         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
79482       }
79483       function showMore(selection3) {
79484         let more = selection3.selectAll(".community-more").data([0]);
79485         let moreEnter = more.enter().append("div").attr("class", "community-more");
79486         if (d2.resolved.extendedDescriptionHTML) {
79487           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
79488         }
79489         if (d2.languageCodes && d2.languageCodes.length) {
79490           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
79491           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
79492         }
79493       }
79494       function showNextEvents(selection3) {
79495         let events = selection3.append("div").attr("class", "community-events");
79496         let item = events.selectAll(".community-event").data(nextEvents);
79497         let itemEnter = item.enter().append("div").attr("class", "community-event");
79498         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
79499           let name = d4.name;
79500           if (d4.i18n && d4.id) {
79501             name = _t(`community.${communityID}.events.${d4.id}.name`, { default: name });
79502           }
79503           return name;
79504         });
79505         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
79506           let options = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
79507           if (d4.date.getHours() || d4.date.getMinutes()) {
79508             options.hour = "numeric";
79509             options.minute = "numeric";
79510           }
79511           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options);
79512         });
79513         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
79514           let where = d4.where;
79515           if (d4.i18n && d4.id) {
79516             where = _t(`community.${communityID}.events.${d4.id}.where`, { default: where });
79517           }
79518           return where;
79519         });
79520         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
79521           let description = d4.description;
79522           if (d4.i18n && d4.id) {
79523             description = _t(`community.${communityID}.events.${d4.id}.description`, { default: description });
79524           }
79525           return description;
79526         });
79527       }
79528     }
79529     success.changeset = function(val) {
79530       if (!arguments.length) return _changeset2;
79531       _changeset2 = val;
79532       return success;
79533     };
79534     success.location = function(val) {
79535       if (!arguments.length) return _location;
79536       _location = val;
79537       return success;
79538     };
79539     return utilRebind(success, dispatch14, "on");
79540   }
79541   var _oci;
79542   var init_success = __esm({
79543     "modules/ui/success.js"() {
79544       "use strict";
79545       init_src4();
79546       init_src5();
79547       init_osm_community_index();
79548       init_id();
79549       init_file_fetcher();
79550       init_LocationManager();
79551       init_localizer();
79552       init_icon();
79553       init_disclosure();
79554       init_rebind();
79555       _oci = null;
79556     }
79557   });
79558
79559   // modules/ui/index.js
79560   var ui_exports = {};
79561   __export(ui_exports, {
79562     uiAccount: () => uiAccount,
79563     uiAttribution: () => uiAttribution,
79564     uiChangesetEditor: () => uiChangesetEditor,
79565     uiCmd: () => uiCmd,
79566     uiCombobox: () => uiCombobox,
79567     uiCommit: () => uiCommit,
79568     uiCommitWarnings: () => uiCommitWarnings,
79569     uiConfirm: () => uiConfirm,
79570     uiConflicts: () => uiConflicts,
79571     uiContributors: () => uiContributors,
79572     uiCurtain: () => uiCurtain,
79573     uiDataEditor: () => uiDataEditor,
79574     uiDataHeader: () => uiDataHeader,
79575     uiDisclosure: () => uiDisclosure,
79576     uiEditMenu: () => uiEditMenu,
79577     uiEntityEditor: () => uiEntityEditor,
79578     uiFeatureInfo: () => uiFeatureInfo,
79579     uiFeatureList: () => uiFeatureList,
79580     uiField: () => uiField,
79581     uiFieldHelp: () => uiFieldHelp,
79582     uiFlash: () => uiFlash,
79583     uiFormFields: () => uiFormFields,
79584     uiFullScreen: () => uiFullScreen,
79585     uiGeolocate: () => uiGeolocate,
79586     uiInfo: () => uiInfo,
79587     uiInit: () => uiInit,
79588     uiInspector: () => uiInspector,
79589     uiIssuesInfo: () => uiIssuesInfo,
79590     uiKeepRightDetails: () => uiKeepRightDetails,
79591     uiKeepRightEditor: () => uiKeepRightEditor,
79592     uiKeepRightHeader: () => uiKeepRightHeader,
79593     uiLasso: () => uiLasso,
79594     uiLengthIndicator: () => uiLengthIndicator,
79595     uiLoading: () => uiLoading,
79596     uiMapInMap: () => uiMapInMap,
79597     uiModal: () => uiModal,
79598     uiNoteComments: () => uiNoteComments,
79599     uiNoteEditor: () => uiNoteEditor,
79600     uiNoteHeader: () => uiNoteHeader,
79601     uiNoteReport: () => uiNoteReport,
79602     uiNotice: () => uiNotice,
79603     uiPopover: () => uiPopover,
79604     uiPresetIcon: () => uiPresetIcon,
79605     uiPresetList: () => uiPresetList,
79606     uiRestore: () => uiRestore,
79607     uiScale: () => uiScale,
79608     uiSidebar: () => uiSidebar,
79609     uiSourceSwitch: () => uiSourceSwitch,
79610     uiSpinner: () => uiSpinner,
79611     uiSplash: () => uiSplash,
79612     uiStatus: () => uiStatus,
79613     uiSuccess: () => uiSuccess,
79614     uiTagReference: () => uiTagReference,
79615     uiToggle: () => uiToggle,
79616     uiTooltip: () => uiTooltip,
79617     uiVersion: () => uiVersion,
79618     uiViewOnKeepRight: () => uiViewOnKeepRight,
79619     uiViewOnOSM: () => uiViewOnOSM,
79620     uiZoom: () => uiZoom
79621   });
79622   var init_ui = __esm({
79623     "modules/ui/index.js"() {
79624       "use strict";
79625       init_init2();
79626       init_account();
79627       init_attribution();
79628       init_changeset_editor();
79629       init_cmd();
79630       init_combobox();
79631       init_commit();
79632       init_commit_warnings();
79633       init_confirm();
79634       init_conflicts();
79635       init_contributors();
79636       init_curtain();
79637       init_data_editor();
79638       init_data_header();
79639       init_disclosure();
79640       init_edit_menu();
79641       init_entity_editor();
79642       init_feature_info();
79643       init_feature_list();
79644       init_field2();
79645       init_field_help();
79646       init_flash();
79647       init_form_fields();
79648       init_full_screen();
79649       init_geolocate2();
79650       init_info();
79651       init_inspector();
79652       init_issues_info();
79653       init_keepRight_details();
79654       init_keepRight_editor();
79655       init_keepRight_header();
79656       init_length_indicator();
79657       init_lasso();
79658       init_loading();
79659       init_map_in_map();
79660       init_modal();
79661       init_notice();
79662       init_note_comments();
79663       init_note_editor();
79664       init_note_header();
79665       init_note_report();
79666       init_popover();
79667       init_preset_icon();
79668       init_preset_list();
79669       init_restore();
79670       init_scale2();
79671       init_sidebar();
79672       init_source_switch();
79673       init_spinner();
79674       init_splash();
79675       init_status();
79676       init_success();
79677       init_tag_reference();
79678       init_toggle();
79679       init_tooltip();
79680       init_version();
79681       init_view_on_osm();
79682       init_view_on_keepRight();
79683       init_zoom3();
79684     }
79685   });
79686
79687   // modules/ui/fields/input.js
79688   var input_exports = {};
79689   __export(input_exports, {
79690     likelyRawNumberFormat: () => likelyRawNumberFormat,
79691     uiFieldColour: () => uiFieldText,
79692     uiFieldEmail: () => uiFieldText,
79693     uiFieldIdentifier: () => uiFieldText,
79694     uiFieldNumber: () => uiFieldText,
79695     uiFieldTel: () => uiFieldText,
79696     uiFieldText: () => uiFieldText,
79697     uiFieldUrl: () => uiFieldText
79698   });
79699   function uiFieldText(field, context) {
79700     var dispatch14 = dispatch_default("change");
79701     var input = select_default2(null);
79702     var outlinkButton = select_default2(null);
79703     var wrap2 = select_default2(null);
79704     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
79705     var _entityIDs = [];
79706     var _tags;
79707     var _phoneFormats = {};
79708     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
79709     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
79710     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
79711     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
79712     if (field.type === "tel") {
79713       _mainFileFetcher.get("phone_formats").then(function(d2) {
79714         _phoneFormats = d2;
79715         updatePhonePlaceholder();
79716       }).catch(function() {
79717       });
79718     }
79719     function calcLocked() {
79720       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
79721         var entity = context.graph().hasEntity(entityID);
79722         if (!entity) return false;
79723         if (entity.tags.wikidata) return true;
79724         var preset = _mainPresetIndex.match(entity, context.graph());
79725         var isSuggestion = preset && preset.suggestion;
79726         var which = field.id;
79727         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
79728       });
79729       field.locked(isLocked);
79730     }
79731     function i3(selection2) {
79732       calcLocked();
79733       var isLocked = field.locked();
79734       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
79735       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
79736       input = wrap2.selectAll("input").data([0]);
79737       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);
79738       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
79739       wrap2.call(_lengthIndicator);
79740       if (field.type === "tel") {
79741         updatePhonePlaceholder();
79742       } else if (field.type === "number") {
79743         var rtl = _mainLocalizer.textDirection() === "rtl";
79744         input.attr("type", "text");
79745         var inc = field.increment;
79746         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
79747         buttons.enter().append("button").attr("class", function(d2) {
79748           var which = d2 > 0 ? "increment" : "decrement";
79749           return "form-field-button " + which;
79750         }).attr("title", function(d2) {
79751           var which = d2 > 0 ? "increment" : "decrement";
79752           return _t(`inspector.${which}`);
79753         }).merge(buttons).on("click", function(d3_event, d2) {
79754           d3_event.preventDefault();
79755           var isMixed = Array.isArray(_tags[field.key]);
79756           if (isMixed) return;
79757           var raw_vals = input.node().value || "0";
79758           var vals = raw_vals.split(";");
79759           vals = vals.map(function(v3) {
79760             v3 = v3.trim();
79761             const isRawNumber = likelyRawNumberFormat.test(v3);
79762             var num = isRawNumber ? parseFloat(v3) : parseLocaleFloat(v3);
79763             if (isDirectionField) {
79764               const compassDir = cardinal[v3.toLowerCase()];
79765               if (compassDir !== void 0) {
79766                 num = compassDir;
79767               }
79768             }
79769             if (!isFinite(num)) return v3;
79770             num = parseFloat(num);
79771             if (!isFinite(num)) return v3;
79772             num += d2;
79773             if (isDirectionField) {
79774               num = (num % 360 + 360) % 360;
79775             }
79776             return formatFloat(clamped(num), isRawNumber ? v3.includes(".") ? v3.split(".")[1].length : 0 : countDecimalPlaces(v3));
79777           });
79778           input.node().value = vals.join(";");
79779           change()();
79780         });
79781       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
79782         input.attr("type", "text");
79783         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
79784         outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
79785           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
79786           if (domainResults.length >= 2 && domainResults[1]) {
79787             var domain = domainResults[1];
79788             return _t("icons.view_on", { domain });
79789           }
79790           return "";
79791         }).merge(outlinkButton);
79792         outlinkButton.on("click", function(d3_event) {
79793           d3_event.preventDefault();
79794           var value = validIdentifierValueForLink();
79795           if (value) {
79796             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
79797             window.open(url, "_blank");
79798           }
79799         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
79800       } else if (field.type === "url") {
79801         input.attr("type", "text");
79802         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
79803         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) {
79804           d3_event.preventDefault();
79805           const value = validIdentifierValueForLink();
79806           if (value) window.open(value, "_blank");
79807         }).merge(outlinkButton);
79808       } else if (field.type === "colour") {
79809         input.attr("type", "text");
79810         updateColourPreview();
79811       } else if (field.type === "date") {
79812         input.attr("type", "text");
79813         updateDateField();
79814       }
79815     }
79816     function updateColourPreview() {
79817       wrap2.selectAll(".colour-preview").remove();
79818       const colour = utilGetSetValue(input);
79819       if (!isColourValid(colour) && colour !== "") {
79820         wrap2.selectAll("input.colour-selector").remove();
79821         wrap2.selectAll(".form-field-button").remove();
79822         return;
79823       }
79824       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
79825       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
79826         d3_event.preventDefault();
79827         var colour2 = this.value;
79828         if (!isColourValid(colour2)) return;
79829         utilGetSetValue(input, this.value);
79830         change()();
79831         updateColourPreview();
79832       }, 100));
79833       wrap2.selectAll("input.colour-selector").attr("value", colour);
79834       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
79835       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
79836       if (colour === "") {
79837         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
79838       }
79839       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
79840     }
79841     function updateDateField() {
79842       function isDateValid(date2) {
79843         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
79844       }
79845       const date = utilGetSetValue(input);
79846       const now3 = /* @__PURE__ */ new Date();
79847       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
79848       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
79849         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", () => {
79850           utilGetSetValue(input, today);
79851           change()();
79852           updateDateField();
79853         });
79854       } else {
79855         wrap2.selectAll(".date-set-today").remove();
79856       }
79857       if (!isDateValid(date) && date !== "") {
79858         wrap2.selectAll("input.date-selector").remove();
79859         wrap2.selectAll(".date-calendar").remove();
79860         return;
79861       }
79862       if (utilDetect().browser !== "Safari") {
79863         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
79864         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
79865           d3_event.preventDefault();
79866           var date2 = this.value;
79867           if (!isDateValid(date2)) return;
79868           utilGetSetValue(input, this.value);
79869           change()();
79870           updateDateField();
79871         }, 100));
79872         wrap2.selectAll("input.date-selector").attr("value", date);
79873         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
79874         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
79875         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
79876       }
79877     }
79878     function updatePhonePlaceholder() {
79879       if (input.empty() || !Object.keys(_phoneFormats).length) return;
79880       var extent = combinedEntityExtent();
79881       var countryCode = extent && iso1A2Code(extent.center());
79882       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
79883       if (format2) input.attr("placeholder", format2);
79884     }
79885     function validIdentifierValueForLink() {
79886       var _a4;
79887       const value = utilGetSetValue(input).trim();
79888       if (field.type === "url" && value) {
79889         try {
79890           return new URL(value).href;
79891         } catch {
79892           return null;
79893         }
79894       }
79895       if (field.type === "identifier" && field.pattern) {
79896         return value && ((_a4 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a4[0]);
79897       }
79898       return null;
79899     }
79900     function clamped(num) {
79901       if (field.minValue !== void 0) {
79902         num = Math.max(num, field.minValue);
79903       }
79904       if (field.maxValue !== void 0) {
79905         num = Math.min(num, field.maxValue);
79906       }
79907       return num;
79908     }
79909     function getVals(tags) {
79910       if (field.keys) {
79911         const multiSelection = context.selectedIDs();
79912         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
79913         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]));
79914       } else {
79915         return new Set([].concat(tags[field.key]));
79916       }
79917     }
79918     function change(onInput) {
79919       return function() {
79920         var t2 = {};
79921         var val = utilGetSetValue(input);
79922         if (!onInput) val = context.cleanTagValue(val);
79923         if (!val && getVals(_tags).size > 1) return;
79924         let displayVal = val;
79925         if (field.type === "number" && val) {
79926           const numbers2 = val.split(";").map((v3) => {
79927             if (likelyRawNumberFormat.test(v3)) {
79928               return {
79929                 v: v3,
79930                 num: parseFloat(v3),
79931                 fractionDigits: v3.includes(".") ? v3.split(".")[1].length : 0
79932               };
79933             } else {
79934               return {
79935                 v: v3,
79936                 num: parseLocaleFloat(v3),
79937                 fractionDigits: countDecimalPlaces(v3)
79938               };
79939             }
79940           });
79941           val = numbers2.map(({ num, v: v3, fractionDigits }) => {
79942             if (!isFinite(num)) return v3;
79943             return clamped(num).toFixed(fractionDigits);
79944           }).join(";");
79945           displayVal = numbers2.map(({ num, v: v3, fractionDigits }) => {
79946             if (!isFinite(num)) return v3;
79947             return formatFloat(clamped(num), fractionDigits);
79948           }).join(";");
79949         }
79950         if (!onInput) utilGetSetValue(input, displayVal);
79951         t2[field.key] = val || void 0;
79952         if (field.keys) {
79953           dispatch14.call("change", this, (tags) => {
79954             if (field.keys.some((key) => tags[key])) {
79955               field.keys.filter((key) => tags[key]).forEach((key) => {
79956                 tags[key] = val || void 0;
79957               });
79958             } else {
79959               tags[field.key] = val || void 0;
79960             }
79961             return tags;
79962           }, onInput);
79963         } else {
79964           dispatch14.call("change", this, t2, onInput);
79965         }
79966       };
79967     }
79968     i3.entityIDs = function(val) {
79969       if (!arguments.length) return _entityIDs;
79970       _entityIDs = val;
79971       return i3;
79972     };
79973     i3.tags = function(tags) {
79974       var _a4;
79975       _tags = tags;
79976       const vals = getVals(tags);
79977       const isMixed = vals.size > 1;
79978       var val = vals.size === 1 ? (_a4 = [...vals][0]) != null ? _a4 : "" : "";
79979       var shouldUpdate;
79980       if (field.type === "number" && val) {
79981         var numbers2 = val.split(";");
79982         var oriNumbers = utilGetSetValue(input).split(";");
79983         if (numbers2.length !== oriNumbers.length) shouldUpdate = true;
79984         numbers2 = numbers2.map(function(v3) {
79985           v3 = v3.trim();
79986           var num = Number(v3);
79987           if (!isFinite(num) || v3 === "") return v3;
79988           const fractionDigits = v3.includes(".") ? v3.split(".")[1].length : 0;
79989           return formatFloat(num, fractionDigits);
79990         });
79991         val = numbers2.join(";");
79992         shouldUpdate = (inputValue, setValue) => {
79993           const inputNums = inputValue.split(";").map((val2) => {
79994             const parsedNum = likelyRawNumberFormat.test(val2) ? parseFloat(val2) : parseLocaleFloat(val2);
79995             if (!isFinite(parsedNum)) return val2;
79996             return parsedNum;
79997           });
79998           const setNums = setValue.split(";").map((val2) => {
79999             const parsedNum = parseLocaleFloat(val2);
80000             if (!isFinite(parsedNum)) return val2;
80001             return parsedNum;
80002           });
80003           return !isEqual_default(inputNums, setNums);
80004         };
80005       }
80006       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);
80007       if (field.type === "number") {
80008         const buttons = wrap2.selectAll(".increment, .decrement");
80009         if (isMixed) {
80010           buttons.attr("disabled", "disabled").classed("disabled", true);
80011         } else {
80012           var raw_vals = tags[field.key] || "0";
80013           const canIncDec = raw_vals.split(";").some(
80014             (val2) => isFinite(Number(val2)) || isDirectionField && val2.trim().toLowerCase() in cardinal
80015           );
80016           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
80017         }
80018       }
80019       if (field.type === "tel") updatePhonePlaceholder();
80020       if (field.type === "colour") updateColourPreview();
80021       if (field.type === "date") updateDateField();
80022       if (outlinkButton && !outlinkButton.empty()) {
80023         var disabled = !validIdentifierValueForLink();
80024         outlinkButton.classed("disabled", disabled);
80025       }
80026       if (!isMixed) {
80027         _lengthIndicator.update(tags[field.key]);
80028       }
80029     };
80030     i3.focus = function() {
80031       var node = input.node();
80032       if (node) node.focus();
80033     };
80034     function combinedEntityExtent() {
80035       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
80036     }
80037     return utilRebind(i3, dispatch14, "on");
80038   }
80039   var likelyRawNumberFormat;
80040   var init_input = __esm({
80041     "modules/ui/fields/input.js"() {
80042       "use strict";
80043       init_src4();
80044       init_src5();
80045       init_debounce();
80046       init_country_coder();
80047       init_presets();
80048       init_file_fetcher();
80049       init_localizer();
80050       init_util();
80051       init_icon();
80052       init_node2();
80053       init_tags();
80054       init_ui();
80055       init_tooltip();
80056       init_lodash();
80057       likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
80058     }
80059   });
80060
80061   // modules/ui/fields/access.js
80062   var access_exports = {};
80063   __export(access_exports, {
80064     uiFieldAccess: () => uiFieldAccess
80065   });
80066   function uiFieldAccess(field, context) {
80067     var dispatch14 = dispatch_default("change");
80068     var items = select_default2(null);
80069     var _tags;
80070     function access(selection2) {
80071       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80072       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80073       var list = wrap2.selectAll("ul").data([0]);
80074       list = list.enter().append("ul").attr("class", "rows").merge(list);
80075       items = list.selectAll("li").data(field.keys);
80076       var enter = items.enter().append("li").attr("class", function(d2) {
80077         return "labeled-input preset-access-" + d2;
80078       });
80079       enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
80080         return "preset-input-access-" + d2;
80081       }).html(function(d2) {
80082         return field.t.html("types." + d2);
80083       });
80084       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
80085         return "preset-input-access preset-input-access-" + d2;
80086       }).call(utilNoAuto).each(function(d2) {
80087         select_default2(this).call(
80088           uiCombobox(context, "access-" + d2).data(access.options(d2))
80089         );
80090       });
80091       items = items.merge(enter);
80092       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
80093     }
80094     function change(d3_event, d2) {
80095       var tag = {};
80096       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
80097       if (!value && typeof _tags[d2] !== "string") return;
80098       tag[d2] = value || void 0;
80099       dispatch14.call("change", this, tag);
80100     }
80101     access.options = function(type2) {
80102       var options = [
80103         "yes",
80104         "no",
80105         "designated",
80106         "permissive",
80107         "destination",
80108         "customers",
80109         "private",
80110         "permit",
80111         "unknown"
80112       ];
80113       if (type2 === "access") {
80114         options = options.filter((v3) => v3 !== "yes" && v3 !== "designated");
80115       }
80116       if (type2 === "bicycle") {
80117         options.splice(options.length - 4, 0, "dismount");
80118       }
80119       var stringsField = field.resolveReference("stringsCrossReference");
80120       return options.map(function(option) {
80121         return {
80122           title: stringsField.t("options." + option + ".description"),
80123           value: option
80124         };
80125       });
80126     };
80127     const placeholdersByTag = {
80128       highway: {
80129         footway: {
80130           foot: "designated",
80131           motor_vehicle: "no"
80132         },
80133         steps: {
80134           foot: "yes",
80135           motor_vehicle: "no",
80136           bicycle: "no",
80137           horse: "no"
80138         },
80139         ladder: {
80140           foot: "yes",
80141           motor_vehicle: "no",
80142           bicycle: "no",
80143           horse: "no"
80144         },
80145         pedestrian: {
80146           foot: "yes",
80147           motor_vehicle: "no"
80148         },
80149         cycleway: {
80150           motor_vehicle: "no",
80151           bicycle: "designated"
80152         },
80153         bridleway: {
80154           motor_vehicle: "no",
80155           horse: "designated"
80156         },
80157         path: {
80158           foot: "yes",
80159           motor_vehicle: "no",
80160           bicycle: "yes",
80161           horse: "yes"
80162         },
80163         motorway: {
80164           foot: "no",
80165           motor_vehicle: "yes",
80166           bicycle: "no",
80167           horse: "no"
80168         },
80169         trunk: {
80170           motor_vehicle: "yes"
80171         },
80172         primary: {
80173           foot: "yes",
80174           motor_vehicle: "yes",
80175           bicycle: "yes",
80176           horse: "yes"
80177         },
80178         secondary: {
80179           foot: "yes",
80180           motor_vehicle: "yes",
80181           bicycle: "yes",
80182           horse: "yes"
80183         },
80184         tertiary: {
80185           foot: "yes",
80186           motor_vehicle: "yes",
80187           bicycle: "yes",
80188           horse: "yes"
80189         },
80190         residential: {
80191           foot: "yes",
80192           motor_vehicle: "yes",
80193           bicycle: "yes",
80194           horse: "yes"
80195         },
80196         unclassified: {
80197           foot: "yes",
80198           motor_vehicle: "yes",
80199           bicycle: "yes",
80200           horse: "yes"
80201         },
80202         service: {
80203           foot: "yes",
80204           motor_vehicle: "yes",
80205           bicycle: "yes",
80206           horse: "yes"
80207         },
80208         motorway_link: {
80209           foot: "no",
80210           motor_vehicle: "yes",
80211           bicycle: "no",
80212           horse: "no"
80213         },
80214         trunk_link: {
80215           motor_vehicle: "yes"
80216         },
80217         primary_link: {
80218           foot: "yes",
80219           motor_vehicle: "yes",
80220           bicycle: "yes",
80221           horse: "yes"
80222         },
80223         secondary_link: {
80224           foot: "yes",
80225           motor_vehicle: "yes",
80226           bicycle: "yes",
80227           horse: "yes"
80228         },
80229         tertiary_link: {
80230           foot: "yes",
80231           motor_vehicle: "yes",
80232           bicycle: "yes",
80233           horse: "yes"
80234         },
80235         construction: {
80236           access: "no"
80237         },
80238         busway: {
80239           access: "no",
80240           bus: "designated",
80241           emergency: "yes"
80242         }
80243       },
80244       barrier: {
80245         bollard: {
80246           access: "no",
80247           bicycle: "yes",
80248           foot: "yes"
80249         },
80250         bus_trap: {
80251           motor_vehicle: "no",
80252           psv: "yes",
80253           foot: "yes",
80254           bicycle: "yes"
80255         },
80256         city_wall: {
80257           access: "no"
80258         },
80259         coupure: {
80260           access: "yes"
80261         },
80262         cycle_barrier: {
80263           motor_vehicle: "no"
80264         },
80265         ditch: {
80266           access: "no"
80267         },
80268         entrance: {
80269           access: "yes"
80270         },
80271         fence: {
80272           access: "no"
80273         },
80274         hedge: {
80275           access: "no"
80276         },
80277         jersey_barrier: {
80278           access: "no"
80279         },
80280         motorcycle_barrier: {
80281           motor_vehicle: "no"
80282         },
80283         rail_guard: {
80284           access: "no"
80285         }
80286       }
80287     };
80288     access.tags = function(tags) {
80289       _tags = tags;
80290       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
80291         return typeof tags[d2] === "string" ? tags[d2] : "";
80292       }).classed("mixed", function(accessField) {
80293         return tags[accessField] && Array.isArray(tags[accessField]) || new Set(getAllPlaceholders(tags, accessField)).size > 1;
80294       }).attr("title", function(accessField) {
80295         return tags[accessField] && Array.isArray(tags[accessField]) && tags[accessField].filter(Boolean).join("\n");
80296       }).attr("placeholder", function(accessField) {
80297         let placeholders = getAllPlaceholders(tags, accessField);
80298         if (new Set(placeholders).size === 1) {
80299           return placeholders[0];
80300         } else {
80301           return _t("inspector.multiple_values");
80302         }
80303       });
80304       function getAllPlaceholders(tags2, accessField) {
80305         let allTags = tags2[Symbol.for("allTags")];
80306         if (allTags && allTags.length > 1) {
80307           const placeholders = [];
80308           allTags.forEach((tags3) => {
80309             placeholders.push(getPlaceholder(tags3, accessField));
80310           });
80311           return placeholders;
80312         } else {
80313           return [getPlaceholder(tags2, accessField)];
80314         }
80315       }
80316       function getPlaceholder(tags2, accessField) {
80317         if (tags2[accessField]) {
80318           return tags2[accessField];
80319         }
80320         if (tags2.motorroad === "yes" && (accessField === "foot" || accessField === "bicycle" || accessField === "horse")) {
80321           return "no";
80322         }
80323         if (tags2.vehicle && (accessField === "bicycle" || accessField === "motor_vehicle")) {
80324           return tags2.vehicle;
80325         }
80326         if (tags2.access) {
80327           return tags2.access;
80328         }
80329         for (const key in placeholdersByTag) {
80330           if (tags2[key]) {
80331             if (placeholdersByTag[key][tags2[key]] && placeholdersByTag[key][tags2[key]][accessField]) {
80332               return placeholdersByTag[key][tags2[key]][accessField];
80333             }
80334           }
80335         }
80336         if (accessField === "access" && !tags2.barrier) {
80337           return "yes";
80338         }
80339         return field.placeholder();
80340       }
80341     };
80342     access.focus = function() {
80343       items.selectAll(".preset-input-access").node().focus();
80344     };
80345     return utilRebind(access, dispatch14, "on");
80346   }
80347   var init_access = __esm({
80348     "modules/ui/fields/access.js"() {
80349       "use strict";
80350       init_src4();
80351       init_src5();
80352       init_combobox();
80353       init_util();
80354       init_localizer();
80355     }
80356   });
80357
80358   // modules/ui/fields/address.js
80359   var address_exports = {};
80360   __export(address_exports, {
80361     uiFieldAddress: () => uiFieldAddress
80362   });
80363   function uiFieldAddress(field, context) {
80364     var dispatch14 = dispatch_default("change");
80365     var _selection = select_default2(null);
80366     var _wrap = select_default2(null);
80367     var addrField = _mainPresetIndex.field("address");
80368     var _entityIDs = [];
80369     var _tags;
80370     var _countryCode;
80371     var _addressFormats = [{
80372       format: [
80373         ["housenumber", "street"],
80374         ["city", "postcode"]
80375       ]
80376     }];
80377     _mainFileFetcher.get("address_formats").then(function(d2) {
80378       _addressFormats = d2;
80379       if (!_selection.empty()) {
80380         _selection.call(address);
80381       }
80382     }).catch(function() {
80383     });
80384     function getNear(isAddressable, type2, searchRadius, resultProp) {
80385       var extent = combinedEntityExtent();
80386       var l2 = extent.center();
80387       var box = extent.padByMeters(searchRadius);
80388       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
80389         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
80390         if (d2.geometry(context.graph()) === "line") {
80391           var loc = context.projection([
80392             (extent[0][0] + extent[1][0]) / 2,
80393             (extent[0][1] + extent[1][1]) / 2
80394           ]);
80395           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
80396           dist = geoSphericalDistance(choice.loc, l2);
80397         }
80398         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
80399         let title = value;
80400         if (type2 === "street") {
80401           title = `${addrField.t("placeholders.street")}: ${title}`;
80402         } else if (type2 === "place") {
80403           title = `${addrField.t("placeholders.place")}: ${title}`;
80404         }
80405         return {
80406           title,
80407           value,
80408           dist,
80409           type: type2,
80410           klass: `address-${type2}`
80411         };
80412       }).sort(function(a4, b3) {
80413         return a4.dist - b3.dist;
80414       });
80415       return utilArrayUniqBy(features, "value");
80416     }
80417     function getEnclosing(isAddressable, type2, resultProp) {
80418       var extent = combinedEntityExtent();
80419       var features = context.history().intersects(extent).filter(isAddressable).map((d2) => {
80420         if (d2.geometry(context.graph()) !== "area") {
80421           return false;
80422         }
80423         const geom = d2.asGeoJSON(context.graph()).coordinates[0];
80424         if (!geoPolygonContainsPolygon(geom, extent.polygon())) {
80425           return false;
80426         }
80427         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
80428         return {
80429           title: value,
80430           value,
80431           dist: 0,
80432           geom,
80433           type: type2,
80434           klass: `address-${type2}`
80435         };
80436       }).filter(Boolean);
80437       return utilArrayUniqBy(features, "value");
80438     }
80439     function getNearStreets() {
80440       function isAddressable(d2) {
80441         return d2.tags.highway && d2.tags.name && d2.type === "way";
80442       }
80443       return getNear(isAddressable, "street", 200);
80444     }
80445     function getNearPlaces() {
80446       function isAddressable(d2) {
80447         if (d2.tags.name) {
80448           if (d2.tags.place) return true;
80449           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8) return true;
80450         }
80451         return false;
80452       }
80453       return getNear(isAddressable, "place", 200);
80454     }
80455     function getNearCities() {
80456       function isAddressable(d2) {
80457         if (d2.tags.name) {
80458           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8") return true;
80459           if (d2.tags.border_type === "city") return true;
80460           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village") return true;
80461         }
80462         if (d2.tags[`${field.key}:city`]) return true;
80463         return false;
80464       }
80465       return getNear(isAddressable, "city", 200, `${field.key}:city`);
80466     }
80467     function getNearPostcodes() {
80468       const postcodes = [].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code"));
80469       return utilArrayUniqBy(postcodes, (item) => item.value);
80470     }
80471     function getNearValues(key) {
80472       const tagKey = `${field.key}:${key}`;
80473       function hasTag(d2) {
80474         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
80475       }
80476       return getNear(hasTag, key, 200, tagKey);
80477     }
80478     function getEnclosingValues(key) {
80479       const tagKey = `${field.key}:${key}`;
80480       function hasTag(d2) {
80481         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
80482       }
80483       const enclosingAddresses = getEnclosing(hasTag, key, tagKey);
80484       function isBuilding(d2) {
80485         return _entityIDs.indexOf(d2.id) === -1 && d2.tags.building && d2.tags.building !== "no";
80486       }
80487       const enclosingBuildings = getEnclosing(isBuilding, "building", "building").map((d2) => d2.geom);
80488       function isInNearbyBuilding(d2) {
80489         return hasTag(d2) && d2.type === "node" && enclosingBuildings.some(
80490           (geom) => geoPointInPolygon(d2.loc, geom) || geom.indexOf(d2.loc) !== -1
80491         );
80492       }
80493       const nearPointAddresses = getNear(isInNearbyBuilding, key, 100, tagKey);
80494       return utilArrayUniqBy([
80495         ...enclosingAddresses,
80496         ...nearPointAddresses
80497       ], "value").sort((a4, b3) => a4.value > b3.value ? 1 : -1);
80498     }
80499     function updateForCountryCode() {
80500       if (!_countryCode) return;
80501       var addressFormat;
80502       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
80503         var format2 = _addressFormats[i3];
80504         if (!format2.countryCodes) {
80505           addressFormat = format2;
80506         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
80507           addressFormat = format2;
80508           break;
80509         }
80510       }
80511       const maybeDropdowns = /* @__PURE__ */ new Set([
80512         "housenumber",
80513         "housename"
80514       ]);
80515       const dropdowns = /* @__PURE__ */ new Set([
80516         "block_number",
80517         "city",
80518         "country",
80519         "county",
80520         "district",
80521         "floor",
80522         "hamlet",
80523         "neighbourhood",
80524         "place",
80525         "postcode",
80526         "province",
80527         "quarter",
80528         "state",
80529         "street",
80530         "street+place",
80531         "subdistrict",
80532         "suburb",
80533         "town",
80534         ...maybeDropdowns
80535       ]);
80536       var widths = addressFormat.widths || {
80537         housenumber: 1 / 5,
80538         unit: 1 / 5,
80539         street: 1 / 2,
80540         place: 1 / 2,
80541         city: 2 / 3,
80542         state: 1 / 4,
80543         postcode: 1 / 3
80544       };
80545       function row(r2) {
80546         var total = r2.reduce(function(sum, key) {
80547           return sum + (widths[key] || 0.5);
80548         }, 0);
80549         return r2.map(function(key) {
80550           return {
80551             id: key,
80552             width: (widths[key] || 0.5) / total
80553           };
80554         });
80555       }
80556       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
80557         return d2.toString();
80558       });
80559       rows.exit().remove();
80560       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) {
80561         return "addr-" + d2.id;
80562       }).call(utilNoAuto).each(addDropdown).call(updatePlaceholder).style("width", function(d2) {
80563         return d2.width * 100 + "%";
80564       });
80565       function addDropdown(d2) {
80566         if (!dropdowns.has(d2.id)) {
80567           return false;
80568         }
80569         var nearValues;
80570         switch (d2.id) {
80571           case "street":
80572             nearValues = getNearStreets;
80573             break;
80574           case "place":
80575             nearValues = getNearPlaces;
80576             break;
80577           case "street+place":
80578             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
80579             d2.isAutoStreetPlace = true;
80580             d2.id = _tags[`${field.key}:place`] ? "place" : "street";
80581             break;
80582           case "city":
80583             nearValues = getNearCities;
80584             break;
80585           case "postcode":
80586             nearValues = getNearPostcodes;
80587             break;
80588           case "housenumber":
80589           case "housename":
80590             nearValues = getEnclosingValues;
80591             break;
80592           default:
80593             nearValues = getNearValues;
80594         }
80595         if (maybeDropdowns.has(d2.id)) {
80596           const candidates = nearValues(d2.id);
80597           if (candidates.length === 0) return false;
80598         }
80599         select_default2(this).call(
80600           uiCombobox(context, `address-${d2.isAutoStreetPlace ? "street-place" : d2.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
80601             typedValue = typedValue.toLowerCase();
80602             callback(nearValues(d2.id).filter((v3) => v3.value.toLowerCase().indexOf(typedValue) !== -1));
80603           }).on("accept", function(selected) {
80604             if (d2.isAutoStreetPlace) {
80605               d2.id = selected ? selected.type : "street";
80606               utilTriggerEvent(select_default2(this), "change");
80607             }
80608           })
80609         );
80610       }
80611       _wrap.selectAll("input").on("input", change(true)).on("blur", change()).on("change", change());
80612       if (_tags) updateTags(_tags);
80613     }
80614     function address(selection2) {
80615       _selection = selection2;
80616       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
80617       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
80618       var extent = combinedEntityExtent();
80619       if (extent) {
80620         var countryCode;
80621         if (context.inIntro()) {
80622           countryCode = _t("intro.graph.countrycode");
80623         } else {
80624           var center = extent.center();
80625           countryCode = iso1A2Code(center);
80626         }
80627         if (countryCode) {
80628           _countryCode = countryCode.toLowerCase();
80629           updateForCountryCode();
80630         }
80631       }
80632     }
80633     function change(onInput) {
80634       return function() {
80635         var tags = {};
80636         _wrap.selectAll("input").each(function(subfield) {
80637           var key = field.key + ":" + subfield.id;
80638           var value = this.value;
80639           if (!onInput) value = context.cleanTagValue(value);
80640           if (Array.isArray(_tags[key]) && !value) return;
80641           if (subfield.isAutoStreetPlace) {
80642             if (subfield.id === "street") {
80643               tags[`${field.key}:place`] = void 0;
80644             } else if (subfield.id === "place") {
80645               tags[`${field.key}:street`] = void 0;
80646             }
80647           }
80648           tags[key] = value || void 0;
80649         });
80650         Object.keys(tags).filter((k3) => tags[k3]).forEach((k3) => _tags[k3] = tags[k3]);
80651         dispatch14.call("change", this, tags, onInput);
80652       };
80653     }
80654     function updatePlaceholder(inputSelection) {
80655       return inputSelection.attr("placeholder", function(subfield) {
80656         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
80657           return _t("inspector.multiple_values");
80658         }
80659         if (subfield.isAutoStreetPlace) {
80660           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
80661         }
80662         return getLocalPlaceholder(subfield.id);
80663       });
80664     }
80665     function getLocalPlaceholder(key) {
80666       if (_countryCode) {
80667         var localkey = key + "!" + _countryCode;
80668         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
80669         return addrField.t("placeholders." + tkey);
80670       }
80671     }
80672     function updateTags(tags) {
80673       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
80674         var val;
80675         if (subfield.isAutoStreetPlace) {
80676           const streetKey = `${field.key}:street`;
80677           const placeKey = `${field.key}:place`;
80678           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
80679             val = tags[streetKey];
80680             subfield.id = "street";
80681           } else {
80682             val = tags[placeKey];
80683             subfield.id = "place";
80684           }
80685         } else {
80686           val = tags[`${field.key}:${subfield.id}`];
80687         }
80688         return typeof val === "string" ? val : "";
80689       }).attr("title", function(subfield) {
80690         var val = tags[field.key + ":" + subfield.id];
80691         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
80692       }).classed("mixed", function(subfield) {
80693         return Array.isArray(tags[field.key + ":" + subfield.id]);
80694       }).call(updatePlaceholder);
80695     }
80696     function combinedEntityExtent() {
80697       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
80698     }
80699     address.entityIDs = function(val) {
80700       if (!arguments.length) return _entityIDs;
80701       _entityIDs = val;
80702       return address;
80703     };
80704     address.tags = function(tags) {
80705       _tags = tags;
80706       updateTags(tags);
80707     };
80708     address.focus = function() {
80709       var node = _wrap.selectAll("input").node();
80710       if (node) node.focus();
80711     };
80712     return utilRebind(address, dispatch14, "on");
80713   }
80714   var init_address = __esm({
80715     "modules/ui/fields/address.js"() {
80716       "use strict";
80717       init_src4();
80718       init_src5();
80719       init_country_coder();
80720       init_presets();
80721       init_file_fetcher();
80722       init_geo2();
80723       init_combobox();
80724       init_util();
80725       init_localizer();
80726     }
80727   });
80728
80729   // modules/ui/fields/directional_combo.js
80730   var directional_combo_exports = {};
80731   __export(directional_combo_exports, {
80732     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo
80733   });
80734   function uiFieldDirectionalCombo(field, context) {
80735     var dispatch14 = dispatch_default("change");
80736     var items = select_default2(null);
80737     var wrap2 = select_default2(null);
80738     var _tags;
80739     var _combos = {};
80740     if (field.type === "cycleway") {
80741       field = {
80742         ...field,
80743         key: field.keys[0],
80744         keys: field.keys.slice(1)
80745       };
80746     }
80747     function directionalCombo(selection2) {
80748       function stripcolon(s2) {
80749         return s2.replace(":", "");
80750       }
80751       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80752       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80753       var div = wrap2.selectAll("ul").data([0]);
80754       div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
80755       items = div.selectAll("li").data(field.keys);
80756       var enter = items.enter().append("li").attr("class", function(d2) {
80757         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
80758       });
80759       enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
80760         return "preset-input-directionalcombo-" + stripcolon(d2);
80761       }).html(function(d2) {
80762         return field.t.html("types." + d2);
80763       });
80764       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
80765         const subField = {
80766           ...field,
80767           type: "combo",
80768           key
80769         };
80770         const combo = uiFieldCombo(subField, context);
80771         combo.on("change", (t2) => change(key, t2[key]));
80772         _combos[key] = combo;
80773         select_default2(this).call(combo);
80774       });
80775       items = items.merge(enter);
80776       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
80777     }
80778     function change(key, newValue) {
80779       const commonKey = field.key;
80780       const otherCommonKey = field.key.endsWith(":both") ? field.key.replace(/:both$/, "") : `${field.key}:both`;
80781       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
80782       dispatch14.call("change", this, (tags) => {
80783         const otherValue = tags[otherKey] || tags[commonKey] || tags[otherCommonKey];
80784         if (newValue === otherValue) {
80785           tags[commonKey] = newValue;
80786           delete tags[key];
80787           delete tags[otherKey];
80788           delete tags[otherCommonKey];
80789         } else {
80790           tags[key] = newValue;
80791           delete tags[commonKey];
80792           delete tags[otherCommonKey];
80793           tags[otherKey] = otherValue;
80794         }
80795         return tags;
80796       });
80797     }
80798     directionalCombo.tags = function(tags) {
80799       _tags = tags;
80800       const commonKey = field.key.replace(/:both$/, "");
80801       for (let key in _combos) {
80802         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[`${commonKey}:both`]).concat(_tags[key]).filter(Boolean))];
80803         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
80804       }
80805     };
80806     directionalCombo.focus = function() {
80807       var node = wrap2.selectAll("input").node();
80808       if (node) node.focus();
80809     };
80810     return utilRebind(directionalCombo, dispatch14, "on");
80811   }
80812   var init_directional_combo = __esm({
80813     "modules/ui/fields/directional_combo.js"() {
80814       "use strict";
80815       init_src4();
80816       init_src5();
80817       init_util();
80818       init_combo();
80819     }
80820   });
80821
80822   // modules/ui/fields/lanes.js
80823   var lanes_exports2 = {};
80824   __export(lanes_exports2, {
80825     uiFieldLanes: () => uiFieldLanes
80826   });
80827   function uiFieldLanes(field, context) {
80828     var dispatch14 = dispatch_default("change");
80829     var LANE_WIDTH = 40;
80830     var LANE_HEIGHT = 200;
80831     var _entityIDs = [];
80832     function lanes(selection2) {
80833       var lanesData = context.entity(_entityIDs[0]).lanes();
80834       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
80835         selection2.call(lanes.off);
80836         return;
80837       }
80838       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80839       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80840       var surface = wrap2.selectAll(".surface").data([0]);
80841       var d2 = utilGetDimensions(wrap2);
80842       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
80843       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
80844       var lanesSelection = surface.selectAll(".lanes").data([0]);
80845       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
80846       lanesSelection.attr("transform", function() {
80847         return "translate(" + freeSpace / 2 + ", 0)";
80848       });
80849       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
80850       lane.exit().remove();
80851       var enter = lane.enter().append("g").attr("class", "lane");
80852       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
80853       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
80854       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
80855       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
80856       lane = lane.merge(enter);
80857       lane.attr("transform", function(d4) {
80858         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
80859       });
80860       lane.select(".forward").style("visibility", function(d4) {
80861         return d4.direction === "forward" ? "visible" : "hidden";
80862       });
80863       lane.select(".bothways").style("visibility", function(d4) {
80864         return d4.direction === "bothways" ? "visible" : "hidden";
80865       });
80866       lane.select(".backward").style("visibility", function(d4) {
80867         return d4.direction === "backward" ? "visible" : "hidden";
80868       });
80869     }
80870     lanes.entityIDs = function(val) {
80871       _entityIDs = val;
80872     };
80873     lanes.tags = function() {
80874     };
80875     lanes.focus = function() {
80876     };
80877     lanes.off = function() {
80878     };
80879     return utilRebind(lanes, dispatch14, "on");
80880   }
80881   var init_lanes2 = __esm({
80882     "modules/ui/fields/lanes.js"() {
80883       "use strict";
80884       init_src4();
80885       init_rebind();
80886       init_dimensions();
80887       uiFieldLanes.supportsMultiselection = false;
80888     }
80889   });
80890
80891   // modules/ui/fields/localized.js
80892   var localized_exports = {};
80893   __export(localized_exports, {
80894     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
80895     uiFieldLocalized: () => uiFieldLocalized
80896   });
80897   function uiFieldLocalized(field, context) {
80898     var dispatch14 = dispatch_default("change", "input");
80899     var wikipedia = services.wikipedia;
80900     var input = select_default2(null);
80901     var localizedInputs = select_default2(null);
80902     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
80903     var _countryCode;
80904     var _tags;
80905     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
80906     });
80907     var _territoryLanguages = {};
80908     _mainFileFetcher.get("territory_languages").then(function(d2) {
80909       _territoryLanguages = d2;
80910     }).catch(function() {
80911     });
80912     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
80913     var _selection = select_default2(null);
80914     var _multilingual = [];
80915     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
80916     var _wikiTitles;
80917     var _entityIDs = [];
80918     function loadLanguagesArray(dataLanguages) {
80919       if (_languagesArray.length !== 0) return;
80920       var replacements = {
80921         sr: "sr-Cyrl",
80922         // in OSM, `sr` implies Cyrillic
80923         "sr-Cyrl": false
80924         // `sr-Cyrl` isn't used in OSM
80925       };
80926       for (var code in dataLanguages) {
80927         if (replacements[code] === false) continue;
80928         var metaCode = code;
80929         if (replacements[code]) metaCode = replacements[code];
80930         _languagesArray.push({
80931           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
80932           nativeName: dataLanguages[metaCode].nativeName,
80933           code,
80934           label: _mainLocalizer.languageName(metaCode)
80935         });
80936       }
80937     }
80938     function calcLocked() {
80939       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
80940         var entity = context.graph().hasEntity(entityID);
80941         if (!entity) return false;
80942         if (entity.tags.wikidata) return true;
80943         if (entity.tags["name:etymology:wikidata"]) return true;
80944         var preset = _mainPresetIndex.match(entity, context.graph());
80945         if (preset) {
80946           var isSuggestion = preset.suggestion;
80947           var fields = preset.fields(entity.extent(context.graph()).center());
80948           var showsBrandField = fields.some(function(d2) {
80949             return d2.id === "brand";
80950           });
80951           var showsOperatorField = fields.some(function(d2) {
80952             return d2.id === "operator";
80953           });
80954           var setsName = preset.addTags.name;
80955           var setsBrandWikidata = preset.addTags["brand:wikidata"];
80956           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
80957           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
80958         }
80959         return false;
80960       });
80961       field.locked(isLocked);
80962     }
80963     function calcMultilingual(tags) {
80964       var existingLangsOrdered = _multilingual.map(function(item2) {
80965         return item2.lang;
80966       });
80967       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
80968       for (var k3 in tags) {
80969         var m3 = k3.match(LANGUAGE_SUFFIX_REGEX);
80970         if (m3 && m3[1] === field.key && m3[2]) {
80971           var item = { lang: m3[2], value: tags[k3] };
80972           if (existingLangs.has(item.lang)) {
80973             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
80974             existingLangs.delete(item.lang);
80975           } else {
80976             _multilingual.push(item);
80977           }
80978         }
80979       }
80980       _multilingual.forEach(function(item2) {
80981         if (item2.lang && existingLangs.has(item2.lang)) {
80982           item2.value = "";
80983         }
80984       });
80985     }
80986     function localized(selection2) {
80987       _selection = selection2;
80988       calcLocked();
80989       var isLocked = field.locked();
80990       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80991       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80992       input = wrap2.selectAll(".localized-main").data([0]);
80993       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
80994       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
80995       wrap2.call(_lengthIndicator);
80996       var translateButton = wrap2.selectAll(".localized-add").data([0]);
80997       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);
80998       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
80999       if (_tags && !_multilingual.length) {
81000         calcMultilingual(_tags);
81001       }
81002       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
81003       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
81004       localizedInputs.call(renderMultilingual);
81005       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
81006       selection2.selectAll(".combobox-caret").classed("nope", true);
81007       function addNew(d3_event) {
81008         d3_event.preventDefault();
81009         if (field.locked()) return;
81010         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
81011         var langExists = _multilingual.find(function(datum2) {
81012           return datum2.lang === defaultLang;
81013         });
81014         var isLangEn = defaultLang.indexOf("en") > -1;
81015         if (isLangEn || langExists) {
81016           defaultLang = "";
81017           langExists = _multilingual.find(function(datum2) {
81018             return datum2.lang === defaultLang;
81019           });
81020         }
81021         if (!langExists) {
81022           _multilingual.unshift({ lang: defaultLang, value: "" });
81023           localizedInputs.call(renderMultilingual);
81024         }
81025       }
81026       function change(onInput) {
81027         return function(d3_event) {
81028           if (field.locked()) {
81029             d3_event.preventDefault();
81030             return;
81031           }
81032           var val = utilGetSetValue(select_default2(this));
81033           if (!onInput) val = context.cleanTagValue(val);
81034           if (!val && Array.isArray(_tags[field.key])) return;
81035           var t2 = {};
81036           t2[field.key] = val || void 0;
81037           dispatch14.call("change", this, t2, onInput);
81038         };
81039       }
81040     }
81041     function key(lang) {
81042       return field.key + ":" + lang;
81043     }
81044     function changeLang(d3_event, d2) {
81045       var tags = {};
81046       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
81047       var language = _languagesArray.find(function(d4) {
81048         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
81049       });
81050       if (language) lang = language.code;
81051       if (d2.lang && d2.lang !== lang) {
81052         tags[key(d2.lang)] = void 0;
81053       }
81054       var newKey = lang && context.cleanTagKey(key(lang));
81055       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
81056       if (newKey && value) {
81057         tags[newKey] = value;
81058       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
81059         tags[newKey] = _wikiTitles[d2.lang];
81060       }
81061       d2.lang = lang;
81062       dispatch14.call("change", this, tags);
81063     }
81064     function changeValue(d3_event, d2) {
81065       if (!d2.lang) return;
81066       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
81067       if (!value && Array.isArray(d2.value)) return;
81068       var t2 = {};
81069       t2[key(d2.lang)] = value;
81070       d2.value = value;
81071       dispatch14.call("change", this, t2);
81072     }
81073     function fetchLanguages(value, cb) {
81074       var v3 = value.toLowerCase();
81075       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
81076       if (_countryCode && _territoryLanguages[_countryCode]) {
81077         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
81078       }
81079       var langItems = [];
81080       langCodes.forEach(function(code) {
81081         var langItem = _languagesArray.find(function(item) {
81082           return item.code === code;
81083         });
81084         if (langItem) langItems.push(langItem);
81085       });
81086       langItems = utilArrayUniq(langItems.concat(_languagesArray));
81087       cb(langItems.filter(function(d2) {
81088         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;
81089       }).map(function(d2) {
81090         return { value: d2.label };
81091       }));
81092     }
81093     function renderMultilingual(selection2) {
81094       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
81095         return d2.lang;
81096       });
81097       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
81098       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_3, index) {
81099         var wrap2 = select_default2(this);
81100         var domId = utilUniqueDomId(index);
81101         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
81102         var text = label.append("span").attr("class", "label-text");
81103         text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
81104         text.append("span").attr("class", "label-textannotation");
81105         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
81106           if (field.locked()) return;
81107           d3_event.preventDefault();
81108           _multilingual.splice(_multilingual.indexOf(d2), 1);
81109           var langKey = d2.lang && key(d2.lang);
81110           if (langKey && langKey in _tags) {
81111             delete _tags[langKey];
81112             var t2 = {};
81113             t2[langKey] = void 0;
81114             dispatch14.call("change", this, t2);
81115             return;
81116           }
81117           renderMultilingual(selection2);
81118         }).call(svgIcon("#iD-operation-delete"));
81119         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);
81120         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
81121       });
81122       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() {
81123         select_default2(this).style("max-height", "").style("overflow", "visible");
81124       });
81125       entries = entries.merge(entriesEnter);
81126       entries.order();
81127       entries.classed("present", true);
81128       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
81129         var langItem = _languagesArray.find(function(item) {
81130           return item.code === d2.lang;
81131         });
81132         if (langItem) return langItem.label;
81133         return d2.lang;
81134       });
81135       utilGetSetValue(entries.select(".localized-value"), function(d2) {
81136         return typeof d2.value === "string" ? d2.value : "";
81137       }).attr("title", function(d2) {
81138         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
81139       }).attr("placeholder", function(d2) {
81140         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
81141       }).attr("lang", function(d2) {
81142         return d2.lang;
81143       }).classed("mixed", function(d2) {
81144         return Array.isArray(d2.value);
81145       });
81146     }
81147     localized.tags = function(tags) {
81148       _tags = tags;
81149       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
81150         _wikiTitles = {};
81151         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
81152         if (wm && wm[0] && wm[1]) {
81153           wikipedia.translations(wm[1], wm[2], function(err, d2) {
81154             if (err || !d2) return;
81155             _wikiTitles = d2;
81156           });
81157         }
81158       }
81159       var isMixed = Array.isArray(tags[field.key]);
81160       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);
81161       calcMultilingual(tags);
81162       _selection.call(localized);
81163       if (!isMixed) {
81164         _lengthIndicator.update(tags[field.key]);
81165       }
81166     };
81167     localized.focus = function() {
81168       input.node().focus();
81169     };
81170     localized.entityIDs = function(val) {
81171       if (!arguments.length) return _entityIDs;
81172       _entityIDs = val;
81173       _multilingual = [];
81174       loadCountryCode();
81175       return localized;
81176     };
81177     function loadCountryCode() {
81178       var extent = combinedEntityExtent();
81179       var countryCode = extent && iso1A2Code(extent.center());
81180       _countryCode = countryCode && countryCode.toLowerCase();
81181     }
81182     function combinedEntityExtent() {
81183       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81184     }
81185     return utilRebind(localized, dispatch14, "on");
81186   }
81187   var _languagesArray, LANGUAGE_SUFFIX_REGEX;
81188   var init_localized = __esm({
81189     "modules/ui/fields/localized.js"() {
81190       "use strict";
81191       init_src4();
81192       init_src5();
81193       init_country_coder();
81194       init_presets();
81195       init_file_fetcher();
81196       init_localizer();
81197       init_services();
81198       init_svg();
81199       init_tooltip();
81200       init_combobox();
81201       init_util();
81202       init_length_indicator();
81203       _languagesArray = [];
81204       LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
81205     }
81206   });
81207
81208   // modules/ui/fields/roadheight.js
81209   var roadheight_exports = {};
81210   __export(roadheight_exports, {
81211     uiFieldRoadheight: () => uiFieldRoadheight
81212   });
81213   function uiFieldRoadheight(field, context) {
81214     var dispatch14 = dispatch_default("change");
81215     var primaryUnitInput = select_default2(null);
81216     var primaryInput = select_default2(null);
81217     var secondaryInput = select_default2(null);
81218     var secondaryUnitInput = select_default2(null);
81219     var _entityIDs = [];
81220     var _tags;
81221     var _isImperial;
81222     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
81223     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
81224     var primaryUnits = [
81225       {
81226         value: "m",
81227         title: _t("inspector.roadheight.meter")
81228       },
81229       {
81230         value: "ft",
81231         title: _t("inspector.roadheight.foot")
81232       }
81233     ];
81234     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
81235     function roadheight(selection2) {
81236       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81237       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81238       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
81239       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
81240       primaryInput.on("change", change).on("blur", change);
81241       var loc = combinedEntityExtent().center();
81242       _isImperial = roadHeightUnit(loc) === "ft";
81243       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
81244       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
81245       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
81246       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
81247       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
81248       secondaryInput.on("change", change).on("blur", change);
81249       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
81250       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
81251       function changeUnits() {
81252         var primaryUnit = utilGetSetValue(primaryUnitInput);
81253         if (primaryUnit === "m") {
81254           _isImperial = false;
81255         } else if (primaryUnit === "ft") {
81256           _isImperial = true;
81257         }
81258         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
81259         setUnitSuggestions();
81260         change();
81261       }
81262     }
81263     function setUnitSuggestions() {
81264       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
81265     }
81266     function change() {
81267       var tag = {};
81268       var primaryValue = utilGetSetValue(primaryInput).trim();
81269       var secondaryValue = utilGetSetValue(secondaryInput).trim();
81270       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key])) return;
81271       if (!primaryValue && !secondaryValue) {
81272         tag[field.key] = void 0;
81273       } else {
81274         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
81275         if (isNaN(rawPrimaryValue)) rawPrimaryValue = primaryValue;
81276         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
81277         if (isNaN(rawSecondaryValue)) rawSecondaryValue = secondaryValue;
81278         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
81279           tag[field.key] = context.cleanTagValue(rawPrimaryValue);
81280         } else {
81281           if (rawPrimaryValue !== "") {
81282             rawPrimaryValue = rawPrimaryValue + "'";
81283           }
81284           if (rawSecondaryValue !== "") {
81285             rawSecondaryValue = rawSecondaryValue + '"';
81286           }
81287           tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
81288         }
81289       }
81290       dispatch14.call("change", this, tag);
81291     }
81292     roadheight.tags = function(tags) {
81293       _tags = tags;
81294       var primaryValue = tags[field.key];
81295       var secondaryValue;
81296       var isMixed = Array.isArray(primaryValue);
81297       if (!isMixed) {
81298         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
81299           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
81300           if (secondaryValue !== null) {
81301             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
81302           }
81303           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
81304           if (primaryValue !== null) {
81305             primaryValue = formatFloat(parseFloat(primaryValue[1]));
81306           }
81307           _isImperial = true;
81308         } else if (primaryValue) {
81309           var rawValue = primaryValue;
81310           primaryValue = parseFloat(rawValue);
81311           if (isNaN(primaryValue)) {
81312             primaryValue = rawValue;
81313           } else {
81314             primaryValue = formatFloat(primaryValue);
81315           }
81316           _isImperial = false;
81317         }
81318       }
81319       setUnitSuggestions();
81320       var inchesPlaceholder = formatFloat(0);
81321       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);
81322       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");
81323       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
81324     };
81325     roadheight.focus = function() {
81326       primaryInput.node().focus();
81327     };
81328     roadheight.entityIDs = function(val) {
81329       _entityIDs = val;
81330     };
81331     function combinedEntityExtent() {
81332       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81333     }
81334     return utilRebind(roadheight, dispatch14, "on");
81335   }
81336   var init_roadheight = __esm({
81337     "modules/ui/fields/roadheight.js"() {
81338       "use strict";
81339       init_src4();
81340       init_src5();
81341       init_country_coder();
81342       init_combobox();
81343       init_localizer();
81344       init_util();
81345       init_input();
81346     }
81347   });
81348
81349   // modules/ui/fields/roadspeed.js
81350   var roadspeed_exports = {};
81351   __export(roadspeed_exports, {
81352     uiFieldRoadspeed: () => uiFieldRoadspeed
81353   });
81354   function uiFieldRoadspeed(field, context) {
81355     var dispatch14 = dispatch_default("change");
81356     var unitInput = select_default2(null);
81357     var input = select_default2(null);
81358     var _entityIDs = [];
81359     var _tags;
81360     var _isImperial;
81361     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
81362     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
81363     var speedCombo = uiCombobox(context, "roadspeed");
81364     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
81365     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
81366     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
81367     function roadspeed(selection2) {
81368       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81369       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81370       input = wrap2.selectAll("input.roadspeed-number").data([0]);
81371       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
81372       input.on("change", change).on("blur", change);
81373       var loc = combinedEntityExtent().center();
81374       _isImperial = roadSpeedUnit(loc) === "mph";
81375       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
81376       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
81377       unitInput.on("blur", changeUnits).on("change", changeUnits);
81378       function changeUnits() {
81379         var unit2 = utilGetSetValue(unitInput);
81380         if (unit2 === "km/h") {
81381           _isImperial = false;
81382         } else if (unit2 === "mph") {
81383           _isImperial = true;
81384         }
81385         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
81386         setUnitSuggestions();
81387         change();
81388       }
81389     }
81390     function setUnitSuggestions() {
81391       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
81392       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
81393     }
81394     function comboValues(d2) {
81395       return {
81396         value: formatFloat(d2),
81397         title: formatFloat(d2)
81398       };
81399     }
81400     function change() {
81401       var tag = {};
81402       var value = utilGetSetValue(input).trim();
81403       if (!value && Array.isArray(_tags[field.key])) return;
81404       if (!value) {
81405         tag[field.key] = void 0;
81406       } else {
81407         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
81408         if (isNaN(rawValue)) rawValue = value;
81409         if (isNaN(rawValue) || !_isImperial) {
81410           tag[field.key] = context.cleanTagValue(rawValue);
81411         } else {
81412           tag[field.key] = context.cleanTagValue(rawValue + " mph");
81413         }
81414       }
81415       dispatch14.call("change", this, tag);
81416     }
81417     roadspeed.tags = function(tags) {
81418       _tags = tags;
81419       var rawValue = tags[field.key];
81420       var value = rawValue;
81421       var isMixed = Array.isArray(value);
81422       if (!isMixed) {
81423         if (rawValue && rawValue.indexOf("mph") >= 0) {
81424           _isImperial = true;
81425         } else if (rawValue) {
81426           _isImperial = false;
81427         }
81428         value = parseInt(value, 10);
81429         if (isNaN(value)) {
81430           value = rawValue;
81431         } else {
81432           value = formatFloat(value);
81433         }
81434       }
81435       setUnitSuggestions();
81436       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);
81437     };
81438     roadspeed.focus = function() {
81439       input.node().focus();
81440     };
81441     roadspeed.entityIDs = function(val) {
81442       _entityIDs = val;
81443     };
81444     function combinedEntityExtent() {
81445       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81446     }
81447     return utilRebind(roadspeed, dispatch14, "on");
81448   }
81449   var init_roadspeed = __esm({
81450     "modules/ui/fields/roadspeed.js"() {
81451       "use strict";
81452       init_src4();
81453       init_src5();
81454       init_country_coder();
81455       init_combobox();
81456       init_localizer();
81457       init_util();
81458       init_input();
81459     }
81460   });
81461
81462   // modules/ui/fields/radio.js
81463   var radio_exports = {};
81464   __export(radio_exports, {
81465     uiFieldRadio: () => uiFieldRadio,
81466     uiFieldStructureRadio: () => uiFieldRadio
81467   });
81468   function uiFieldRadio(field, context) {
81469     var dispatch14 = dispatch_default("change");
81470     var placeholder = select_default2(null);
81471     var wrap2 = select_default2(null);
81472     var labels = select_default2(null);
81473     var radios = select_default2(null);
81474     var strings = field.resolveReference("stringsCrossReference");
81475     var radioData = (field.options || strings.options || field.keys).slice();
81476     var typeField;
81477     var layerField;
81478     var _oldType = {};
81479     var _entityIDs = [];
81480     function selectedKey() {
81481       var node = wrap2.selectAll(".form-field-input-radio label.active input");
81482       return !node.empty() && node.datum();
81483     }
81484     function radio(selection2) {
81485       selection2.classed("preset-radio", true);
81486       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81487       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
81488       enter.append("span").attr("class", "placeholder");
81489       wrap2 = wrap2.merge(enter);
81490       placeholder = wrap2.selectAll(".placeholder");
81491       labels = wrap2.selectAll("label").data(radioData);
81492       enter = labels.enter().append("label");
81493       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
81494         return strings.t("options." + d2, { "default": d2 });
81495       }).attr("checked", false);
81496       enter.append("span").each(function(d2) {
81497         strings.t.append("options." + d2, { "default": d2 })(select_default2(this));
81498       });
81499       labels = labels.merge(enter);
81500       radios = labels.selectAll("input").on("change", changeRadio);
81501     }
81502     function structureExtras(selection2, tags) {
81503       var selected = selectedKey() || tags.layer !== void 0;
81504       var type2 = _mainPresetIndex.field(selected);
81505       var layer = _mainPresetIndex.field("layer");
81506       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
81507       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
81508       extrasWrap.exit().remove();
81509       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
81510       var list = extrasWrap.selectAll("ul").data([0]);
81511       list = list.enter().append("ul").attr("class", "rows").merge(list);
81512       if (type2) {
81513         if (!typeField || typeField.id !== selected) {
81514           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
81515         }
81516         typeField.tags(tags);
81517       } else {
81518         typeField = null;
81519       }
81520       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
81521         return d2.id;
81522       });
81523       typeItem.exit().remove();
81524       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
81525       typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
81526       typeEnter.append("div").attr("class", "structure-input-type-wrap");
81527       typeItem = typeItem.merge(typeEnter);
81528       if (typeField) {
81529         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
81530       }
81531       if (layer && showLayer) {
81532         if (!layerField) {
81533           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
81534         }
81535         layerField.tags(tags);
81536         field.keys = utilArrayUnion(field.keys, ["layer"]);
81537       } else {
81538         layerField = null;
81539         field.keys = field.keys.filter(function(k3) {
81540           return k3 !== "layer";
81541         });
81542       }
81543       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
81544       layerItem.exit().remove();
81545       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
81546       layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
81547       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
81548       layerItem = layerItem.merge(layerEnter);
81549       if (layerField) {
81550         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
81551       }
81552     }
81553     function changeType(t2, onInput) {
81554       var key = selectedKey();
81555       if (!key) return;
81556       var val = t2[key];
81557       if (val !== "no") {
81558         _oldType[key] = val;
81559       }
81560       if (field.type === "structureRadio") {
81561         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
81562           t2.layer = void 0;
81563         }
81564         if (t2.layer === void 0) {
81565           if (key === "bridge" && val !== "no") {
81566             t2.layer = "1";
81567           }
81568           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
81569             t2.layer = "-1";
81570           }
81571         }
81572       }
81573       dispatch14.call("change", this, t2, onInput);
81574     }
81575     function changeLayer(t2, onInput) {
81576       if (t2.layer === "0") {
81577         t2.layer = void 0;
81578       }
81579       dispatch14.call("change", this, t2, onInput);
81580     }
81581     function changeRadio() {
81582       var t2 = {};
81583       var activeKey;
81584       if (field.key) {
81585         t2[field.key] = void 0;
81586       }
81587       radios.each(function(d2) {
81588         var active = select_default2(this).property("checked");
81589         if (active) activeKey = d2;
81590         if (field.key) {
81591           if (active) t2[field.key] = d2;
81592         } else {
81593           var val = _oldType[activeKey] || "yes";
81594           t2[d2] = active ? val : void 0;
81595         }
81596       });
81597       if (field.type === "structureRadio") {
81598         if (activeKey === "bridge") {
81599           t2.layer = "1";
81600         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
81601           t2.layer = "-1";
81602         } else {
81603           t2.layer = void 0;
81604         }
81605       }
81606       dispatch14.call("change", this, t2);
81607     }
81608     radio.tags = function(tags) {
81609       function isOptionChecked(d2) {
81610         if (field.key) {
81611           return tags[field.key] === d2;
81612         }
81613         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
81614       }
81615       function isMixed(d2) {
81616         if (field.key) {
81617           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
81618         }
81619         return Array.isArray(tags[d2]);
81620       }
81621       radios.property("checked", function(d2) {
81622         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
81623       });
81624       labels.classed("active", function(d2) {
81625         if (field.key) {
81626           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
81627         }
81628         return Array.isArray(tags[d2]) && tags[d2].some((v3) => typeof v3 === "string" && v3.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
81629       }).classed("mixed", isMixed).attr("title", function(d2) {
81630         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
81631       });
81632       var selection2 = radios.filter(function() {
81633         return this.checked;
81634       });
81635       if (selection2.empty()) {
81636         placeholder.text("");
81637         placeholder.call(_t.append("inspector.none"));
81638       } else {
81639         placeholder.text(selection2.attr("value"));
81640         _oldType[selection2.datum()] = tags[selection2.datum()];
81641       }
81642       if (field.type === "structureRadio") {
81643         if (!!tags.waterway && !_oldType.tunnel) {
81644           _oldType.tunnel = "culvert";
81645         }
81646         if (!!tags.waterway && !_oldType.bridge) {
81647           _oldType.bridge = "aqueduct";
81648         }
81649         wrap2.call(structureExtras, tags);
81650       }
81651     };
81652     radio.focus = function() {
81653       radios.node().focus();
81654     };
81655     radio.entityIDs = function(val) {
81656       if (!arguments.length) return _entityIDs;
81657       _entityIDs = val;
81658       _oldType = {};
81659       return radio;
81660     };
81661     radio.isAllowed = function() {
81662       return _entityIDs.length === 1;
81663     };
81664     return utilRebind(radio, dispatch14, "on");
81665   }
81666   var init_radio = __esm({
81667     "modules/ui/fields/radio.js"() {
81668       "use strict";
81669       init_src4();
81670       init_src5();
81671       init_presets();
81672       init_localizer();
81673       init_field2();
81674       init_util();
81675     }
81676   });
81677
81678   // modules/ui/fields/restrictions.js
81679   var restrictions_exports = {};
81680   __export(restrictions_exports, {
81681     uiFieldRestrictions: () => uiFieldRestrictions
81682   });
81683   function uiFieldRestrictions(field, context) {
81684     var dispatch14 = dispatch_default("change");
81685     var breathe = behaviorBreathe(context);
81686     corePreferences("turn-restriction-via-way", null);
81687     var storedViaWay = corePreferences("turn-restriction-via-way0");
81688     var storedDistance = corePreferences("turn-restriction-distance");
81689     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
81690     var _maxDistance = storedDistance ? +storedDistance : 30;
81691     var _initialized3 = false;
81692     var _parent = select_default2(null);
81693     var _container = select_default2(null);
81694     var _oldTurns;
81695     var _graph;
81696     var _vertexID;
81697     var _intersection;
81698     var _fromWayID;
81699     var _lastXPos;
81700     function restrictions(selection2) {
81701       _parent = selection2;
81702       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
81703         _graph = context.graph();
81704         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
81705       }
81706       var isOK = _intersection && _intersection.vertices.length && // has vertices
81707       _intersection.vertices.filter(function(vertex) {
81708         return vertex.id === _vertexID;
81709       }).length && _intersection.ways.length > 2;
81710       select_default2(selection2.node().parentNode).classed("hide", !isOK);
81711       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
81712         selection2.call(restrictions.off);
81713         return;
81714       }
81715       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81716       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81717       var container = wrap2.selectAll(".restriction-container").data([0]);
81718       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
81719       containerEnter.append("div").attr("class", "restriction-help");
81720       _container = containerEnter.merge(container).call(renderViewer);
81721       var controls = wrap2.selectAll(".restriction-controls").data([0]);
81722       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
81723     }
81724     function renderControls(selection2) {
81725       var distControl = selection2.selectAll(".restriction-distance").data([0]);
81726       distControl.exit().remove();
81727       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
81728       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
81729       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
81730       distControlEnter.append("span").attr("class", "restriction-distance-text");
81731       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
81732         var val = select_default2(this).property("value");
81733         _maxDistance = +val;
81734         _intersection = null;
81735         _container.selectAll(".layer-osm .layer-turns *").remove();
81736         corePreferences("turn-restriction-distance", _maxDistance);
81737         _parent.call(restrictions);
81738       });
81739       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
81740       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
81741       viaControl.exit().remove();
81742       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
81743       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
81744       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
81745       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
81746       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
81747         var val = select_default2(this).property("value");
81748         _maxViaWay = +val;
81749         _container.selectAll(".layer-osm .layer-turns *").remove();
81750         corePreferences("turn-restriction-via-way0", _maxViaWay);
81751         _parent.call(restrictions);
81752       });
81753       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
81754     }
81755     function renderViewer(selection2) {
81756       if (!_intersection) return;
81757       var vgraph = _intersection.graph;
81758       var filter2 = utilFunctor(true);
81759       var projection2 = geoRawMercator();
81760       var sdims = utilGetDimensions(context.container().select(".sidebar"));
81761       var d2 = [sdims[0] - 50, 370];
81762       var c2 = geoVecScale(d2, 0.5);
81763       var z3 = 22;
81764       projection2.scale(geoZoomToScale(z3));
81765       var extent = geoExtent();
81766       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
81767         extent._extend(_intersection.vertices[i3].extent());
81768       }
81769       var padTop = 35;
81770       if (_intersection.vertices.length > 1) {
81771         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
81772         var vPadding = 160;
81773         var tl = projection2([extent[0][0], extent[1][1]]);
81774         var br = projection2([extent[1][0], extent[0][1]]);
81775         var hFactor = (br[0] - tl[0]) / (d2[0] - hPadding);
81776         var vFactor = (br[1] - tl[1]) / (d2[1] - vPadding - padTop);
81777         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
81778         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
81779         z3 = z3 - Math.max(hZoomDiff, vZoomDiff);
81780         projection2.scale(geoZoomToScale(z3));
81781       }
81782       var extentCenter = projection2(extent.center());
81783       extentCenter[1] = extentCenter[1] - padTop / 2;
81784       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
81785       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
81786       var drawVertices = svgVertices(projection2, context);
81787       var drawLines = svgLines(projection2, context);
81788       var drawTurns = svgTurns(projection2, context);
81789       var firstTime = selection2.selectAll(".surface").empty();
81790       selection2.call(drawLayers);
81791       var surface = selection2.selectAll(".surface").classed("tr", true);
81792       if (firstTime) {
81793         _initialized3 = true;
81794         surface.call(breathe);
81795       }
81796       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
81797         _fromWayID = null;
81798         _oldTurns = null;
81799       }
81800       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));
81801       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
81802       surface.selectAll(".selected").classed("selected", false);
81803       surface.selectAll(".related").classed("related", false);
81804       var way;
81805       if (_fromWayID) {
81806         way = vgraph.entity(_fromWayID);
81807         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
81808       }
81809       document.addEventListener("resizeWindow", function() {
81810         utilSetDimensions(_container, null);
81811         redraw(1);
81812       }, false);
81813       updateHints(null);
81814       function click(d3_event) {
81815         surface.call(breathe.off).call(breathe);
81816         var datum2 = d3_event.target.__data__;
81817         var entity = datum2 && datum2.properties && datum2.properties.entity;
81818         if (entity) {
81819           datum2 = entity;
81820         }
81821         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
81822           _fromWayID = datum2.id;
81823           _oldTurns = null;
81824           redraw();
81825         } else if (datum2 instanceof osmTurn) {
81826           var actions, extraActions, turns, i4;
81827           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
81828           if (datum2.restrictionID && !datum2.direct) {
81829             return;
81830           } else if (datum2.restrictionID && !datum2.only) {
81831             var seen = {};
81832             var datumOnly = JSON.parse(JSON.stringify(datum2));
81833             datumOnly.only = true;
81834             restrictionType = restrictionType.replace(/^no/, "only");
81835             turns = _intersection.turns(_fromWayID, 2);
81836             extraActions = [];
81837             _oldTurns = [];
81838             for (i4 = 0; i4 < turns.length; i4++) {
81839               var turn = turns[i4];
81840               if (seen[turn.restrictionID]) continue;
81841               if (turn.direct && turn.path[1] === datum2.path[1]) {
81842                 seen[turns[i4].restrictionID] = true;
81843                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
81844                 _oldTurns.push(turn);
81845                 extraActions.push(actionUnrestrictTurn(turn));
81846               }
81847             }
81848             actions = _intersection.actions.concat(extraActions, [
81849               actionRestrictTurn(datumOnly, restrictionType),
81850               _t("operations.restriction.annotation.create")
81851             ]);
81852           } else if (datum2.restrictionID) {
81853             turns = _oldTurns || [];
81854             extraActions = [];
81855             for (i4 = 0; i4 < turns.length; i4++) {
81856               if (turns[i4].key !== datum2.key) {
81857                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
81858               }
81859             }
81860             _oldTurns = null;
81861             actions = _intersection.actions.concat(extraActions, [
81862               actionUnrestrictTurn(datum2),
81863               _t("operations.restriction.annotation.delete")
81864             ]);
81865           } else {
81866             actions = _intersection.actions.concat([
81867               actionRestrictTurn(datum2, restrictionType),
81868               _t("operations.restriction.annotation.create")
81869             ]);
81870           }
81871           context.perform.apply(context, actions);
81872           var s2 = surface.selectAll("." + datum2.key);
81873           datum2 = s2.empty() ? null : s2.datum();
81874           updateHints(datum2);
81875         } else {
81876           _fromWayID = null;
81877           _oldTurns = null;
81878           redraw();
81879         }
81880       }
81881       function mouseover(d3_event) {
81882         var datum2 = d3_event.target.__data__;
81883         updateHints(datum2);
81884       }
81885       _lastXPos = _lastXPos || sdims[0];
81886       function redraw(minChange) {
81887         var xPos = -1;
81888         if (minChange) {
81889           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
81890         }
81891         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
81892           if (context.hasEntity(_vertexID)) {
81893             _lastXPos = xPos;
81894             _container.call(renderViewer);
81895           }
81896         }
81897       }
81898       function highlightPathsFrom(wayID) {
81899         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
81900         surface.selectAll("." + wayID).classed("related", true);
81901         if (wayID) {
81902           var turns = _intersection.turns(wayID, _maxViaWay);
81903           for (var i4 = 0; i4 < turns.length; i4++) {
81904             var turn = turns[i4];
81905             var ids = [turn.to.way];
81906             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
81907             if (turn.only || turns.length === 1) {
81908               if (turn.via.ways) {
81909                 ids = ids.concat(turn.via.ways);
81910               }
81911             } else if (turn.to.way === wayID) {
81912               continue;
81913             }
81914             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
81915           }
81916         }
81917       }
81918       function updateHints(datum2) {
81919         var help = _container.selectAll(".restriction-help").html("");
81920         var placeholders = {};
81921         ["from", "via", "to"].forEach(function(k3) {
81922           placeholders[k3] = { html: '<span class="qualifier">' + _t("restriction.help." + k3) + "</span>" };
81923         });
81924         var entity = datum2 && datum2.properties && datum2.properties.entity;
81925         if (entity) {
81926           datum2 = entity;
81927         }
81928         if (_fromWayID) {
81929           way = vgraph.entity(_fromWayID);
81930           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
81931         }
81932         if (datum2 instanceof osmWay && datum2.__from) {
81933           way = datum2;
81934           highlightPathsFrom(_fromWayID ? null : way.id);
81935           surface.selectAll("." + way.id).classed("related", true);
81936           var clickSelect = !_fromWayID || _fromWayID !== way.id;
81937           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
81938             from: placeholders.from,
81939             fromName: displayName(way.id, vgraph)
81940           }));
81941         } else if (datum2 instanceof osmTurn) {
81942           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
81943           var turnType = restrictionType.replace(/^(only|no)\_/, "");
81944           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
81945           var klass, turnText, nextText;
81946           if (datum2.no) {
81947             klass = "restrict";
81948             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
81949             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
81950           } else if (datum2.only) {
81951             klass = "only";
81952             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
81953             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
81954           } else {
81955             klass = "allow";
81956             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
81957             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
81958           }
81959           help.append("div").attr("class", "qualifier " + klass).html(turnText);
81960           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
81961             from: placeholders.from,
81962             fromName: displayName(datum2.from.way, vgraph),
81963             to: placeholders.to,
81964             toName: displayName(datum2.to.way, vgraph)
81965           }));
81966           if (datum2.via.ways && datum2.via.ways.length) {
81967             var names = [];
81968             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
81969               var prev = names[names.length - 1];
81970               var curr = displayName(datum2.via.ways[i4], vgraph);
81971               if (!prev || curr !== prev) {
81972                 names.push(curr);
81973               }
81974             }
81975             help.append("div").html(_t.html("restriction.help.via_names", {
81976               via: placeholders.via,
81977               viaNames: names.join(", ")
81978             }));
81979           }
81980           if (!indirect) {
81981             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
81982           }
81983           highlightPathsFrom(null);
81984           var alongIDs = datum2.path.slice();
81985           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
81986         } else {
81987           highlightPathsFrom(null);
81988           if (_fromWayID) {
81989             help.append("div").html(_t.html("restriction.help.from_name", {
81990               from: placeholders.from,
81991               fromName: displayName(_fromWayID, vgraph)
81992             }));
81993           } else {
81994             help.append("div").html(_t.html("restriction.help.select_from", {
81995               from: placeholders.from
81996             }));
81997           }
81998         }
81999       }
82000     }
82001     function displayMaxDistance(maxDist) {
82002       return (selection2) => {
82003         var isImperial = !_mainLocalizer.usesMetric();
82004         var opts;
82005         if (isImperial) {
82006           var distToFeet = {
82007             // imprecise conversion for prettier display
82008             20: 70,
82009             25: 85,
82010             30: 100,
82011             35: 115,
82012             40: 130,
82013             45: 145,
82014             50: 160
82015           }[maxDist];
82016           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
82017         } else {
82018           opts = { distance: _t("units.meters", { quantity: maxDist }) };
82019         }
82020         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
82021       };
82022     }
82023     function displayMaxVia(maxVia) {
82024       return (selection2) => {
82025         selection2 = selection2.html("");
82026         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"));
82027       };
82028     }
82029     function displayName(entityID, graph) {
82030       var entity = graph.entity(entityID);
82031       var name = utilDisplayName(entity) || "";
82032       var matched = _mainPresetIndex.match(entity, graph);
82033       var type2 = matched && matched.name() || utilDisplayType(entity.id);
82034       return name || type2;
82035     }
82036     restrictions.entityIDs = function(val) {
82037       _intersection = null;
82038       _fromWayID = null;
82039       _oldTurns = null;
82040       _vertexID = val[0];
82041     };
82042     restrictions.tags = function() {
82043     };
82044     restrictions.focus = function() {
82045     };
82046     restrictions.off = function(selection2) {
82047       if (!_initialized3) return;
82048       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
82049       select_default2(window).on("resize.restrictions", null);
82050     };
82051     return utilRebind(restrictions, dispatch14, "on");
82052   }
82053   var init_restrictions = __esm({
82054     "modules/ui/fields/restrictions.js"() {
82055       "use strict";
82056       init_src4();
82057       init_src5();
82058       init_presets();
82059       init_preferences();
82060       init_localizer();
82061       init_restrict_turn();
82062       init_unrestrict_turn();
82063       init_breathe();
82064       init_geo2();
82065       init_osm();
82066       init_svg();
82067       init_util();
82068       init_dimensions();
82069       uiFieldRestrictions.supportsMultiselection = false;
82070     }
82071   });
82072
82073   // modules/ui/fields/textarea.js
82074   var textarea_exports = {};
82075   __export(textarea_exports, {
82076     uiFieldTextarea: () => uiFieldTextarea
82077   });
82078   function uiFieldTextarea(field, context) {
82079     var dispatch14 = dispatch_default("change");
82080     var input = select_default2(null);
82081     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
82082     var _tags;
82083     function textarea(selection2) {
82084       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82085       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
82086       input = wrap2.selectAll("textarea").data([0]);
82087       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
82088       wrap2.call(_lengthIndicator);
82089       function change(onInput) {
82090         return function() {
82091           var val = utilGetSetValue(input);
82092           if (!onInput) val = context.cleanTagValue(val);
82093           if (!val && Array.isArray(_tags[field.key])) return;
82094           var t2 = {};
82095           t2[field.key] = val || void 0;
82096           dispatch14.call("change", this, t2, onInput);
82097         };
82098       }
82099     }
82100     textarea.tags = function(tags) {
82101       _tags = tags;
82102       var isMixed = Array.isArray(tags[field.key]);
82103       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);
82104       if (!isMixed) {
82105         _lengthIndicator.update(tags[field.key]);
82106       }
82107     };
82108     textarea.focus = function() {
82109       input.node().focus();
82110     };
82111     return utilRebind(textarea, dispatch14, "on");
82112   }
82113   var init_textarea = __esm({
82114     "modules/ui/fields/textarea.js"() {
82115       "use strict";
82116       init_src4();
82117       init_src5();
82118       init_localizer();
82119       init_util();
82120       init_ui();
82121     }
82122   });
82123
82124   // modules/ui/fields/wikidata.js
82125   var wikidata_exports2 = {};
82126   __export(wikidata_exports2, {
82127     uiFieldWikidata: () => uiFieldWikidata
82128   });
82129   function uiFieldWikidata(field, context) {
82130     var wikidata = services.wikidata;
82131     var dispatch14 = dispatch_default("change");
82132     var _selection = select_default2(null);
82133     var _searchInput = select_default2(null);
82134     var _qid = null;
82135     var _wikidataEntity = null;
82136     var _wikiURL = "";
82137     var _entityIDs = [];
82138     var _wikipediaKey = field.keys && field.keys.find(function(key) {
82139       return key.includes("wikipedia");
82140     });
82141     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
82142     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
82143     function wiki(selection2) {
82144       _selection = selection2;
82145       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82146       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
82147       var list = wrap2.selectAll("ul").data([0]);
82148       list = list.enter().append("ul").attr("class", "rows").merge(list);
82149       var searchRow = list.selectAll("li.wikidata-search").data([0]);
82150       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
82151       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
82152         var node = select_default2(this).node();
82153         node.setSelectionRange(0, node.value.length);
82154       }).on("blur", function() {
82155         setLabelForEntity();
82156       }).call(combobox.fetcher(fetchWikidataItems));
82157       combobox.on("accept", function(d2) {
82158         if (d2) {
82159           _qid = d2.id;
82160           change();
82161         }
82162       }).on("cancel", function() {
82163         setLabelForEntity();
82164       });
82165       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) {
82166         d3_event.preventDefault();
82167         if (_wikiURL) window.open(_wikiURL, "_blank");
82168       });
82169       searchRow = searchRow.merge(searchRowEnter);
82170       _searchInput = searchRow.select("input");
82171       var wikidataProperties = ["description", "identifier"];
82172       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
82173       var enter = items.enter().append("li").attr("class", function(d2) {
82174         return "labeled-input preset-wikidata-" + d2;
82175       });
82176       enter.append("div").attr("class", "label").html(function(d2) {
82177         return _t.html("wikidata." + d2);
82178       });
82179       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
82180       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
82181         d3_event.preventDefault();
82182         select_default2(this.parentNode).select("input").node().select();
82183         document.execCommand("copy");
82184       });
82185     }
82186     function fetchWikidataItems(q3, callback) {
82187       if (!q3 && _hintKey) {
82188         for (var i3 in _entityIDs) {
82189           var entity = context.hasEntity(_entityIDs[i3]);
82190           if (entity.tags[_hintKey]) {
82191             q3 = entity.tags[_hintKey];
82192             break;
82193           }
82194         }
82195       }
82196       wikidata.itemsForSearchQuery(q3, function(err, data) {
82197         if (err) {
82198           if (err !== "No query") console.error(err);
82199           return;
82200         }
82201         var result = data.map(function(item) {
82202           return {
82203             id: item.id,
82204             value: item.display.label.value + " (" + item.id + ")",
82205             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
82206             title: item.display.description && item.display.description.value,
82207             terms: item.aliases
82208           };
82209         });
82210         if (callback) callback(result);
82211       });
82212     }
82213     function change() {
82214       var syncTags = {};
82215       syncTags[field.key] = _qid;
82216       dispatch14.call("change", this, syncTags);
82217       var initGraph = context.graph();
82218       var initEntityIDs = _entityIDs;
82219       wikidata.entityByQID(_qid, function(err, entity) {
82220         if (err) return;
82221         if (context.graph() !== initGraph) return;
82222         if (!entity.sitelinks) return;
82223         var langs = wikidata.languagesToQuery();
82224         ["labels", "descriptions"].forEach(function(key) {
82225           if (!entity[key]) return;
82226           var valueLangs = Object.keys(entity[key]);
82227           if (valueLangs.length === 0) return;
82228           var valueLang = valueLangs[0];
82229           if (langs.indexOf(valueLang) === -1) {
82230             langs.push(valueLang);
82231           }
82232         });
82233         var newWikipediaValue;
82234         if (_wikipediaKey) {
82235           var foundPreferred;
82236           for (var i3 in langs) {
82237             var lang = langs[i3];
82238             var siteID = lang.replace("-", "_") + "wiki";
82239             if (entity.sitelinks[siteID]) {
82240               foundPreferred = true;
82241               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
82242               break;
82243             }
82244           }
82245           if (!foundPreferred) {
82246             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
82247               return site.endsWith("wiki");
82248             });
82249             if (wikiSiteKeys.length === 0) {
82250               newWikipediaValue = null;
82251             } else {
82252               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
82253               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
82254               newWikipediaValue = wikiLang + ":" + wikiTitle;
82255             }
82256           }
82257         }
82258         if (newWikipediaValue) {
82259           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
82260         }
82261         if (typeof newWikipediaValue === "undefined") return;
82262         var actions = initEntityIDs.map(function(entityID) {
82263           var entity2 = context.hasEntity(entityID);
82264           if (!entity2) return null;
82265           var currTags = Object.assign({}, entity2.tags);
82266           if (newWikipediaValue === null) {
82267             if (!currTags[_wikipediaKey]) return null;
82268             delete currTags[_wikipediaKey];
82269           } else {
82270             currTags[_wikipediaKey] = newWikipediaValue;
82271           }
82272           return actionChangeTags(entityID, currTags);
82273         }).filter(Boolean);
82274         if (!actions.length) return;
82275         context.replace(
82276           function actionUpdateWikipediaTags(graph) {
82277             actions.forEach(function(action) {
82278               graph = action(graph);
82279             });
82280             return graph;
82281           },
82282           context.history().undoAnnotation()
82283         );
82284       });
82285     }
82286     function setLabelForEntity() {
82287       var label = {
82288         value: ""
82289       };
82290       if (_wikidataEntity) {
82291         label = entityPropertyForDisplay(_wikidataEntity, "labels");
82292         if (label.value.length === 0) {
82293           label.value = _wikidataEntity.id.toString();
82294         }
82295       }
82296       utilGetSetValue(_searchInput, label.value).attr("lang", label.language);
82297     }
82298     wiki.tags = function(tags) {
82299       var isMixed = Array.isArray(tags[field.key]);
82300       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
82301       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
82302       if (!/^Q[0-9]*$/.test(_qid)) {
82303         unrecognized();
82304         return;
82305       }
82306       _wikiURL = "https://wikidata.org/wiki/" + _qid;
82307       wikidata.entityByQID(_qid, function(err, entity) {
82308         if (err) {
82309           unrecognized();
82310           return;
82311         }
82312         _wikidataEntity = entity;
82313         setLabelForEntity();
82314         var description = entityPropertyForDisplay(entity, "descriptions");
82315         _selection.select("button.wiki-link").classed("disabled", false);
82316         _selection.select(".preset-wikidata-description").style("display", function() {
82317           return description.value.length > 0 ? "flex" : "none";
82318         }).select("input").attr("value", description.value).attr("lang", description.language);
82319         _selection.select(".preset-wikidata-identifier").style("display", function() {
82320           return entity.id ? "flex" : "none";
82321         }).select("input").attr("value", entity.id);
82322       });
82323       function unrecognized() {
82324         _wikidataEntity = null;
82325         setLabelForEntity();
82326         _selection.select(".preset-wikidata-description").style("display", "none");
82327         _selection.select(".preset-wikidata-identifier").style("display", "none");
82328         _selection.select("button.wiki-link").classed("disabled", true);
82329         if (_qid && _qid !== "") {
82330           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
82331         } else {
82332           _wikiURL = "";
82333         }
82334       }
82335     };
82336     function entityPropertyForDisplay(wikidataEntity, propKey) {
82337       var blankResponse = { value: "" };
82338       if (!wikidataEntity[propKey]) return blankResponse;
82339       var propObj = wikidataEntity[propKey];
82340       var langKeys = Object.keys(propObj);
82341       if (langKeys.length === 0) return blankResponse;
82342       var langs = wikidata.languagesToQuery();
82343       for (var i3 in langs) {
82344         var lang = langs[i3];
82345         var valueObj = propObj[lang];
82346         if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj;
82347       }
82348       return propObj[langKeys[0]];
82349     }
82350     wiki.entityIDs = function(val) {
82351       if (!arguments.length) return _entityIDs;
82352       _entityIDs = val;
82353       return wiki;
82354     };
82355     wiki.focus = function() {
82356       _searchInput.node().focus();
82357     };
82358     return utilRebind(wiki, dispatch14, "on");
82359   }
82360   var init_wikidata2 = __esm({
82361     "modules/ui/fields/wikidata.js"() {
82362       "use strict";
82363       init_src4();
82364       init_src5();
82365       init_change_tags();
82366       init_services();
82367       init_icon();
82368       init_util();
82369       init_combobox();
82370       init_localizer();
82371     }
82372   });
82373
82374   // modules/ui/fields/wikipedia.js
82375   var wikipedia_exports2 = {};
82376   __export(wikipedia_exports2, {
82377     uiFieldWikipedia: () => uiFieldWikipedia
82378   });
82379   function uiFieldWikipedia(field, context) {
82380     const scheme = "https://";
82381     const domain = "wikipedia.org";
82382     const dispatch14 = dispatch_default("change");
82383     const wikipedia = services.wikipedia;
82384     const wikidata = services.wikidata;
82385     let _langInput = select_default2(null);
82386     let _titleInput = select_default2(null);
82387     let _wikiURL = "";
82388     let _entityIDs;
82389     let _tags;
82390     let _dataWikipedia = [];
82391     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
82392       _dataWikipedia = d2;
82393       if (_tags) updateForTags(_tags);
82394     }).catch(() => {
82395     });
82396     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
82397       const v3 = value.toLowerCase();
82398       callback(
82399         _dataWikipedia.filter((d2) => {
82400           return d2[0].toLowerCase().indexOf(v3) >= 0 || d2[1].toLowerCase().indexOf(v3) >= 0 || d2[2].toLowerCase().indexOf(v3) >= 0;
82401         }).map((d2) => ({ value: d2[1] }))
82402       );
82403     });
82404     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
82405       if (!value) {
82406         value = "";
82407         for (let i3 in _entityIDs) {
82408           let entity = context.hasEntity(_entityIDs[i3]);
82409           if (entity.tags.name) {
82410             value = entity.tags.name;
82411             break;
82412           }
82413         }
82414       }
82415       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
82416       searchfn(language()[2], value, (query, data) => {
82417         callback(data.map((d2) => ({ value: d2 })));
82418       });
82419     });
82420     function wiki(selection2) {
82421       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82422       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
82423       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
82424       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
82425       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
82426       _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);
82427       _langInput.on("blur", changeLang).on("change", changeLang);
82428       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
82429       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
82430       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
82431       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
82432       _titleInput.on("blur", function() {
82433         change(true);
82434       }).on("change", function() {
82435         change(false);
82436       });
82437       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
82438       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);
82439       link2.on("click", (d3_event) => {
82440         d3_event.preventDefault();
82441         if (_wikiURL) window.open(_wikiURL, "_blank");
82442       });
82443     }
82444     function defaultLanguageInfo(skipEnglishFallback) {
82445       const langCode = _mainLocalizer.languageCode().toLowerCase();
82446       for (let i3 in _dataWikipedia) {
82447         let d2 = _dataWikipedia[i3];
82448         if (d2[2] === langCode) return d2;
82449       }
82450       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
82451     }
82452     function language(skipEnglishFallback) {
82453       const value = utilGetSetValue(_langInput).toLowerCase();
82454       for (let i3 in _dataWikipedia) {
82455         let d2 = _dataWikipedia[i3];
82456         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value) return d2;
82457       }
82458       return defaultLanguageInfo(skipEnglishFallback);
82459     }
82460     function changeLang() {
82461       utilGetSetValue(_langInput, language()[1]);
82462       change(true);
82463     }
82464     function change(skipWikidata) {
82465       let value = utilGetSetValue(_titleInput);
82466       const m3 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
82467       const langInfo = m3 && _dataWikipedia.find((d2) => m3[1] === d2[2]);
82468       let syncTags = {};
82469       if (langInfo) {
82470         const nativeLangName = langInfo[1];
82471         value = decodeURIComponent(m3[2]).replace(/_/g, " ");
82472         if (m3[3]) {
82473           let anchor;
82474           anchor = decodeURIComponent(m3[3]);
82475           value += "#" + anchor.replace(/_/g, " ");
82476         }
82477         value = value.slice(0, 1).toUpperCase() + value.slice(1);
82478         utilGetSetValue(_langInput, nativeLangName).attr("lang", langInfo[2]);
82479         utilGetSetValue(_titleInput, value);
82480       }
82481       if (value) {
82482         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
82483       } else {
82484         syncTags.wikipedia = void 0;
82485       }
82486       dispatch14.call("change", this, syncTags);
82487       if (skipWikidata || !value || !language()[2]) return;
82488       const initGraph = context.graph();
82489       const initEntityIDs = _entityIDs;
82490       wikidata.itemsByTitle(language()[2], value, (err, data) => {
82491         if (err || !data || !Object.keys(data).length) return;
82492         if (context.graph() !== initGraph) return;
82493         const qids = Object.keys(data);
82494         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
82495         let actions = initEntityIDs.map((entityID) => {
82496           let entity = context.entity(entityID).tags;
82497           let currTags = Object.assign({}, entity);
82498           if (currTags.wikidata !== value2) {
82499             currTags.wikidata = value2;
82500             return actionChangeTags(entityID, currTags);
82501           }
82502           return null;
82503         }).filter(Boolean);
82504         if (!actions.length) return;
82505         context.replace(
82506           function actionUpdateWikidataTags(graph) {
82507             actions.forEach(function(action) {
82508               graph = action(graph);
82509             });
82510             return graph;
82511           },
82512           context.history().undoAnnotation()
82513         );
82514       });
82515     }
82516     wiki.tags = (tags) => {
82517       _tags = tags;
82518       updateForTags(tags);
82519     };
82520     function updateForTags(tags) {
82521       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
82522       const m3 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
82523       const tagLang = m3 && m3[1];
82524       const tagArticleTitle = m3 && m3[2];
82525       let anchor = m3 && m3[3];
82526       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
82527       if (tagLangInfo) {
82528         const nativeLangName = tagLangInfo[1];
82529         utilGetSetValue(_langInput, nativeLangName);
82530         _titleInput.attr("lang", tagLangInfo[2]);
82531         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
82532         _wikiURL = `${scheme}${tagLang}.${domain}/wiki/${wiki.encodePath(tagArticleTitle, anchor)}`;
82533       } else {
82534         utilGetSetValue(_titleInput, value);
82535         if (value && value !== "") {
82536           utilGetSetValue(_langInput, "");
82537           const defaultLangInfo = defaultLanguageInfo();
82538           _wikiURL = `${scheme}${defaultLangInfo[2]}.${domain}/w/index.php?fulltext=1&search=${value}`;
82539         } else {
82540           const shownOrDefaultLangInfo = language(
82541             true
82542             /* skipEnglishFallback */
82543           );
82544           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
82545           _wikiURL = "";
82546         }
82547       }
82548     }
82549     wiki.encodePath = (tagArticleTitle, anchor) => {
82550       const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
82551       const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
82552       const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
82553       return `${uriEncodedUnderscoredTitle}${uriEncodedAnchorFragment}`;
82554     };
82555     wiki.encodeURIAnchorFragment = (anchor) => {
82556       if (!anchor) return "";
82557       const underscoredAnchor = anchor.replace(/ /g, "_");
82558       return "#" + encodeURIComponent(underscoredAnchor);
82559     };
82560     wiki.entityIDs = (val) => {
82561       if (!arguments.length) return _entityIDs;
82562       _entityIDs = val;
82563       return wiki;
82564     };
82565     wiki.focus = () => {
82566       _titleInput.node().focus();
82567     };
82568     return utilRebind(wiki, dispatch14, "on");
82569   }
82570   var init_wikipedia2 = __esm({
82571     "modules/ui/fields/wikipedia.js"() {
82572       "use strict";
82573       init_src4();
82574       init_src5();
82575       init_file_fetcher();
82576       init_localizer();
82577       init_change_tags();
82578       init_services();
82579       init_icon();
82580       init_combobox();
82581       init_util();
82582       uiFieldWikipedia.supportsMultiselection = false;
82583     }
82584   });
82585
82586   // modules/ui/fields/index.js
82587   var fields_exports = {};
82588   __export(fields_exports, {
82589     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
82590     likelyRawNumberFormat: () => likelyRawNumberFormat,
82591     uiFieldAccess: () => uiFieldAccess,
82592     uiFieldAddress: () => uiFieldAddress,
82593     uiFieldCheck: () => uiFieldCheck,
82594     uiFieldColour: () => uiFieldText,
82595     uiFieldCombo: () => uiFieldCombo,
82596     uiFieldDefaultCheck: () => uiFieldCheck,
82597     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
82598     uiFieldEmail: () => uiFieldText,
82599     uiFieldIdentifier: () => uiFieldText,
82600     uiFieldLanes: () => uiFieldLanes,
82601     uiFieldLocalized: () => uiFieldLocalized,
82602     uiFieldManyCombo: () => uiFieldCombo,
82603     uiFieldMultiCombo: () => uiFieldCombo,
82604     uiFieldNetworkCombo: () => uiFieldCombo,
82605     uiFieldNumber: () => uiFieldText,
82606     uiFieldOnewayCheck: () => uiFieldCheck,
82607     uiFieldRadio: () => uiFieldRadio,
82608     uiFieldRestrictions: () => uiFieldRestrictions,
82609     uiFieldRoadheight: () => uiFieldRoadheight,
82610     uiFieldRoadspeed: () => uiFieldRoadspeed,
82611     uiFieldSemiCombo: () => uiFieldCombo,
82612     uiFieldStructureRadio: () => uiFieldRadio,
82613     uiFieldTel: () => uiFieldText,
82614     uiFieldText: () => uiFieldText,
82615     uiFieldTextarea: () => uiFieldTextarea,
82616     uiFieldTypeCombo: () => uiFieldCombo,
82617     uiFieldUrl: () => uiFieldText,
82618     uiFieldWikidata: () => uiFieldWikidata,
82619     uiFieldWikipedia: () => uiFieldWikipedia,
82620     uiFields: () => uiFields
82621   });
82622   var uiFields;
82623   var init_fields = __esm({
82624     "modules/ui/fields/index.js"() {
82625       "use strict";
82626       init_check();
82627       init_combo();
82628       init_input();
82629       init_access();
82630       init_address();
82631       init_directional_combo();
82632       init_lanes2();
82633       init_localized();
82634       init_roadheight();
82635       init_roadspeed();
82636       init_radio();
82637       init_restrictions();
82638       init_textarea();
82639       init_wikidata2();
82640       init_wikipedia2();
82641       init_check();
82642       init_combo();
82643       init_input();
82644       init_radio();
82645       init_access();
82646       init_address();
82647       init_directional_combo();
82648       init_lanes2();
82649       init_localized();
82650       init_roadheight();
82651       init_roadspeed();
82652       init_restrictions();
82653       init_textarea();
82654       init_wikidata2();
82655       init_wikipedia2();
82656       uiFields = {
82657         access: uiFieldAccess,
82658         address: uiFieldAddress,
82659         check: uiFieldCheck,
82660         colour: uiFieldText,
82661         combo: uiFieldCombo,
82662         cycleway: uiFieldDirectionalCombo,
82663         date: uiFieldText,
82664         defaultCheck: uiFieldCheck,
82665         directionalCombo: uiFieldDirectionalCombo,
82666         email: uiFieldText,
82667         identifier: uiFieldText,
82668         lanes: uiFieldLanes,
82669         localized: uiFieldLocalized,
82670         roadheight: uiFieldRoadheight,
82671         roadspeed: uiFieldRoadspeed,
82672         manyCombo: uiFieldCombo,
82673         multiCombo: uiFieldCombo,
82674         networkCombo: uiFieldCombo,
82675         number: uiFieldText,
82676         onewayCheck: uiFieldCheck,
82677         radio: uiFieldRadio,
82678         restrictions: uiFieldRestrictions,
82679         semiCombo: uiFieldCombo,
82680         structureRadio: uiFieldRadio,
82681         tel: uiFieldText,
82682         text: uiFieldText,
82683         textarea: uiFieldTextarea,
82684         typeCombo: uiFieldCombo,
82685         url: uiFieldText,
82686         wikidata: uiFieldWikidata,
82687         wikipedia: uiFieldWikipedia
82688       };
82689     }
82690   });
82691
82692   // modules/ui/field.js
82693   var field_exports2 = {};
82694   __export(field_exports2, {
82695     uiField: () => uiField
82696   });
82697   function uiField(context, presetField2, entityIDs, options) {
82698     options = Object.assign({
82699       show: true,
82700       wrap: true,
82701       remove: true,
82702       revert: true,
82703       info: true
82704     }, options);
82705     var dispatch14 = dispatch_default("change", "revert");
82706     var field = Object.assign({}, presetField2);
82707     field.domId = utilUniqueDomId("form-field-" + field.safeid);
82708     var _show = options.show;
82709     var _state = "";
82710     var _tags = {};
82711     var _entityExtent;
82712     if (entityIDs && entityIDs.length) {
82713       _entityExtent = entityIDs.reduce(function(extent, entityID) {
82714         var entity = context.graph().entity(entityID);
82715         return extent.extend(entity.extent(context.graph()));
82716       }, geoExtent());
82717     }
82718     var _locked = false;
82719     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
82720     if (_show && !field.impl) {
82721       createField();
82722     }
82723     function createField() {
82724       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
82725         dispatch14.call("change", field, t2, onInput);
82726       });
82727       if (entityIDs) {
82728         field.entityIDs = entityIDs;
82729         if (field.impl.entityIDs) {
82730           field.impl.entityIDs(entityIDs);
82731         }
82732       }
82733     }
82734     function allKeys() {
82735       let keys2 = field.keys || [field.key];
82736       if (field.type === "directionalCombo" && field.key) {
82737         const baseKey = field.key.replace(/:both$/, "");
82738         keys2 = keys2.concat(baseKey, `${baseKey}:both`);
82739       }
82740       return keys2;
82741     }
82742     function isModified() {
82743       if (!entityIDs || !entityIDs.length) return false;
82744       return entityIDs.some(function(entityID) {
82745         var original = context.graph().base().entities[entityID];
82746         var latest = context.graph().entity(entityID);
82747         return allKeys().some(function(key) {
82748           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
82749         });
82750       });
82751     }
82752     function tagsContainFieldKey() {
82753       return allKeys().some(function(key) {
82754         if (field.type === "multiCombo") {
82755           for (var tagKey in _tags) {
82756             if (tagKey.indexOf(key) === 0) {
82757               return true;
82758             }
82759           }
82760           return false;
82761         }
82762         if (field.type === "localized") {
82763           for (let tagKey2 in _tags) {
82764             let match = tagKey2.match(LANGUAGE_SUFFIX_REGEX);
82765             if (match && match[1] === field.key && match[2]) {
82766               return true;
82767             }
82768           }
82769         }
82770         return _tags[key] !== void 0;
82771       });
82772     }
82773     function revert(d3_event, d2) {
82774       d3_event.stopPropagation();
82775       d3_event.preventDefault();
82776       if (!entityIDs || _locked) return;
82777       dispatch14.call("revert", d2, allKeys());
82778     }
82779     function remove2(d3_event, d2) {
82780       d3_event.stopPropagation();
82781       d3_event.preventDefault();
82782       if (_locked) return;
82783       var t2 = {};
82784       allKeys().forEach(function(key) {
82785         t2[key] = void 0;
82786       });
82787       dispatch14.call("change", d2, t2);
82788     }
82789     field.render = function(selection2) {
82790       var container = selection2.selectAll(".form-field").data([field]);
82791       var enter = container.enter().append("div").attr("class", function(d2) {
82792         return "form-field form-field-" + d2.safeid;
82793       }).classed("nowrap", !options.wrap);
82794       if (options.wrap) {
82795         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
82796           return d2.domId;
82797         });
82798         var textEnter = labelEnter.append("span").attr("class", "label-text");
82799         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
82800           d2.label()(select_default2(this));
82801         });
82802         textEnter.append("span").attr("class", "label-textannotation");
82803         if (options.remove) {
82804           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
82805         }
82806         if (options.revert) {
82807           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
82808         }
82809       }
82810       container = container.merge(enter);
82811       container.select(".field-label > .remove-icon").on("click", remove2);
82812       container.select(".field-label > .modified-icon").on("click", revert);
82813       container.each(function(d2) {
82814         var selection3 = select_default2(this);
82815         if (!d2.impl) {
82816           createField();
82817         }
82818         var reference, help;
82819         if (options.wrap && field.type === "restrictions") {
82820           help = uiFieldHelp(context, "restrictions");
82821         }
82822         if (options.wrap && options.info) {
82823           var referenceKey = d2.key || "";
82824           if (d2.type === "multiCombo") {
82825             referenceKey = referenceKey.replace(/:$/, "");
82826           }
82827           var referenceOptions = d2.reference || {
82828             key: referenceKey,
82829             value: _tags[referenceKey]
82830           };
82831           reference = uiTagReference(referenceOptions, context);
82832           if (_state === "hover") {
82833             reference.showing(false);
82834           }
82835         }
82836         selection3.call(d2.impl);
82837         if (help) {
82838           selection3.call(help.body).select(".field-label").call(help.button);
82839         }
82840         if (reference) {
82841           selection3.call(reference.body).select(".field-label").call(reference.button);
82842         }
82843         d2.impl.tags(_tags);
82844       });
82845       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
82846       var annotation = container.selectAll(".field-label .label-textannotation");
82847       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
82848       icon2.exit().remove();
82849       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
82850       container.call(_locked ? _lockedTip : _lockedTip.destroy);
82851     };
82852     field.state = function(val) {
82853       if (!arguments.length) return _state;
82854       _state = val;
82855       return field;
82856     };
82857     field.tags = function(val) {
82858       if (!arguments.length) return _tags;
82859       _tags = val;
82860       if (tagsContainFieldKey() && !_show) {
82861         _show = true;
82862         if (!field.impl) {
82863           createField();
82864         }
82865       }
82866       return field;
82867     };
82868     field.locked = function(val) {
82869       if (!arguments.length) return _locked;
82870       _locked = val;
82871       return field;
82872     };
82873     field.show = function() {
82874       _show = true;
82875       if (!field.impl) {
82876         createField();
82877       }
82878       if (field.default && field.key && _tags[field.key] !== field.default) {
82879         var t2 = {};
82880         t2[field.key] = field.default;
82881         dispatch14.call("change", this, t2);
82882       }
82883     };
82884     field.isShown = function() {
82885       return _show;
82886     };
82887     field.isAllowed = function() {
82888       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false) return false;
82889       if (field.geometry && !entityIDs.every(function(entityID) {
82890         return field.matchGeometry(context.graph().geometry(entityID));
82891       })) return false;
82892       if (entityIDs && _entityExtent && field.locationSetID) {
82893         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
82894         if (!validHere[field.locationSetID]) return false;
82895       }
82896       var prerequisiteTag = field.prerequisiteTag;
82897       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
82898       prerequisiteTag) {
82899         if (!entityIDs.every(function(entityID) {
82900           var entity = context.graph().entity(entityID);
82901           if (prerequisiteTag.key) {
82902             var value = entity.tags[prerequisiteTag.key];
82903             if (!value) return false;
82904             if (prerequisiteTag.valueNot) {
82905               return prerequisiteTag.valueNot !== value;
82906             }
82907             if (prerequisiteTag.value) {
82908               return prerequisiteTag.value === value;
82909             }
82910           } else if (prerequisiteTag.keyNot) {
82911             if (entity.tags[prerequisiteTag.keyNot]) return false;
82912           }
82913           return true;
82914         })) return false;
82915       }
82916       return true;
82917     };
82918     field.focus = function() {
82919       if (field.impl) {
82920         field.impl.focus();
82921       }
82922     };
82923     return utilRebind(field, dispatch14, "on");
82924   }
82925   var init_field2 = __esm({
82926     "modules/ui/field.js"() {
82927       "use strict";
82928       init_src4();
82929       init_src5();
82930       init_localizer();
82931       init_LocationManager();
82932       init_icon();
82933       init_tooltip();
82934       init_extent();
82935       init_field_help();
82936       init_fields();
82937       init_localized();
82938       init_tag_reference();
82939       init_util();
82940     }
82941   });
82942
82943   // modules/ui/changeset_editor.js
82944   var changeset_editor_exports = {};
82945   __export(changeset_editor_exports, {
82946     uiChangesetEditor: () => uiChangesetEditor
82947   });
82948   function uiChangesetEditor(context) {
82949     var dispatch14 = dispatch_default("change");
82950     var formFields = uiFormFields(context);
82951     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
82952     var _fieldsArr;
82953     var _tags;
82954     var _changesetID;
82955     function changesetEditor(selection2) {
82956       render(selection2);
82957     }
82958     function render(selection2) {
82959       var _a4;
82960       var initial = false;
82961       if (!_fieldsArr) {
82962         initial = true;
82963         var presets = _mainPresetIndex;
82964         _fieldsArr = [
82965           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
82966           uiField(context, presets.field("source"), null, { show: true, revert: false }),
82967           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
82968         ];
82969         _fieldsArr.forEach(function(field) {
82970           field.on("change", function(t2, onInput) {
82971             dispatch14.call("change", field, void 0, t2, onInput);
82972           });
82973         });
82974       }
82975       _fieldsArr.forEach(function(field) {
82976         field.tags(_tags);
82977       });
82978       selection2.call(formFields.fieldsArr(_fieldsArr));
82979       if (initial) {
82980         var commentField = selection2.select(".form-field-comment textarea");
82981         const sourceField = _fieldsArr.find((field) => field.id === "source");
82982         var commentNode = commentField.node();
82983         if (commentNode) {
82984           commentNode.focus();
82985           commentNode.select();
82986         }
82987         utilTriggerEvent(commentField, "blur");
82988         var osm = context.connection();
82989         if (osm) {
82990           osm.userChangesets(function(err, changesets) {
82991             if (err) return;
82992             var comments = changesets.map(function(changeset) {
82993               var comment = changeset.tags.comment;
82994               return comment ? { title: comment, value: comment } : null;
82995             }).filter(Boolean);
82996             commentField.call(
82997               commentCombo.data(utilArrayUniqBy(comments, "title"))
82998             );
82999             const recentSources = changesets.flatMap((changeset) => {
83000               var _a5;
83001               return (_a5 = changeset.tags.source) == null ? void 0 : _a5.split(";");
83002             }).filter((value) => !sourceField.options.includes(value)).filter(Boolean).map((title) => ({ title, value: title, klass: "raw-option" }));
83003             sourceField.impl.setCustomOptions(utilArrayUniqBy(recentSources, "title"));
83004           });
83005         }
83006       }
83007       const warnings = [];
83008       if ((_a4 = _tags.comment) == null ? void 0 : _a4.match(/google/i)) {
83009         warnings.push({
83010           id: 'contains "google"',
83011           msg: _t.append("commit.google_warning"),
83012           link: _t("commit.google_warning_link")
83013         });
83014       }
83015       const maxChars = context.maxCharsForTagValue();
83016       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
83017       if (strLen > maxChars || false) {
83018         warnings.push({
83019           id: "message too long",
83020           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
83021         });
83022       }
83023       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
83024       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
83025       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
83026       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
83027       commentEnter.transition().duration(200).style("opacity", 1);
83028       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
83029         let selection3 = select_default2(this);
83030         if (d2.link) {
83031           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
83032         }
83033         selection3.call(d2.msg);
83034       });
83035     }
83036     changesetEditor.tags = function(_3) {
83037       if (!arguments.length) return _tags;
83038       _tags = _3;
83039       return changesetEditor;
83040     };
83041     changesetEditor.changesetID = function(_3) {
83042       if (!arguments.length) return _changesetID;
83043       if (_changesetID === _3) return changesetEditor;
83044       _changesetID = _3;
83045       _fieldsArr = null;
83046       return changesetEditor;
83047     };
83048     return utilRebind(changesetEditor, dispatch14, "on");
83049   }
83050   var init_changeset_editor = __esm({
83051     "modules/ui/changeset_editor.js"() {
83052       "use strict";
83053       init_src4();
83054       init_src5();
83055       init_presets();
83056       init_localizer();
83057       init_icon();
83058       init_combobox();
83059       init_field2();
83060       init_form_fields();
83061       init_util();
83062     }
83063   });
83064
83065   // modules/ui/sections/changes.js
83066   var changes_exports = {};
83067   __export(changes_exports, {
83068     uiSectionChanges: () => uiSectionChanges
83069   });
83070   function uiSectionChanges(context) {
83071     var _discardTags = {};
83072     _mainFileFetcher.get("discarded").then(function(d2) {
83073       _discardTags = d2;
83074     }).catch(function() {
83075     });
83076     var section = uiSection("changes-list", context).label(function() {
83077       var history = context.history();
83078       var summary = history.difference().summary();
83079       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
83080     }).disclosureContent(renderDisclosureContent);
83081     function renderDisclosureContent(selection2) {
83082       var history = context.history();
83083       var summary = history.difference().summary();
83084       var container = selection2.selectAll(".commit-section").data([0]);
83085       var containerEnter = container.enter().append("div").attr("class", "commit-section");
83086       containerEnter.append("ul").attr("class", "changeset-list");
83087       container = containerEnter.merge(container);
83088       var items = container.select("ul").selectAll("li").data(summary);
83089       var itemsEnter = items.enter().append("li").attr("class", "change-item");
83090       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
83091       buttons.each(function(d2) {
83092         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
83093       });
83094       buttons.append("span").attr("class", "change-type").html(function(d2) {
83095         return _t.html("commit." + d2.changeType) + " ";
83096       });
83097       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
83098         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
83099         return matched && matched.name() || utilDisplayType(d2.entity.id);
83100       });
83101       buttons.append("span").attr("class", "entity-name").text(function(d2) {
83102         var name = utilDisplayName(d2.entity) || "", string = "";
83103         if (name !== "") {
83104           string += ":";
83105         }
83106         return string += " " + name;
83107       });
83108       items = itemsEnter.merge(items);
83109       var changeset = new osmChangeset().update({ id: void 0 });
83110       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
83111       delete changeset.id;
83112       var data = JXON.stringify(changeset.osmChangeJXON(changes));
83113       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
83114       var fileName = "changes.osc";
83115       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
83116       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
83117       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
83118       function mouseover(d3_event, d2) {
83119         if (d2.entity) {
83120           context.surface().selectAll(
83121             utilEntityOrMemberSelector([d2.entity.id], context.graph())
83122           ).classed("hover", true);
83123         }
83124       }
83125       function mouseout() {
83126         context.surface().selectAll(".hover").classed("hover", false);
83127       }
83128       function click(d3_event, change) {
83129         if (change.changeType !== "deleted") {
83130           var entity = change.entity;
83131           context.map().zoomToEase(entity);
83132           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
83133         }
83134       }
83135     }
83136     return section;
83137   }
83138   var init_changes = __esm({
83139     "modules/ui/sections/changes.js"() {
83140       "use strict";
83141       init_src5();
83142       init_presets();
83143       init_file_fetcher();
83144       init_localizer();
83145       init_jxon();
83146       init_discard_tags();
83147       init_osm();
83148       init_icon();
83149       init_section();
83150       init_util();
83151     }
83152   });
83153
83154   // modules/ui/commit.js
83155   var commit_exports = {};
83156   __export(commit_exports, {
83157     uiCommit: () => uiCommit
83158   });
83159   function uiCommit(context) {
83160     var dispatch14 = dispatch_default("cancel");
83161     var _userDetails2;
83162     var _selection;
83163     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
83164     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
83165     var commitChanges = uiSectionChanges(context);
83166     var commitWarnings = uiCommitWarnings(context);
83167     function commit(selection2) {
83168       _selection = selection2;
83169       if (!context.changeset) initChangeset();
83170       loadDerivedChangesetTags();
83171       selection2.call(render);
83172     }
83173     function initChangeset() {
83174       var commentDate = +corePreferences("commentDate") || 0;
83175       var currDate = Date.now();
83176       var cutoff = 2 * 86400 * 1e3;
83177       if (commentDate > currDate || currDate - commentDate > cutoff) {
83178         corePreferences("comment", null);
83179         corePreferences("hashtags", null);
83180         corePreferences("source", null);
83181       }
83182       if (context.defaultChangesetComment()) {
83183         corePreferences("comment", context.defaultChangesetComment());
83184         corePreferences("commentDate", Date.now());
83185       }
83186       if (context.defaultChangesetSource()) {
83187         corePreferences("source", context.defaultChangesetSource());
83188         corePreferences("commentDate", Date.now());
83189       }
83190       if (context.defaultChangesetHashtags()) {
83191         corePreferences("hashtags", context.defaultChangesetHashtags());
83192         corePreferences("commentDate", Date.now());
83193       }
83194       var detected = utilDetect();
83195       var tags = {
83196         comment: corePreferences("comment") || "",
83197         created_by: context.cleanTagValue("iD " + context.version),
83198         host: context.cleanTagValue(detected.host),
83199         locale: context.cleanTagValue(_mainLocalizer.localeCode())
83200       };
83201       findHashtags(tags, true);
83202       var hashtags = corePreferences("hashtags");
83203       if (hashtags) {
83204         tags.hashtags = hashtags;
83205       }
83206       var source = corePreferences("source");
83207       if (source) {
83208         tags.source = source;
83209       }
83210       var photoOverlaysUsed = context.history().photoOverlaysUsed();
83211       if (photoOverlaysUsed.length) {
83212         var sources = (tags.source || "").split(";");
83213         if (sources.indexOf("streetlevel imagery") === -1) {
83214           sources.push("streetlevel imagery");
83215         }
83216         photoOverlaysUsed.forEach(function(photoOverlay) {
83217           if (sources.indexOf(photoOverlay) === -1) {
83218             sources.push(photoOverlay);
83219           }
83220         });
83221         tags.source = context.cleanTagValue(sources.filter(Boolean).join(";"));
83222       }
83223       context.changeset = new osmChangeset({ tags });
83224     }
83225     function loadDerivedChangesetTags() {
83226       var osm = context.connection();
83227       if (!osm) return;
83228       var tags = Object.assign({}, context.changeset.tags);
83229       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
83230       tags.imagery_used = imageryUsed || "None";
83231       var osmClosed = osm.getClosedIDs();
83232       var itemType;
83233       if (osmClosed.length) {
83234         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
83235       }
83236       if (services.keepRight) {
83237         var krClosed = services.keepRight.getClosedIDs();
83238         if (krClosed.length) {
83239           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
83240         }
83241       }
83242       if (services.osmose) {
83243         var osmoseClosed = services.osmose.getClosedCounts();
83244         for (itemType in osmoseClosed) {
83245           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
83246         }
83247       }
83248       for (var key in tags) {
83249         if (key.match(/(^warnings:)|(^resolved:)/)) {
83250           delete tags[key];
83251         }
83252       }
83253       function addIssueCounts(issues, prefix) {
83254         var issuesByType = utilArrayGroupBy(issues, "type");
83255         for (var issueType in issuesByType) {
83256           var issuesOfType = issuesByType[issueType];
83257           if (issuesOfType[0].subtype) {
83258             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
83259             for (var issueSubtype in issuesBySubtype) {
83260               var issuesOfSubtype = issuesBySubtype[issueSubtype];
83261               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
83262             }
83263           } else {
83264             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
83265           }
83266         }
83267       }
83268       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
83269         return issue.type !== "help_request";
83270       });
83271       addIssueCounts(warnings, "warnings");
83272       var resolvedIssues = context.validator().getResolvedIssues();
83273       addIssueCounts(resolvedIssues, "resolved");
83274       context.changeset = context.changeset.update({ tags });
83275     }
83276     function render(selection2) {
83277       var osm = context.connection();
83278       if (!osm) return;
83279       var header = selection2.selectAll(".header").data([0]);
83280       var headerTitle = header.enter().append("div").attr("class", "header fillL");
83281       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
83282       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
83283         dispatch14.call("cancel", this);
83284       }).call(svgIcon("#iD-icon-close"));
83285       var body = selection2.selectAll(".body").data([0]);
83286       body = body.enter().append("div").attr("class", "body").merge(body);
83287       var changesetSection = body.selectAll(".changeset-editor").data([0]);
83288       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
83289       changesetSection.call(
83290         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
83291       );
83292       body.call(commitWarnings);
83293       var saveSection = body.selectAll(".save-section").data([0]);
83294       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
83295       var prose = saveSection.selectAll(".commit-info").data([0]);
83296       if (prose.enter().size()) {
83297         _userDetails2 = null;
83298       }
83299       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
83300       osm.userDetails(function(err, user) {
83301         if (err) return;
83302         if (_userDetails2 === user) return;
83303         _userDetails2 = user;
83304         var userLink = select_default2(document.createElement("div"));
83305         if (user.image_url) {
83306           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
83307         }
83308         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
83309         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
83310       });
83311       var requestReview = saveSection.selectAll(".request-review").data([0]);
83312       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
83313       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
83314       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
83315       if (!labelEnter.empty()) {
83316         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
83317       }
83318       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
83319       labelEnter.append("span").call(_t.append("commit.request_review"));
83320       requestReview = requestReview.merge(requestReviewEnter);
83321       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
83322       var buttonSection = saveSection.selectAll(".buttons").data([0]);
83323       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
83324       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
83325       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
83326       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
83327       var uploadBlockerTooltipText = getUploadBlockerMessage();
83328       buttonSection = buttonSection.merge(buttonEnter);
83329       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
83330         dispatch14.call("cancel", this);
83331       });
83332       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
83333         if (!select_default2(this).classed("disabled")) {
83334           this.blur();
83335           for (var key in context.changeset.tags) {
83336             if (!key) delete context.changeset.tags[key];
83337           }
83338           context.uploader().save(context.changeset);
83339         }
83340       });
83341       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
83342       if (uploadBlockerTooltipText) {
83343         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
83344       }
83345       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
83346       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
83347       tagSection.call(
83348         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
83349       );
83350       var changesSection = body.selectAll(".commit-changes-section").data([0]);
83351       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
83352       changesSection.call(commitChanges.render);
83353       function toggleRequestReview() {
83354         var rr = requestReviewInput.property("checked");
83355         updateChangeset({ review_requested: rr ? "yes" : void 0 });
83356         tagSection.call(
83357           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
83358         );
83359       }
83360     }
83361     function getUploadBlockerMessage() {
83362       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
83363       if (errors.length) {
83364         return _t.append("commit.outstanding_errors_message", { count: errors.length });
83365       } else {
83366         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
83367         if (!hasChangesetComment) {
83368           return _t.append("commit.comment_needed_message");
83369         }
83370       }
83371       return null;
83372     }
83373     function changeTags(_3, changed, onInput) {
83374       if (changed.hasOwnProperty("comment")) {
83375         if (!onInput) {
83376           corePreferences("comment", changed.comment);
83377           corePreferences("commentDate", Date.now());
83378         }
83379       }
83380       if (changed.hasOwnProperty("source")) {
83381         if (changed.source === void 0) {
83382           corePreferences("source", null);
83383         } else if (!onInput) {
83384           corePreferences("source", changed.source);
83385           corePreferences("commentDate", Date.now());
83386         }
83387       }
83388       updateChangeset(changed, onInput);
83389       if (_selection) {
83390         _selection.call(render);
83391       }
83392     }
83393     function findHashtags(tags, commentOnly) {
83394       var detectedHashtags = commentHashtags();
83395       if (detectedHashtags.length) {
83396         corePreferences("hashtags", null);
83397       }
83398       if (!detectedHashtags.length || !commentOnly) {
83399         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
83400       }
83401       var allLowerCase = /* @__PURE__ */ new Set();
83402       return detectedHashtags.filter(function(hashtag) {
83403         var lowerCase = hashtag.toLowerCase();
83404         if (!allLowerCase.has(lowerCase)) {
83405           allLowerCase.add(lowerCase);
83406           return true;
83407         }
83408         return false;
83409       });
83410       function commentHashtags() {
83411         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
83412         return matches || [];
83413       }
83414       function hashtagHashtags() {
83415         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
83416           if (s2[0] !== "#") {
83417             s2 = "#" + s2;
83418           }
83419           var matched = s2.match(hashtagRegex);
83420           return matched && matched[0];
83421         }).filter(Boolean);
83422         return matches || [];
83423       }
83424     }
83425     function isReviewRequested(tags) {
83426       var rr = tags.review_requested;
83427       if (rr === void 0) return false;
83428       rr = rr.trim().toLowerCase();
83429       return !(rr === "" || rr === "no");
83430     }
83431     function updateChangeset(changed, onInput) {
83432       var tags = Object.assign({}, context.changeset.tags);
83433       Object.keys(changed).forEach(function(k3) {
83434         var v3 = changed[k3];
83435         k3 = context.cleanTagKey(k3);
83436         if (readOnlyTags.indexOf(k3) !== -1) return;
83437         if (v3 === void 0) {
83438           delete tags[k3];
83439         } else if (onInput) {
83440           tags[k3] = v3;
83441         } else {
83442           tags[k3] = context.cleanTagValue(v3);
83443         }
83444       });
83445       if (!onInput) {
83446         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
83447         var arr = findHashtags(tags, commentOnly);
83448         if (arr.length) {
83449           tags.hashtags = context.cleanTagValue(arr.join(";"));
83450           corePreferences("hashtags", tags.hashtags);
83451         } else {
83452           delete tags.hashtags;
83453           corePreferences("hashtags", null);
83454         }
83455       }
83456       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
83457         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
83458         tags.changesets_count = String(changesetsCount);
83459         if (changesetsCount <= 100) {
83460           var s2;
83461           s2 = corePreferences("walkthrough_completed");
83462           if (s2) {
83463             tags["ideditor:walkthrough_completed"] = s2;
83464           }
83465           s2 = corePreferences("walkthrough_progress");
83466           if (s2) {
83467             tags["ideditor:walkthrough_progress"] = s2;
83468           }
83469           s2 = corePreferences("walkthrough_started");
83470           if (s2) {
83471             tags["ideditor:walkthrough_started"] = s2;
83472           }
83473         }
83474       } else {
83475         delete tags.changesets_count;
83476       }
83477       if (!(0, import_fast_deep_equal11.default)(context.changeset.tags, tags)) {
83478         context.changeset = context.changeset.update({ tags });
83479       }
83480     }
83481     commit.reset = function() {
83482       context.changeset = null;
83483     };
83484     return utilRebind(commit, dispatch14, "on");
83485   }
83486   var import_fast_deep_equal11, readOnlyTags, hashtagRegex;
83487   var init_commit = __esm({
83488     "modules/ui/commit.js"() {
83489       "use strict";
83490       init_src4();
83491       init_src5();
83492       import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
83493       init_preferences();
83494       init_localizer();
83495       init_osm();
83496       init_icon();
83497       init_services();
83498       init_tooltip();
83499       init_changeset_editor();
83500       init_changes();
83501       init_commit_warnings();
83502       init_raw_tag_editor();
83503       init_util();
83504       init_detect();
83505       readOnlyTags = [
83506         /^changesets_count$/,
83507         /^created_by$/,
83508         /^ideditor:/,
83509         /^imagery_used$/,
83510         /^host$/,
83511         /^locale$/,
83512         /^warnings:/,
83513         /^resolved:/,
83514         /^closed:note$/,
83515         /^closed:keepright$/,
83516         /^closed:osmose:/
83517       ];
83518       hashtagRegex = /([##][^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
83519     }
83520   });
83521
83522   // modules/modes/save.js
83523   var save_exports2 = {};
83524   __export(save_exports2, {
83525     modeSave: () => modeSave
83526   });
83527   function modeSave(context) {
83528     var mode = { id: "save" };
83529     var keybinding = utilKeybinding("modeSave");
83530     var commit = uiCommit(context).on("cancel", cancel);
83531     var _conflictsUi;
83532     var _location;
83533     var _success;
83534     var uploader = context.uploader().on("saveStarted.modeSave", function() {
83535       keybindingOff();
83536     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
83537       cancel();
83538     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
83539     function cancel() {
83540       context.enter(modeBrowse(context));
83541     }
83542     function showProgress(num, total) {
83543       var modal = context.container().select(".loading-modal .modal-section");
83544       var progress = modal.selectAll(".progress").data([0]);
83545       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
83546     }
83547     function showConflicts(changeset, conflicts, origChanges) {
83548       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
83549       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
83550       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
83551         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83552         selection2.remove();
83553         keybindingOn();
83554         uploader.cancelConflictResolution();
83555       }).on("save", function() {
83556         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83557         selection2.remove();
83558         uploader.processResolvedConflicts(changeset);
83559       });
83560       selection2.call(_conflictsUi);
83561     }
83562     function showErrors(errors) {
83563       keybindingOn();
83564       var selection2 = uiConfirm(context.container());
83565       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
83566       addErrors(selection2, errors);
83567       selection2.okButton();
83568     }
83569     function addErrors(selection2, data) {
83570       var message = selection2.select(".modal-section.message-text");
83571       var items = message.selectAll(".error-container").data(data);
83572       var enter = items.enter().append("div").attr("class", "error-container");
83573       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
83574         return d2.msg || _t("save.unknown_error_details");
83575       }).on("click", function(d3_event) {
83576         d3_event.preventDefault();
83577         var error = select_default2(this);
83578         var detail = select_default2(this.nextElementSibling);
83579         var exp2 = error.classed("expanded");
83580         detail.style("display", exp2 ? "none" : "block");
83581         error.classed("expanded", !exp2);
83582       });
83583       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
83584       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
83585         return d2.details || [];
83586       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
83587         return d2;
83588       });
83589       items.exit().remove();
83590     }
83591     function showSuccess(changeset) {
83592       commit.reset();
83593       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
83594         context.ui().sidebar.hide();
83595       });
83596       context.enter(modeBrowse(context).sidebar(ui));
83597     }
83598     function keybindingOn() {
83599       select_default2(document).call(keybinding.on("\u238B", cancel, true));
83600     }
83601     function keybindingOff() {
83602       select_default2(document).call(keybinding.unbind);
83603     }
83604     function prepareForSuccess() {
83605       _success = uiSuccess(context);
83606       _location = null;
83607       if (!services.geocoder) return;
83608       services.geocoder.reverse(context.map().center(), function(err, result) {
83609         if (err || !result || !result.address) return;
83610         var addr = result.address;
83611         var place = addr && (addr.town || addr.city || addr.county) || "";
83612         var region = addr && (addr.state || addr.country) || "";
83613         var separator = place && region ? _t("success.thank_you_where.separator") : "";
83614         _location = _t(
83615           "success.thank_you_where.format",
83616           { place, separator, region }
83617         );
83618       });
83619     }
83620     mode.selectedIDs = function() {
83621       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
83622     };
83623     mode.enter = function() {
83624       context.ui().sidebar.expand();
83625       function done() {
83626         context.ui().sidebar.show(commit);
83627       }
83628       keybindingOn();
83629       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83630       var osm = context.connection();
83631       if (!osm) {
83632         cancel();
83633         return;
83634       }
83635       if (osm.authenticated()) {
83636         done();
83637       } else {
83638         osm.authenticate(function(err) {
83639           if (err) {
83640             cancel();
83641           } else {
83642             done();
83643           }
83644         });
83645       }
83646     };
83647     mode.exit = function() {
83648       keybindingOff();
83649       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
83650       context.ui().sidebar.hide();
83651     };
83652     return mode;
83653   }
83654   var init_save2 = __esm({
83655     "modules/modes/save.js"() {
83656       "use strict";
83657       init_src5();
83658       init_localizer();
83659       init_browse();
83660       init_services();
83661       init_conflicts();
83662       init_confirm();
83663       init_commit();
83664       init_success();
83665       init_util();
83666     }
83667   });
83668
83669   // modules/modes/index.js
83670   var modes_exports2 = {};
83671   __export(modes_exports2, {
83672     modeAddArea: () => modeAddArea,
83673     modeAddLine: () => modeAddLine,
83674     modeAddNote: () => modeAddNote,
83675     modeAddPoint: () => modeAddPoint,
83676     modeBrowse: () => modeBrowse,
83677     modeDragNode: () => modeDragNode,
83678     modeDragNote: () => modeDragNote,
83679     modeDrawArea: () => modeDrawArea,
83680     modeDrawLine: () => modeDrawLine,
83681     modeMove: () => modeMove,
83682     modeRotate: () => modeRotate,
83683     modeSave: () => modeSave,
83684     modeSelect: () => modeSelect,
83685     modeSelectData: () => modeSelectData,
83686     modeSelectError: () => modeSelectError,
83687     modeSelectNote: () => modeSelectNote
83688   });
83689   var init_modes2 = __esm({
83690     "modules/modes/index.js"() {
83691       "use strict";
83692       init_add_area();
83693       init_add_line();
83694       init_add_point();
83695       init_add_note();
83696       init_browse();
83697       init_drag_node();
83698       init_drag_note();
83699       init_draw_area();
83700       init_draw_line();
83701       init_move3();
83702       init_rotate2();
83703       init_save2();
83704       init_select5();
83705       init_select_data();
83706       init_select_error();
83707       init_select_note();
83708     }
83709   });
83710
83711   // modules/core/context.js
83712   var context_exports = {};
83713   __export(context_exports, {
83714     coreContext: () => coreContext
83715   });
83716   function coreContext() {
83717     const dispatch14 = dispatch_default("enter", "exit", "change");
83718     const context = {};
83719     let _deferred2 = /* @__PURE__ */ new Set();
83720     context.version = package_default.version;
83721     context.privacyVersion = "20201202";
83722     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
83723     context.changeset = null;
83724     let _defaultChangesetComment = context.initialHashParams.comment;
83725     let _defaultChangesetSource = context.initialHashParams.source;
83726     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
83727     context.defaultChangesetComment = function(val) {
83728       if (!arguments.length) return _defaultChangesetComment;
83729       _defaultChangesetComment = val;
83730       return context;
83731     };
83732     context.defaultChangesetSource = function(val) {
83733       if (!arguments.length) return _defaultChangesetSource;
83734       _defaultChangesetSource = val;
83735       return context;
83736     };
83737     context.defaultChangesetHashtags = function(val) {
83738       if (!arguments.length) return _defaultChangesetHashtags;
83739       _defaultChangesetHashtags = val;
83740       return context;
83741     };
83742     let _setsDocumentTitle = true;
83743     context.setsDocumentTitle = function(val) {
83744       if (!arguments.length) return _setsDocumentTitle;
83745       _setsDocumentTitle = val;
83746       return context;
83747     };
83748     let _documentTitleBase = document.title;
83749     context.documentTitleBase = function(val) {
83750       if (!arguments.length) return _documentTitleBase;
83751       _documentTitleBase = val;
83752       return context;
83753     };
83754     let _ui;
83755     context.ui = () => _ui;
83756     context.lastPointerType = () => _ui.lastPointerType();
83757     let _keybinding = utilKeybinding("context");
83758     context.keybinding = () => _keybinding;
83759     select_default2(document).call(_keybinding);
83760     let _connection = services.osm;
83761     let _history;
83762     let _validator;
83763     let _uploader;
83764     context.connection = () => _connection;
83765     context.history = () => _history;
83766     context.validator = () => _validator;
83767     context.uploader = () => _uploader;
83768     context.preauth = (options) => {
83769       if (_connection) {
83770         _connection.switch(options);
83771       }
83772       return context;
83773     };
83774     context.locale = function(locale3) {
83775       if (!arguments.length) return _mainLocalizer.localeCode();
83776       _mainLocalizer.preferredLocaleCodes(locale3);
83777       return context;
83778     };
83779     function afterLoad(cid, callback) {
83780       return (err, result) => {
83781         if (err) {
83782           if (typeof callback === "function") {
83783             callback(err);
83784           }
83785           return;
83786         } else if (_connection && _connection.getConnectionId() !== cid) {
83787           if (typeof callback === "function") {
83788             callback({ message: "Connection Switched", status: -1 });
83789           }
83790           return;
83791         } else {
83792           _history.merge(result.data, result.extent);
83793           if (typeof callback === "function") {
83794             callback(err, result);
83795           }
83796           return;
83797         }
83798       };
83799     }
83800     context.loadTiles = (projection2, callback) => {
83801       const handle = window.requestIdleCallback(() => {
83802         _deferred2.delete(handle);
83803         if (_connection && context.editableDataEnabled()) {
83804           const cid = _connection.getConnectionId();
83805           _connection.loadTiles(projection2, afterLoad(cid, callback));
83806         }
83807       });
83808       _deferred2.add(handle);
83809     };
83810     context.loadTileAtLoc = (loc, callback) => {
83811       const handle = window.requestIdleCallback(() => {
83812         _deferred2.delete(handle);
83813         if (_connection && context.editableDataEnabled()) {
83814           const cid = _connection.getConnectionId();
83815           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
83816         }
83817       });
83818       _deferred2.add(handle);
83819     };
83820     context.loadEntity = (entityID, callback) => {
83821       if (_connection) {
83822         const cid = _connection.getConnectionId();
83823         _connection.loadEntity(entityID, afterLoad(cid, callback));
83824         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
83825       }
83826     };
83827     context.loadNote = (entityID, callback) => {
83828       if (_connection) {
83829         const cid = _connection.getConnectionId();
83830         _connection.loadEntityNote(entityID, afterLoad(cid, callback));
83831       }
83832     };
83833     context.zoomToEntity = (entityID, zoomTo) => {
83834       context.zoomToEntities([entityID], zoomTo);
83835     };
83836     context.zoomToEntities = (entityIDs, zoomTo) => {
83837       let loadedEntities = [];
83838       const throttledZoomTo = throttle_default(() => _map.zoomTo(loadedEntities), 500);
83839       entityIDs.forEach((entityID) => context.loadEntity(entityID, (err, result) => {
83840         if (err) return;
83841         const entity = result.data.find((e3) => e3.id === entityID);
83842         if (!entity) return;
83843         loadedEntities.push(entity);
83844         if (zoomTo !== false) {
83845           throttledZoomTo();
83846         }
83847       }));
83848       _map.on("drawn.zoomToEntity", () => {
83849         if (!entityIDs.every((entityID) => context.hasEntity(entityID))) return;
83850         _map.on("drawn.zoomToEntity", null);
83851         context.on("enter.zoomToEntity", null);
83852         context.enter(modeSelect(context, entityIDs));
83853       });
83854       context.on("enter.zoomToEntity", () => {
83855         if (_mode.id !== "browse") {
83856           _map.on("drawn.zoomToEntity", null);
83857           context.on("enter.zoomToEntity", null);
83858         }
83859       });
83860     };
83861     context.moveToNote = (noteId, moveTo) => {
83862       context.loadNote(noteId, (err, result) => {
83863         if (err) return;
83864         const entity = result.data.find((e3) => e3.id === noteId);
83865         if (!entity) return;
83866         const note = services.osm.getNote(noteId);
83867         if (moveTo !== false) {
83868           context.map().center(note.loc);
83869         }
83870         const noteLayer = context.layers().layer("notes");
83871         noteLayer.enabled(true);
83872         context.enter(modeSelectNote(context, noteId));
83873       });
83874     };
83875     let _minEditableZoom = 16;
83876     context.minEditableZoom = function(val) {
83877       if (!arguments.length) return _minEditableZoom;
83878       _minEditableZoom = val;
83879       if (_connection) {
83880         _connection.tileZoom(val);
83881       }
83882       return context;
83883     };
83884     context.maxCharsForTagKey = () => 255;
83885     context.maxCharsForTagValue = () => 255;
83886     context.maxCharsForRelationRole = () => 255;
83887     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
83888     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
83889     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
83890     let _inIntro = false;
83891     context.inIntro = function(val) {
83892       if (!arguments.length) return _inIntro;
83893       _inIntro = val;
83894       return context;
83895     };
83896     context.save = () => {
83897       if (_inIntro || context.container().select(".modal").size()) return;
83898       let canSave;
83899       if (_mode && _mode.id === "save") {
83900         canSave = false;
83901         if (services.osm && services.osm.isChangesetInflight()) {
83902           _history.clearSaved();
83903           return;
83904         }
83905       } else {
83906         canSave = context.selectedIDs().every((id2) => {
83907           const entity = context.hasEntity(id2);
83908           return entity && !entity.isDegenerate();
83909         });
83910       }
83911       if (canSave) {
83912         _history.save();
83913       }
83914       if (_history.hasChanges()) {
83915         return _t("save.unsaved_changes");
83916       }
83917     };
83918     context.debouncedSave = debounce_default(context.save, 350);
83919     function withDebouncedSave(fn) {
83920       return function() {
83921         const result = fn.apply(_history, arguments);
83922         context.debouncedSave();
83923         return result;
83924       };
83925     }
83926     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
83927     context.entity = (id2) => _history.graph().entity(id2);
83928     let _mode;
83929     context.mode = () => _mode;
83930     context.enter = (newMode) => {
83931       if (_mode) {
83932         _mode.exit();
83933         dispatch14.call("exit", this, _mode);
83934       }
83935       _mode = newMode;
83936       _mode.enter();
83937       dispatch14.call("enter", this, _mode);
83938     };
83939     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
83940     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
83941     let _selectedNoteID;
83942     context.selectedNoteID = function(noteID) {
83943       if (!arguments.length) return _selectedNoteID;
83944       _selectedNoteID = noteID;
83945       return context;
83946     };
83947     let _selectedErrorID;
83948     context.selectedErrorID = function(errorID) {
83949       if (!arguments.length) return _selectedErrorID;
83950       _selectedErrorID = errorID;
83951       return context;
83952     };
83953     context.install = (behavior) => context.surface().call(behavior);
83954     context.uninstall = (behavior) => context.surface().call(behavior.off);
83955     let _copyGraph;
83956     context.copyGraph = () => _copyGraph;
83957     let _copyIDs = [];
83958     context.copyIDs = function(val) {
83959       if (!arguments.length) return _copyIDs;
83960       _copyIDs = val;
83961       _copyGraph = _history.graph();
83962       return context;
83963     };
83964     let _copyLonLat;
83965     context.copyLonLat = function(val) {
83966       if (!arguments.length) return _copyLonLat;
83967       _copyLonLat = val;
83968       return context;
83969     };
83970     let _background;
83971     context.background = () => _background;
83972     let _features;
83973     context.features = () => _features;
83974     context.hasHiddenConnections = (id2) => {
83975       const graph = _history.graph();
83976       const entity = graph.entity(id2);
83977       return _features.hasHiddenConnections(entity, graph);
83978     };
83979     let _photos;
83980     context.photos = () => _photos;
83981     let _map;
83982     context.map = () => _map;
83983     context.layers = () => _map.layers();
83984     context.surface = () => _map.surface;
83985     context.editableDataEnabled = () => _map.editableDataEnabled();
83986     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
83987     context.editable = () => {
83988       const mode = context.mode();
83989       if (!mode || mode.id === "save") return false;
83990       return _map.editableDataEnabled();
83991     };
83992     let _debugFlags = {
83993       tile: false,
83994       // tile boundaries
83995       collision: false,
83996       // label collision bounding boxes
83997       imagery: false,
83998       // imagery bounding polygons
83999       target: false,
84000       // touch targets
84001       downloaded: false
84002       // downloaded data from osm
84003     };
84004     context.debugFlags = () => _debugFlags;
84005     context.getDebug = (flag) => flag && _debugFlags[flag];
84006     context.setDebug = function(flag, val) {
84007       if (arguments.length === 1) val = true;
84008       _debugFlags[flag] = val;
84009       dispatch14.call("change");
84010       return context;
84011     };
84012     let _container = select_default2(null);
84013     context.container = function(val) {
84014       if (!arguments.length) return _container;
84015       _container = val;
84016       _container.classed("ideditor", true);
84017       return context;
84018     };
84019     context.containerNode = function(val) {
84020       if (!arguments.length) return context.container().node();
84021       context.container(select_default2(val));
84022       return context;
84023     };
84024     let _embed;
84025     context.embed = function(val) {
84026       if (!arguments.length) return _embed;
84027       _embed = val;
84028       return context;
84029     };
84030     let _assetPath = "";
84031     context.assetPath = function(val) {
84032       if (!arguments.length) return _assetPath;
84033       _assetPath = val;
84034       _mainFileFetcher.assetPath(val);
84035       return context;
84036     };
84037     let _assetMap = {};
84038     context.assetMap = function(val) {
84039       if (!arguments.length) return _assetMap;
84040       _assetMap = val;
84041       _mainFileFetcher.assetMap(val);
84042       return context;
84043     };
84044     context.asset = (val) => {
84045       if (/^http(s)?:\/\//i.test(val)) return val;
84046       const filename = _assetPath + val;
84047       return _assetMap[filename] || filename;
84048     };
84049     context.imagePath = (val) => context.asset(`img/${val}`);
84050     context.reset = context.flush = () => {
84051       context.debouncedSave.cancel();
84052       Array.from(_deferred2).forEach((handle) => {
84053         window.cancelIdleCallback(handle);
84054         _deferred2.delete(handle);
84055       });
84056       Object.values(services).forEach((service) => {
84057         if (service && typeof service.reset === "function") {
84058           service.reset(context);
84059         }
84060       });
84061       context.changeset = null;
84062       _validator.reset();
84063       _features.reset();
84064       _history.reset();
84065       _uploader.reset();
84066       context.container().select(".inspector-wrap *").remove();
84067       return context;
84068     };
84069     context.projection = geoRawMercator();
84070     context.curtainProjection = geoRawMercator();
84071     context.init = () => {
84072       instantiateInternal();
84073       initializeDependents();
84074       return context;
84075       function instantiateInternal() {
84076         _history = coreHistory(context);
84077         context.graph = _history.graph;
84078         context.pauseChangeDispatch = _history.pauseChangeDispatch;
84079         context.resumeChangeDispatch = _history.resumeChangeDispatch;
84080         context.perform = withDebouncedSave(_history.perform);
84081         context.replace = withDebouncedSave(_history.replace);
84082         context.pop = withDebouncedSave(_history.pop);
84083         context.overwrite = withDebouncedSave(_history.overwrite);
84084         context.undo = withDebouncedSave(_history.undo);
84085         context.redo = withDebouncedSave(_history.redo);
84086         _validator = coreValidator(context);
84087         _uploader = coreUploader(context);
84088         _background = rendererBackground(context);
84089         _features = rendererFeatures(context);
84090         _map = rendererMap(context);
84091         _photos = rendererPhotos(context);
84092         _ui = uiInit(context);
84093       }
84094       function initializeDependents() {
84095         if (context.initialHashParams.presets) {
84096           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
84097         }
84098         if (context.initialHashParams.locale) {
84099           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
84100         }
84101         _mainLocalizer.ensureLoaded();
84102         _mainPresetIndex.ensureLoaded();
84103         _background.ensureLoaded();
84104         Object.values(services).forEach((service) => {
84105           if (service && typeof service.init === "function") {
84106             service.init();
84107           }
84108         });
84109         _map.init();
84110         _validator.init();
84111         _features.init();
84112         if (services.maprules && context.initialHashParams.maprules) {
84113           json_default(context.initialHashParams.maprules).then((mapcss) => {
84114             services.maprules.init();
84115             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
84116           }).catch(() => {
84117           });
84118         }
84119         if (!context.container().empty()) {
84120           _ui.ensureLoaded().then(() => {
84121             _background.init();
84122             _photos.init();
84123           });
84124         }
84125       }
84126     };
84127     return utilRebind(context, dispatch14, "on");
84128   }
84129   var init_context2 = __esm({
84130     "modules/core/context.js"() {
84131       "use strict";
84132       init_debounce();
84133       init_throttle();
84134       init_src4();
84135       init_src18();
84136       init_src5();
84137       init_package();
84138       init_localizer();
84139       init_file_fetcher();
84140       init_localizer();
84141       init_history();
84142       init_validator();
84143       init_uploader();
84144       init_raw_mercator();
84145       init_modes2();
84146       init_presets();
84147       init_renderer();
84148       init_services();
84149       init_init2();
84150       init_util();
84151     }
84152   });
84153
84154   // modules/core/index.js
84155   var core_exports = {};
84156   __export(core_exports, {
84157     LocationManager: () => LocationManager,
84158     coreContext: () => coreContext,
84159     coreDifference: () => coreDifference,
84160     coreFileFetcher: () => coreFileFetcher,
84161     coreGraph: () => coreGraph,
84162     coreHistory: () => coreHistory,
84163     coreLocalizer: () => coreLocalizer,
84164     coreTree: () => coreTree,
84165     coreUploader: () => coreUploader,
84166     coreValidator: () => coreValidator,
84167     fileFetcher: () => _mainFileFetcher,
84168     localizer: () => _mainLocalizer,
84169     locationManager: () => _sharedLocationManager,
84170     prefs: () => corePreferences,
84171     t: () => _t
84172   });
84173   var init_core = __esm({
84174     "modules/core/index.js"() {
84175       "use strict";
84176       init_context2();
84177       init_file_fetcher();
84178       init_difference();
84179       init_graph();
84180       init_history();
84181       init_localizer();
84182       init_LocationManager();
84183       init_preferences();
84184       init_tree();
84185       init_uploader();
84186       init_validator();
84187     }
84188   });
84189
84190   // modules/behavior/operation.js
84191   var operation_exports = {};
84192   __export(operation_exports, {
84193     behaviorOperation: () => behaviorOperation
84194   });
84195   function behaviorOperation(context) {
84196     var _operation;
84197     function keypress(d3_event) {
84198       var _a4;
84199       if (!context.map().withinEditableZoom()) return;
84200       if (((_a4 = _operation.availableForKeypress) == null ? void 0 : _a4.call(_operation)) === false) return;
84201       d3_event.preventDefault();
84202       if (!_operation.available()) {
84203         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_t.append("operations._unavailable", {
84204           operation: _t(`operations.${_operation.id}.title`) || _operation.id
84205         }))();
84206       } else if (_operation.disabled()) {
84207         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
84208       } else {
84209         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
84210         if (_operation.point) _operation.point(null);
84211         _operation(d3_event);
84212       }
84213     }
84214     function behavior() {
84215       if (_operation && _operation.available()) {
84216         behavior.on();
84217       }
84218       return behavior;
84219     }
84220     behavior.on = function() {
84221       context.keybinding().on(_operation.keys, keypress);
84222     };
84223     behavior.off = function() {
84224       context.keybinding().off(_operation.keys);
84225     };
84226     behavior.which = function(_3) {
84227       if (!arguments.length) return _operation;
84228       _operation = _3;
84229       return behavior;
84230     };
84231     return behavior;
84232   }
84233   var init_operation = __esm({
84234     "modules/behavior/operation.js"() {
84235       "use strict";
84236       init_core();
84237     }
84238   });
84239
84240   // modules/operations/circularize.js
84241   var circularize_exports2 = {};
84242   __export(circularize_exports2, {
84243     operationCircularize: () => operationCircularize
84244   });
84245   function operationCircularize(context, selectedIDs) {
84246     var _extent;
84247     var _actions = selectedIDs.map(getAction).filter(Boolean);
84248     var _amount = _actions.length === 1 ? "single" : "multiple";
84249     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
84250       return n3.loc;
84251     });
84252     function getAction(entityID) {
84253       var entity = context.entity(entityID);
84254       if (entity.type !== "way" || new Set(entity.nodes).size <= 1) return null;
84255       if (!_extent) {
84256         _extent = entity.extent(context.graph());
84257       } else {
84258         _extent = _extent.extend(entity.extent(context.graph()));
84259       }
84260       return actionCircularize(entityID, context.projection);
84261     }
84262     var operation2 = function() {
84263       if (!_actions.length) return;
84264       var combinedAction = function(graph, t2) {
84265         _actions.forEach(function(action) {
84266           if (!action.disabled(graph)) {
84267             graph = action(graph, t2);
84268           }
84269         });
84270         return graph;
84271       };
84272       combinedAction.transitionable = true;
84273       context.perform(combinedAction, operation2.annotation());
84274       window.setTimeout(function() {
84275         context.validator().validate();
84276       }, 300);
84277     };
84278     operation2.available = function() {
84279       return _actions.length && selectedIDs.length === _actions.length;
84280     };
84281     operation2.disabled = function() {
84282       if (!_actions.length) return "";
84283       var actionDisableds = _actions.map(function(action) {
84284         return action.disabled(context.graph());
84285       }).filter(Boolean);
84286       if (actionDisableds.length === _actions.length) {
84287         if (new Set(actionDisableds).size > 1) {
84288           return "multiple_blockers";
84289         }
84290         return actionDisableds[0];
84291       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
84292         return "too_large";
84293       } else if (someMissing()) {
84294         return "not_downloaded";
84295       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84296         return "connected_to_hidden";
84297       }
84298       return false;
84299       function someMissing() {
84300         if (context.inIntro()) return false;
84301         var osm = context.connection();
84302         if (osm) {
84303           var missing = _coords.filter(function(loc) {
84304             return !osm.isDataLoaded(loc);
84305           });
84306           if (missing.length) {
84307             missing.forEach(function(loc) {
84308               context.loadTileAtLoc(loc);
84309             });
84310             return true;
84311           }
84312         }
84313         return false;
84314       }
84315     };
84316     operation2.tooltip = function() {
84317       var disable = operation2.disabled();
84318       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
84319     };
84320     operation2.annotation = function() {
84321       return _t("operations.circularize.annotation.feature", { n: _actions.length });
84322     };
84323     operation2.id = "circularize";
84324     operation2.keys = [_t("operations.circularize.key")];
84325     operation2.title = _t.append("operations.circularize.title");
84326     operation2.behavior = behaviorOperation(context).which(operation2);
84327     return operation2;
84328   }
84329   var init_circularize2 = __esm({
84330     "modules/operations/circularize.js"() {
84331       "use strict";
84332       init_localizer();
84333       init_circularize();
84334       init_operation();
84335       init_util();
84336     }
84337   });
84338
84339   // modules/operations/rotate.js
84340   var rotate_exports3 = {};
84341   __export(rotate_exports3, {
84342     operationRotate: () => operationRotate
84343   });
84344   function operationRotate(context, selectedIDs) {
84345     var multi = selectedIDs.length === 1 ? "single" : "multiple";
84346     var nodes = utilGetAllNodes(selectedIDs, context.graph());
84347     var coords = nodes.map(function(n3) {
84348       return n3.loc;
84349     });
84350     var extent = utilTotalExtent(selectedIDs, context.graph());
84351     var operation2 = function() {
84352       context.enter(modeRotate(context, selectedIDs));
84353     };
84354     operation2.available = function() {
84355       return nodes.length >= 2;
84356     };
84357     operation2.disabled = function() {
84358       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
84359         return "too_large";
84360       } else if (someMissing()) {
84361         return "not_downloaded";
84362       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84363         return "connected_to_hidden";
84364       } else if (selectedIDs.some(incompleteRelation)) {
84365         return "incomplete_relation";
84366       }
84367       return false;
84368       function someMissing() {
84369         if (context.inIntro()) return false;
84370         var osm = context.connection();
84371         if (osm) {
84372           var missing = coords.filter(function(loc) {
84373             return !osm.isDataLoaded(loc);
84374           });
84375           if (missing.length) {
84376             missing.forEach(function(loc) {
84377               context.loadTileAtLoc(loc);
84378             });
84379             return true;
84380           }
84381         }
84382         return false;
84383       }
84384       function incompleteRelation(id2) {
84385         var entity = context.entity(id2);
84386         return entity.type === "relation" && !entity.isComplete(context.graph());
84387       }
84388     };
84389     operation2.tooltip = function() {
84390       var disable = operation2.disabled();
84391       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
84392     };
84393     operation2.annotation = function() {
84394       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
84395     };
84396     operation2.id = "rotate";
84397     operation2.keys = [_t("operations.rotate.key")];
84398     operation2.title = _t.append("operations.rotate.title");
84399     operation2.behavior = behaviorOperation(context).which(operation2);
84400     operation2.mouseOnly = true;
84401     return operation2;
84402   }
84403   var init_rotate3 = __esm({
84404     "modules/operations/rotate.js"() {
84405       "use strict";
84406       init_localizer();
84407       init_operation();
84408       init_rotate2();
84409       init_util2();
84410     }
84411   });
84412
84413   // modules/modes/move.js
84414   var move_exports3 = {};
84415   __export(move_exports3, {
84416     modeMove: () => modeMove
84417   });
84418   function modeMove(context, entityIDs, baseGraph) {
84419     var _tolerancePx = 4;
84420     var mode = {
84421       id: "move",
84422       button: "browse"
84423     };
84424     var keybinding = utilKeybinding("move");
84425     var behaviors = [
84426       behaviorEdit(context),
84427       operationCircularize(context, entityIDs).behavior,
84428       operationDelete(context, entityIDs).behavior,
84429       operationOrthogonalize(context, entityIDs).behavior,
84430       operationReflectLong(context, entityIDs).behavior,
84431       operationReflectShort(context, entityIDs).behavior,
84432       operationRotate(context, entityIDs).behavior
84433     ];
84434     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
84435     var _prevGraph;
84436     var _cache5;
84437     var _prevMouseCoords;
84438     var _nudgeInterval;
84439     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
84440     function doMove(nudge) {
84441       nudge = nudge || [0, 0];
84442       let fn;
84443       if (_prevGraph !== context.graph()) {
84444         _cache5 = {};
84445         _prevMouseCoords = context.map().mouseCoordinates();
84446         fn = context.perform;
84447       } else {
84448         fn = context.replace;
84449       }
84450       const currMouseCoords = context.map().mouseCoordinates();
84451       const currMouse = context.projection(currMouseCoords);
84452       const prevMouse = context.projection(_prevMouseCoords);
84453       const delta = geoVecSubtract(geoVecSubtract(currMouse, prevMouse), nudge);
84454       _prevMouseCoords = currMouseCoords;
84455       fn(actionMove(entityIDs, delta, context.projection, _cache5));
84456       _prevGraph = context.graph();
84457     }
84458     function startNudge(nudge) {
84459       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
84460       _nudgeInterval = window.setInterval(function() {
84461         context.map().pan(nudge);
84462         doMove(nudge);
84463       }, 50);
84464     }
84465     function stopNudge() {
84466       if (_nudgeInterval) {
84467         window.clearInterval(_nudgeInterval);
84468         _nudgeInterval = null;
84469       }
84470     }
84471     function move() {
84472       doMove();
84473       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
84474       if (nudge) {
84475         startNudge(nudge);
84476       } else {
84477         stopNudge();
84478       }
84479     }
84480     function finish(d3_event) {
84481       d3_event.stopPropagation();
84482       context.replace(actionNoop(), annotation);
84483       context.enter(modeSelect(context, entityIDs));
84484       stopNudge();
84485     }
84486     function cancel() {
84487       if (baseGraph) {
84488         while (context.graph() !== baseGraph) context.pop();
84489         context.enter(modeBrowse(context));
84490       } else {
84491         if (_prevGraph) context.pop();
84492         context.enter(modeSelect(context, entityIDs));
84493       }
84494       stopNudge();
84495     }
84496     function undone() {
84497       context.enter(modeBrowse(context));
84498     }
84499     mode.enter = function() {
84500       _prevMouseCoords = context.map().mouseCoordinates();
84501       _prevGraph = null;
84502       _cache5 = {};
84503       context.features().forceVisible(entityIDs);
84504       behaviors.forEach(context.install);
84505       var downEvent;
84506       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
84507         downEvent = d3_event;
84508       });
84509       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
84510         if (!downEvent) return;
84511         var mapNode = context.container().select(".main-map").node();
84512         var pointGetter = utilFastMouse(mapNode);
84513         var p1 = pointGetter(downEvent);
84514         var p2 = pointGetter(d3_event);
84515         var dist = geoVecLength(p1, p2);
84516         if (dist <= _tolerancePx) finish(d3_event);
84517         downEvent = null;
84518       }, true);
84519       context.history().on("undone.modeMove", undone);
84520       keybinding.on("\u238B", cancel).on("\u21A9", finish);
84521       select_default2(document).call(keybinding);
84522     };
84523     mode.exit = function() {
84524       stopNudge();
84525       behaviors.forEach(function(behavior) {
84526         context.uninstall(behavior);
84527       });
84528       context.surface().on(_pointerPrefix + "down.modeMove", null);
84529       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
84530       context.history().on("undone.modeMove", null);
84531       select_default2(document).call(keybinding.unbind);
84532       context.features().forceVisible([]);
84533     };
84534     mode.selectedIDs = function() {
84535       if (!arguments.length) return entityIDs;
84536       return mode;
84537     };
84538     return mode;
84539   }
84540   var init_move3 = __esm({
84541     "modules/modes/move.js"() {
84542       "use strict";
84543       init_src5();
84544       init_localizer();
84545       init_move();
84546       init_noop2();
84547       init_edit();
84548       init_vector();
84549       init_geom();
84550       init_browse();
84551       init_select5();
84552       init_util();
84553       init_util2();
84554       init_circularize2();
84555       init_delete();
84556       init_orthogonalize2();
84557       init_reflect2();
84558       init_rotate3();
84559     }
84560   });
84561
84562   // modules/behavior/paste.js
84563   var paste_exports = {};
84564   __export(paste_exports, {
84565     behaviorPaste: () => behaviorPaste
84566   });
84567   function behaviorPaste(context) {
84568     function doPaste(d3_event) {
84569       if (!context.map().withinEditableZoom()) return;
84570       const isOsmLayerEnabled = context.layers().layer("osm").enabled();
84571       if (!isOsmLayerEnabled) return;
84572       d3_event.preventDefault();
84573       var baseGraph = context.graph();
84574       var mouse = context.map().mouse();
84575       var projection2 = context.projection;
84576       var viewport = geoExtent(projection2.clipExtent()).polygon();
84577       if (!geoPointInPolygon(mouse, viewport)) return;
84578       var oldIDs = context.copyIDs();
84579       if (!oldIDs.length) return;
84580       var extent = geoExtent();
84581       var oldGraph = context.copyGraph();
84582       var newIDs = [];
84583       var action = actionCopyEntities(oldIDs, oldGraph);
84584       context.perform(action);
84585       var copies = action.copies();
84586       var originals = /* @__PURE__ */ new Set();
84587       Object.values(copies).forEach(function(entity) {
84588         originals.add(entity.id);
84589       });
84590       for (var id2 in copies) {
84591         var oldEntity = oldGraph.entity(id2);
84592         var newEntity = copies[id2];
84593         extent._extend(oldEntity.extent(oldGraph));
84594         var parents = context.graph().parentWays(newEntity);
84595         var parentCopied = parents.some(function(parent2) {
84596           return originals.has(parent2.id);
84597         });
84598         if (!parentCopied) {
84599           newIDs.push(newEntity.id);
84600         }
84601       }
84602       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
84603       var delta = geoVecSubtract(mouse, copyPoint);
84604       context.perform(actionMove(newIDs, delta, projection2));
84605       context.enter(modeMove(context, newIDs, baseGraph));
84606     }
84607     function behavior() {
84608       context.keybinding().on(uiCmd("\u2318V"), doPaste);
84609       return behavior;
84610     }
84611     behavior.off = function() {
84612       context.keybinding().off(uiCmd("\u2318V"));
84613     };
84614     return behavior;
84615   }
84616   var init_paste = __esm({
84617     "modules/behavior/paste.js"() {
84618       "use strict";
84619       init_copy_entities();
84620       init_move();
84621       init_geo2();
84622       init_move3();
84623       init_cmd();
84624     }
84625   });
84626
84627   // modules/operations/continue.js
84628   var continue_exports = {};
84629   __export(continue_exports, {
84630     operationContinue: () => operationContinue
84631   });
84632   function operationContinue(context, selectedIDs) {
84633     var _entities = selectedIDs.map(function(id2) {
84634       return context.graph().entity(id2);
84635     });
84636     var _geometries = Object.assign(
84637       { line: [], vertex: [] },
84638       utilArrayGroupBy(_entities, function(entity) {
84639         return entity.geometry(context.graph());
84640       })
84641     );
84642     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
84643     function candidateWays() {
84644       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent2) {
84645         const geom = parent2.geometry(context.graph());
84646         return (geom === "line" || geom === "area") && !parent2.isClosed() && parent2.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent2);
84647       }) : [];
84648     }
84649     var _candidates = candidateWays();
84650     var operation2 = function() {
84651       var candidate = _candidates[0];
84652       const tagsToRemove = /* @__PURE__ */ new Set();
84653       if (_vertex.tags.fixme === "continue") tagsToRemove.add("fixme");
84654       if (_vertex.tags.noexit === "yes") tagsToRemove.add("noexit");
84655       if (tagsToRemove.size) {
84656         context.perform((graph) => {
84657           const newTags = { ..._vertex.tags };
84658           for (const key of tagsToRemove) {
84659             delete newTags[key];
84660           }
84661           return actionChangeTags(_vertex.id, newTags)(graph);
84662         }, operation2.annotation());
84663       }
84664       context.enter(
84665         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
84666       );
84667     };
84668     operation2.relatedEntityIds = function() {
84669       return _candidates.length ? [_candidates[0].id] : [];
84670     };
84671     operation2.available = function() {
84672       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
84673     };
84674     operation2.disabled = function() {
84675       if (_candidates.length === 0) {
84676         return "not_eligible";
84677       } else if (_candidates.length > 1) {
84678         return "multiple";
84679       }
84680       return false;
84681     };
84682     operation2.tooltip = function() {
84683       var disable = operation2.disabled();
84684       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
84685     };
84686     operation2.annotation = function() {
84687       return _t("operations.continue.annotation.line");
84688     };
84689     operation2.id = "continue";
84690     operation2.keys = [_t("operations.continue.key")];
84691     operation2.title = _t.append("operations.continue.title");
84692     operation2.behavior = behaviorOperation(context).which(operation2);
84693     return operation2;
84694   }
84695   var init_continue = __esm({
84696     "modules/operations/continue.js"() {
84697       "use strict";
84698       init_localizer();
84699       init_draw_line();
84700       init_operation();
84701       init_util();
84702       init_actions();
84703     }
84704   });
84705
84706   // modules/operations/copy.js
84707   var copy_exports = {};
84708   __export(copy_exports, {
84709     operationCopy: () => operationCopy
84710   });
84711   function operationCopy(context, selectedIDs) {
84712     function getFilteredIdsToCopy() {
84713       return selectedIDs.filter(function(selectedID) {
84714         var entity = context.graph().hasEntity(selectedID);
84715         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
84716       });
84717     }
84718     var operation2 = function() {
84719       var graph = context.graph();
84720       var selected = groupEntities(getFilteredIdsToCopy(), graph);
84721       var canCopy = [];
84722       var skip = {};
84723       var entity;
84724       var i3;
84725       for (i3 = 0; i3 < selected.relation.length; i3++) {
84726         entity = selected.relation[i3];
84727         if (!skip[entity.id] && entity.isComplete(graph)) {
84728           canCopy.push(entity.id);
84729           skip = getDescendants(entity.id, graph, skip);
84730         }
84731       }
84732       for (i3 = 0; i3 < selected.way.length; i3++) {
84733         entity = selected.way[i3];
84734         if (!skip[entity.id]) {
84735           canCopy.push(entity.id);
84736           skip = getDescendants(entity.id, graph, skip);
84737         }
84738       }
84739       for (i3 = 0; i3 < selected.node.length; i3++) {
84740         entity = selected.node[i3];
84741         if (!skip[entity.id]) {
84742           canCopy.push(entity.id);
84743         }
84744       }
84745       context.copyIDs(canCopy);
84746       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
84747         context.copyLonLat(context.projection.invert(_point));
84748       } else {
84749         context.copyLonLat(null);
84750       }
84751     };
84752     function groupEntities(ids, graph) {
84753       var entities = ids.map(function(id2) {
84754         return graph.entity(id2);
84755       });
84756       return Object.assign(
84757         { relation: [], way: [], node: [] },
84758         utilArrayGroupBy(entities, "type")
84759       );
84760     }
84761     function getDescendants(id2, graph, descendants) {
84762       var entity = graph.entity(id2);
84763       var children2;
84764       descendants = descendants || {};
84765       if (entity.type === "relation") {
84766         children2 = entity.members.map(function(m3) {
84767           return m3.id;
84768         });
84769       } else if (entity.type === "way") {
84770         children2 = entity.nodes;
84771       } else {
84772         children2 = [];
84773       }
84774       for (var i3 = 0; i3 < children2.length; i3++) {
84775         if (!descendants[children2[i3]]) {
84776           descendants[children2[i3]] = true;
84777           descendants = getDescendants(children2[i3], graph, descendants);
84778         }
84779       }
84780       return descendants;
84781     }
84782     operation2.available = function() {
84783       return getFilteredIdsToCopy().length > 0;
84784     };
84785     operation2.disabled = function() {
84786       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
84787       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
84788         return "too_large";
84789       }
84790       return false;
84791     };
84792     operation2.availableForKeypress = function() {
84793       var _a4;
84794       const selection2 = (_a4 = window.getSelection) == null ? void 0 : _a4.call(window);
84795       return !(selection2 == null ? void 0 : selection2.toString());
84796     };
84797     operation2.tooltip = function() {
84798       var disable = operation2.disabled();
84799       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
84800     };
84801     operation2.annotation = function() {
84802       return _t("operations.copy.annotation", { n: selectedIDs.length });
84803     };
84804     var _point;
84805     operation2.point = function(val) {
84806       _point = val;
84807       return operation2;
84808     };
84809     operation2.id = "copy";
84810     operation2.keys = [uiCmd("\u2318C")];
84811     operation2.title = _t.append("operations.copy.title");
84812     operation2.behavior = behaviorOperation(context).which(operation2);
84813     return operation2;
84814   }
84815   var init_copy = __esm({
84816     "modules/operations/copy.js"() {
84817       "use strict";
84818       init_localizer();
84819       init_operation();
84820       init_cmd();
84821       init_util();
84822     }
84823   });
84824
84825   // modules/operations/disconnect.js
84826   var disconnect_exports2 = {};
84827   __export(disconnect_exports2, {
84828     operationDisconnect: () => operationDisconnect
84829   });
84830   function operationDisconnect(context, selectedIDs) {
84831     var _vertexIDs = [];
84832     var _wayIDs = [];
84833     var _otherIDs = [];
84834     var _actions = [];
84835     selectedIDs.forEach(function(id2) {
84836       var entity = context.entity(id2);
84837       if (entity.type === "way") {
84838         _wayIDs.push(id2);
84839       } else if (entity.geometry(context.graph()) === "vertex") {
84840         _vertexIDs.push(id2);
84841       } else {
84842         _otherIDs.push(id2);
84843       }
84844     });
84845     var _coords, _descriptionID = "", _annotationID = "features";
84846     var _disconnectingVertexIds = [];
84847     var _disconnectingWayIds = [];
84848     if (_vertexIDs.length > 0) {
84849       _disconnectingVertexIds = _vertexIDs;
84850       _vertexIDs.forEach(function(vertexID) {
84851         var action = actionDisconnect(vertexID);
84852         if (_wayIDs.length > 0) {
84853           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
84854             var way = context.entity(wayID);
84855             return way.nodes.indexOf(vertexID) !== -1;
84856           });
84857           action.limitWays(waysIDsForVertex);
84858         }
84859         _actions.push(action);
84860         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
84861       });
84862       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
84863         return _wayIDs.indexOf(id2) === -1;
84864       });
84865       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
84866       if (_wayIDs.length === 1) {
84867         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
84868       } else {
84869         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
84870       }
84871     } else if (_wayIDs.length > 0) {
84872       var ways = _wayIDs.map(function(id2) {
84873         return context.entity(id2);
84874       });
84875       var nodes = utilGetAllNodes(_wayIDs, context.graph());
84876       _coords = nodes.map(function(n3) {
84877         return n3.loc;
84878       });
84879       var sharedActions = [];
84880       var sharedNodes = [];
84881       var unsharedActions = [];
84882       var unsharedNodes = [];
84883       nodes.forEach(function(node) {
84884         var action = actionDisconnect(node.id).limitWays(_wayIDs);
84885         if (action.disabled(context.graph()) !== "not_connected") {
84886           var count = 0;
84887           for (var i3 in ways) {
84888             var way = ways[i3];
84889             if (way.nodes.indexOf(node.id) !== -1) {
84890               count += 1;
84891             }
84892             if (count > 1) break;
84893           }
84894           if (count > 1) {
84895             sharedActions.push(action);
84896             sharedNodes.push(node);
84897           } else {
84898             unsharedActions.push(action);
84899             unsharedNodes.push(node);
84900           }
84901         }
84902       });
84903       _descriptionID += "no_points.";
84904       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
84905       if (sharedActions.length) {
84906         _actions = sharedActions;
84907         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
84908         _descriptionID += "conjoined";
84909         _annotationID = "from_each_other";
84910       } else {
84911         _actions = unsharedActions;
84912         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
84913         if (_wayIDs.length === 1) {
84914           _descriptionID += context.graph().geometry(_wayIDs[0]);
84915         } else {
84916           _descriptionID += "separate";
84917         }
84918       }
84919     }
84920     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
84921     var operation2 = function() {
84922       context.perform(function(graph) {
84923         return _actions.reduce(function(graph2, action) {
84924           return action(graph2);
84925         }, graph);
84926       }, operation2.annotation());
84927       context.validator().validate();
84928     };
84929     operation2.relatedEntityIds = function() {
84930       if (_vertexIDs.length) {
84931         return _disconnectingWayIds;
84932       }
84933       return _disconnectingVertexIds;
84934     };
84935     operation2.available = function() {
84936       if (_actions.length === 0) return false;
84937       if (_otherIDs.length !== 0) return false;
84938       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
84939         return _vertexIDs.some(function(vertexID) {
84940           var way = context.entity(wayID);
84941           return way.nodes.indexOf(vertexID) !== -1;
84942         });
84943       })) return false;
84944       return true;
84945     };
84946     operation2.disabled = function() {
84947       var reason;
84948       for (var actionIndex in _actions) {
84949         reason = _actions[actionIndex].disabled(context.graph());
84950         if (reason) return reason;
84951       }
84952       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
84953         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
84954       } else if (_coords && someMissing()) {
84955         return "not_downloaded";
84956       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84957         return "connected_to_hidden";
84958       }
84959       return false;
84960       function someMissing() {
84961         if (context.inIntro()) return false;
84962         var osm = context.connection();
84963         if (osm) {
84964           var missing = _coords.filter(function(loc) {
84965             return !osm.isDataLoaded(loc);
84966           });
84967           if (missing.length) {
84968             missing.forEach(function(loc) {
84969               context.loadTileAtLoc(loc);
84970             });
84971             return true;
84972           }
84973         }
84974         return false;
84975       }
84976     };
84977     operation2.tooltip = function() {
84978       var disable = operation2.disabled();
84979       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
84980     };
84981     operation2.annotation = function() {
84982       return _t("operations.disconnect.annotation." + _annotationID);
84983     };
84984     operation2.id = "disconnect";
84985     operation2.keys = [_t("operations.disconnect.key")];
84986     operation2.title = _t.append("operations.disconnect.title");
84987     operation2.behavior = behaviorOperation(context).which(operation2);
84988     return operation2;
84989   }
84990   var init_disconnect2 = __esm({
84991     "modules/operations/disconnect.js"() {
84992       "use strict";
84993       init_localizer();
84994       init_disconnect();
84995       init_operation();
84996       init_array3();
84997       init_util2();
84998     }
84999   });
85000
85001   // modules/operations/downgrade.js
85002   var downgrade_exports = {};
85003   __export(downgrade_exports, {
85004     operationDowngrade: () => operationDowngrade
85005   });
85006   function operationDowngrade(context, selectedIDs) {
85007     var _affectedFeatureCount = 0;
85008     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
85009     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
85010     function downgradeTypeForEntityIDs(entityIds) {
85011       var downgradeType;
85012       _affectedFeatureCount = 0;
85013       for (var i3 in entityIds) {
85014         var entityID = entityIds[i3];
85015         var type2 = downgradeTypeForEntityID(entityID);
85016         if (type2) {
85017           _affectedFeatureCount += 1;
85018           if (downgradeType && type2 !== downgradeType) {
85019             if (downgradeType !== "generic" && type2 !== "generic") {
85020               downgradeType = "building_address";
85021             } else {
85022               downgradeType = "generic";
85023             }
85024           } else {
85025             downgradeType = type2;
85026           }
85027         }
85028       }
85029       return downgradeType;
85030     }
85031     function downgradeTypeForEntityID(entityID) {
85032       var graph = context.graph();
85033       var entity = graph.entity(entityID);
85034       var preset = _mainPresetIndex.match(entity, graph);
85035       if (!preset || preset.isFallback()) return null;
85036       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
85037         return key.match(/^addr:.{1,}/);
85038       })) {
85039         return "address";
85040       }
85041       var geometry = entity.geometry(graph);
85042       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
85043         return "building";
85044       }
85045       if (geometry === "vertex" && Object.keys(entity.tags).length) {
85046         return "generic";
85047       }
85048       return null;
85049     }
85050     var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
85051     var addressKeysToKeep = ["source"];
85052     var operation2 = function() {
85053       context.perform(function(graph) {
85054         for (var i3 in selectedIDs) {
85055           var entityID = selectedIDs[i3];
85056           var type2 = downgradeTypeForEntityID(entityID);
85057           if (!type2) continue;
85058           var tags = Object.assign({}, graph.entity(entityID).tags);
85059           for (var key in tags) {
85060             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1) continue;
85061             if (type2 === "building") {
85062               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
85063             }
85064             if (type2 !== "generic") {
85065               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/)) continue;
85066             }
85067             delete tags[key];
85068           }
85069           graph = actionChangeTags(entityID, tags)(graph);
85070         }
85071         return graph;
85072       }, operation2.annotation());
85073       context.validator().validate();
85074       context.enter(modeSelect(context, selectedIDs));
85075     };
85076     operation2.available = function() {
85077       return _downgradeType;
85078     };
85079     operation2.disabled = function() {
85080       if (selectedIDs.some(hasWikidataTag)) {
85081         return "has_wikidata_tag";
85082       }
85083       return false;
85084       function hasWikidataTag(id2) {
85085         var entity = context.entity(id2);
85086         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
85087       }
85088     };
85089     operation2.tooltip = function() {
85090       var disable = operation2.disabled();
85091       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
85092     };
85093     operation2.annotation = function() {
85094       var suffix;
85095       if (_downgradeType === "building_address") {
85096         suffix = "generic";
85097       } else {
85098         suffix = _downgradeType;
85099       }
85100       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
85101     };
85102     operation2.id = "downgrade";
85103     operation2.keys = [uiCmd("\u232B")];
85104     operation2.title = _t.append("operations.downgrade.title");
85105     operation2.behavior = behaviorOperation(context).which(operation2);
85106     return operation2;
85107   }
85108   var init_downgrade = __esm({
85109     "modules/operations/downgrade.js"() {
85110       "use strict";
85111       init_change_tags();
85112       init_operation();
85113       init_select5();
85114       init_localizer();
85115       init_cmd();
85116       init_presets();
85117     }
85118   });
85119
85120   // modules/operations/extract.js
85121   var extract_exports2 = {};
85122   __export(extract_exports2, {
85123     operationExtract: () => operationExtract
85124   });
85125   function operationExtract(context, selectedIDs) {
85126     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
85127     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
85128       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
85129     }).filter(Boolean));
85130     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
85131     var _extent;
85132     var _actions = selectedIDs.map(function(entityID) {
85133       var graph = context.graph();
85134       var entity = graph.hasEntity(entityID);
85135       if (!entity || !entity.hasInterestingTags()) return null;
85136       if (entity.type === "node" && graph.parentWays(entity).length === 0) return null;
85137       if (entity.type !== "node") {
85138         var preset = _mainPresetIndex.match(entity, graph);
85139         if (preset.geometry.indexOf("point") === -1) return null;
85140       }
85141       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
85142       return actionExtract(entityID, context.projection);
85143     }).filter(Boolean);
85144     var operation2 = function(d3_event) {
85145       const shiftKeyPressed = (d3_event == null ? void 0 : d3_event.shiftKey) || false;
85146       var combinedAction = function(graph) {
85147         _actions.forEach(function(action) {
85148           graph = action(graph, shiftKeyPressed);
85149         });
85150         return graph;
85151       };
85152       context.perform(combinedAction, operation2.annotation());
85153       var extractedNodeIDs = _actions.map(function(action) {
85154         return action.getExtractedNodeID();
85155       });
85156       context.enter(modeSelect(context, extractedNodeIDs));
85157     };
85158     operation2.available = function() {
85159       return _actions.length && selectedIDs.length === _actions.length;
85160     };
85161     operation2.disabled = function() {
85162       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
85163         return "too_large";
85164       } else if (selectedIDs.some(function(entityID) {
85165         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
85166       })) {
85167         return "connected_to_hidden";
85168       }
85169       return false;
85170     };
85171     operation2.tooltip = function() {
85172       var disableReason = operation2.disabled();
85173       if (disableReason) {
85174         return _t.append("operations.extract." + disableReason + "." + _amount);
85175       } else {
85176         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
85177       }
85178     };
85179     operation2.annotation = function() {
85180       return _t("operations.extract.annotation", { n: selectedIDs.length });
85181     };
85182     operation2.id = "extract";
85183     operation2.keys = [_t("operations.extract.key")];
85184     operation2.title = _t.append("operations.extract.title");
85185     operation2.behavior = behaviorOperation(context).which(operation2);
85186     return operation2;
85187   }
85188   var init_extract2 = __esm({
85189     "modules/operations/extract.js"() {
85190       "use strict";
85191       init_extract();
85192       init_operation();
85193       init_select5();
85194       init_localizer();
85195       init_presets();
85196       init_array3();
85197     }
85198   });
85199
85200   // modules/operations/merge.js
85201   var merge_exports2 = {};
85202   __export(merge_exports2, {
85203     operationMerge: () => operationMerge
85204   });
85205   function operationMerge(context, selectedIDs) {
85206     var _action = getAction();
85207     function getAction() {
85208       var join = actionJoin(selectedIDs);
85209       if (!join.disabled(context.graph())) return join;
85210       var merge3 = actionMerge(selectedIDs);
85211       if (!merge3.disabled(context.graph())) return merge3;
85212       var mergePolygon = actionMergePolygon(selectedIDs);
85213       if (!mergePolygon.disabled(context.graph())) return mergePolygon;
85214       var mergeNodes = actionMergeNodes(selectedIDs);
85215       if (!mergeNodes.disabled(context.graph())) return mergeNodes;
85216       if (join.disabled(context.graph()) !== "not_eligible") return join;
85217       if (merge3.disabled(context.graph()) !== "not_eligible") return merge3;
85218       if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon;
85219       return mergeNodes;
85220     }
85221     var operation2 = function() {
85222       if (operation2.disabled()) return;
85223       context.perform(_action, operation2.annotation());
85224       context.validator().validate();
85225       var resultIDs = selectedIDs.filter(context.hasEntity);
85226       if (resultIDs.length > 1) {
85227         var interestingIDs = resultIDs.filter(function(id2) {
85228           return context.entity(id2).hasInterestingTags();
85229         });
85230         if (interestingIDs.length) resultIDs = interestingIDs;
85231       }
85232       context.enter(modeSelect(context, resultIDs));
85233     };
85234     operation2.available = function() {
85235       return selectedIDs.length >= 2;
85236     };
85237     operation2.disabled = function() {
85238       var actionDisabled = _action.disabled(context.graph());
85239       if (actionDisabled) return actionDisabled;
85240       var osm = context.connection();
85241       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
85242         return "too_many_vertices";
85243       }
85244       return false;
85245     };
85246     operation2.tooltip = function() {
85247       var disabled = operation2.disabled();
85248       if (disabled) {
85249         if (disabled === "conflicting_relations") {
85250           return _t.append("operations.merge.conflicting_relations");
85251         }
85252         if (disabled === "restriction" || disabled === "connectivity") {
85253           return _t.append(
85254             "operations.merge.damage_relation",
85255             { relation: _mainPresetIndex.item("type/" + disabled).name() }
85256           );
85257         }
85258         return _t.append("operations.merge." + disabled);
85259       }
85260       return _t.append("operations.merge.description");
85261     };
85262     operation2.annotation = function() {
85263       return _t("operations.merge.annotation", { n: selectedIDs.length });
85264     };
85265     operation2.id = "merge";
85266     operation2.keys = [_t("operations.merge.key")];
85267     operation2.title = _t.append("operations.merge.title");
85268     operation2.behavior = behaviorOperation(context).which(operation2);
85269     return operation2;
85270   }
85271   var init_merge6 = __esm({
85272     "modules/operations/merge.js"() {
85273       "use strict";
85274       init_localizer();
85275       init_join2();
85276       init_merge5();
85277       init_merge_nodes();
85278       init_merge_polygon();
85279       init_operation();
85280       init_select5();
85281       init_presets();
85282     }
85283   });
85284
85285   // modules/operations/paste.js
85286   var paste_exports2 = {};
85287   __export(paste_exports2, {
85288     operationPaste: () => operationPaste
85289   });
85290   function operationPaste(context) {
85291     var _pastePoint;
85292     var operation2 = function() {
85293       if (!_pastePoint) return;
85294       var oldIDs = context.copyIDs();
85295       if (!oldIDs.length) return;
85296       var projection2 = context.projection;
85297       var extent = geoExtent();
85298       var oldGraph = context.copyGraph();
85299       var newIDs = [];
85300       var action = actionCopyEntities(oldIDs, oldGraph);
85301       context.perform(action);
85302       var copies = action.copies();
85303       var originals = /* @__PURE__ */ new Set();
85304       Object.values(copies).forEach(function(entity) {
85305         originals.add(entity.id);
85306       });
85307       for (var id2 in copies) {
85308         var oldEntity = oldGraph.entity(id2);
85309         var newEntity = copies[id2];
85310         extent._extend(oldEntity.extent(oldGraph));
85311         var parents = context.graph().parentWays(newEntity);
85312         var parentCopied = parents.some(function(parent2) {
85313           return originals.has(parent2.id);
85314         });
85315         if (!parentCopied) {
85316           newIDs.push(newEntity.id);
85317         }
85318       }
85319       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
85320       var delta = geoVecSubtract(_pastePoint, copyPoint);
85321       context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
85322       context.enter(modeSelect(context, newIDs));
85323     };
85324     operation2.point = function(val) {
85325       _pastePoint = val;
85326       return operation2;
85327     };
85328     operation2.available = function() {
85329       return context.mode().id === "browse";
85330     };
85331     operation2.disabled = function() {
85332       return !context.copyIDs().length;
85333     };
85334     operation2.tooltip = function() {
85335       var oldGraph = context.copyGraph();
85336       var ids = context.copyIDs();
85337       if (!ids.length) {
85338         return _t.append("operations.paste.nothing_copied");
85339       }
85340       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
85341     };
85342     operation2.annotation = function() {
85343       var ids = context.copyIDs();
85344       return _t("operations.paste.annotation", { n: ids.length });
85345     };
85346     operation2.id = "paste";
85347     operation2.keys = [uiCmd("\u2318V")];
85348     operation2.title = _t.append("operations.paste.title");
85349     return operation2;
85350   }
85351   var init_paste2 = __esm({
85352     "modules/operations/paste.js"() {
85353       "use strict";
85354       init_copy_entities();
85355       init_move();
85356       init_select5();
85357       init_geo2();
85358       init_localizer();
85359       init_cmd();
85360       init_utilDisplayLabel();
85361     }
85362   });
85363
85364   // modules/operations/reverse.js
85365   var reverse_exports2 = {};
85366   __export(reverse_exports2, {
85367     operationReverse: () => operationReverse
85368   });
85369   function operationReverse(context, selectedIDs) {
85370     var operation2 = function() {
85371       context.perform(function combinedReverseAction(graph) {
85372         actions().forEach(function(action) {
85373           graph = action(graph);
85374         });
85375         return graph;
85376       }, operation2.annotation());
85377       context.validator().validate();
85378     };
85379     function actions(situation) {
85380       return selectedIDs.map(function(entityID) {
85381         var entity = context.hasEntity(entityID);
85382         if (!entity) return null;
85383         if (situation === "toolbar") {
85384           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided())) return null;
85385         }
85386         var geometry = entity.geometry(context.graph());
85387         if (entity.type !== "node" && geometry !== "line") return null;
85388         var action = actionReverse(entityID);
85389         if (action.disabled(context.graph())) return null;
85390         return action;
85391       }).filter(Boolean);
85392     }
85393     function reverseTypeID() {
85394       var acts = actions();
85395       var nodeActionCount = acts.filter(function(act) {
85396         var entity = context.hasEntity(act.entityID());
85397         return entity && entity.type === "node";
85398       }).length;
85399       if (nodeActionCount === 0) return "line";
85400       if (nodeActionCount === acts.length) return "point";
85401       return "feature";
85402     }
85403     operation2.available = function(situation) {
85404       return actions(situation).length > 0;
85405     };
85406     operation2.disabled = function() {
85407       return false;
85408     };
85409     operation2.tooltip = function() {
85410       return _t.append("operations.reverse.description." + reverseTypeID());
85411     };
85412     operation2.annotation = function() {
85413       var acts = actions();
85414       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
85415     };
85416     operation2.id = "reverse";
85417     operation2.keys = [_t("operations.reverse.key")];
85418     operation2.title = _t.append("operations.reverse.title");
85419     operation2.behavior = behaviorOperation(context).which(operation2);
85420     return operation2;
85421   }
85422   var init_reverse2 = __esm({
85423     "modules/operations/reverse.js"() {
85424       "use strict";
85425       init_localizer();
85426       init_reverse();
85427       init_operation();
85428     }
85429   });
85430
85431   // modules/operations/straighten.js
85432   var straighten_exports = {};
85433   __export(straighten_exports, {
85434     operationStraighten: () => operationStraighten
85435   });
85436   function operationStraighten(context, selectedIDs) {
85437     var _wayIDs = selectedIDs.filter(function(id2) {
85438       return id2.charAt(0) === "w";
85439     });
85440     var _nodeIDs = selectedIDs.filter(function(id2) {
85441       return id2.charAt(0) === "n";
85442     });
85443     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
85444     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
85445     var _coords = _nodes.map(function(n3) {
85446       return n3.loc;
85447     });
85448     var _extent = utilTotalExtent(selectedIDs, context.graph());
85449     var _action = chooseAction();
85450     var _geometry;
85451     function chooseAction() {
85452       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
85453         _geometry = "point";
85454         return actionStraightenNodes(_nodeIDs, context.projection);
85455       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
85456         var startNodeIDs = [];
85457         var endNodeIDs = [];
85458         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85459           var entity = context.entity(selectedIDs[i3]);
85460           if (entity.type === "node") {
85461             continue;
85462           } else if (entity.type !== "way" || entity.isClosed()) {
85463             return null;
85464           }
85465           startNodeIDs.push(entity.first());
85466           endNodeIDs.push(entity.last());
85467         }
85468         startNodeIDs = startNodeIDs.filter(function(n3) {
85469           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
85470         });
85471         endNodeIDs = endNodeIDs.filter(function(n3) {
85472           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
85473         });
85474         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null;
85475         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
85476           return node.id;
85477         });
85478         if (wayNodeIDs.length <= 2) return null;
85479         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1)) return null;
85480         if (_nodeIDs.length) {
85481           _extent = utilTotalExtent(_nodeIDs, context.graph());
85482         }
85483         _geometry = "line";
85484         return actionStraightenWay(selectedIDs, context.projection);
85485       }
85486       return null;
85487     }
85488     function operation2() {
85489       if (!_action) return;
85490       context.perform(_action, operation2.annotation());
85491       window.setTimeout(function() {
85492         context.validator().validate();
85493       }, 300);
85494     }
85495     operation2.available = function() {
85496       return Boolean(_action);
85497     };
85498     operation2.disabled = function() {
85499       var reason = _action.disabled(context.graph());
85500       if (reason) {
85501         return reason;
85502       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
85503         return "too_large";
85504       } else if (someMissing()) {
85505         return "not_downloaded";
85506       } else if (selectedIDs.some(context.hasHiddenConnections)) {
85507         return "connected_to_hidden";
85508       }
85509       return false;
85510       function someMissing() {
85511         if (context.inIntro()) return false;
85512         var osm = context.connection();
85513         if (osm) {
85514           var missing = _coords.filter(function(loc) {
85515             return !osm.isDataLoaded(loc);
85516           });
85517           if (missing.length) {
85518             missing.forEach(function(loc) {
85519               context.loadTileAtLoc(loc);
85520             });
85521             return true;
85522           }
85523         }
85524         return false;
85525       }
85526     };
85527     operation2.tooltip = function() {
85528       var disable = operation2.disabled();
85529       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
85530     };
85531     operation2.annotation = function() {
85532       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
85533     };
85534     operation2.id = "straighten";
85535     operation2.keys = [_t("operations.straighten.key")];
85536     operation2.title = _t.append("operations.straighten.title");
85537     operation2.behavior = behaviorOperation(context).which(operation2);
85538     return operation2;
85539   }
85540   var init_straighten = __esm({
85541     "modules/operations/straighten.js"() {
85542       "use strict";
85543       init_localizer();
85544       init_straighten_nodes();
85545       init_straighten_way();
85546       init_operation();
85547       init_util();
85548     }
85549   });
85550
85551   // modules/operations/index.js
85552   var operations_exports = {};
85553   __export(operations_exports, {
85554     operationCircularize: () => operationCircularize,
85555     operationContinue: () => operationContinue,
85556     operationCopy: () => operationCopy,
85557     operationDelete: () => operationDelete,
85558     operationDisconnect: () => operationDisconnect,
85559     operationDowngrade: () => operationDowngrade,
85560     operationExtract: () => operationExtract,
85561     operationMerge: () => operationMerge,
85562     operationMove: () => operationMove,
85563     operationOrthogonalize: () => operationOrthogonalize,
85564     operationPaste: () => operationPaste,
85565     operationReflectLong: () => operationReflectLong,
85566     operationReflectShort: () => operationReflectShort,
85567     operationReverse: () => operationReverse,
85568     operationRotate: () => operationRotate,
85569     operationSplit: () => operationSplit,
85570     operationStraighten: () => operationStraighten
85571   });
85572   var init_operations = __esm({
85573     "modules/operations/index.js"() {
85574       "use strict";
85575       init_circularize2();
85576       init_continue();
85577       init_copy();
85578       init_delete();
85579       init_disconnect2();
85580       init_downgrade();
85581       init_extract2();
85582       init_merge6();
85583       init_move2();
85584       init_orthogonalize2();
85585       init_paste2();
85586       init_reflect2();
85587       init_reverse2();
85588       init_rotate3();
85589       init_split2();
85590       init_straighten();
85591     }
85592   });
85593
85594   // modules/modes/select.js
85595   var select_exports2 = {};
85596   __export(select_exports2, {
85597     modeSelect: () => modeSelect
85598   });
85599   function modeSelect(context, selectedIDs) {
85600     var mode = {
85601       id: "select",
85602       button: "browse"
85603     };
85604     var keybinding = utilKeybinding("select");
85605     var _breatheBehavior = behaviorBreathe(context);
85606     var _modeDragNode = modeDragNode(context);
85607     var _selectBehavior;
85608     var _behaviors = [];
85609     var _operations = [];
85610     var _newFeature = false;
85611     var _follow = false;
85612     var _focusedParentWayId;
85613     var _focusedVertexIds;
85614     function singular() {
85615       if (selectedIDs && selectedIDs.length === 1) {
85616         return context.hasEntity(selectedIDs[0]);
85617       }
85618     }
85619     function selectedEntities() {
85620       return selectedIDs.map(function(id2) {
85621         return context.hasEntity(id2);
85622       }).filter(Boolean);
85623     }
85624     function checkSelectedIDs() {
85625       var ids = [];
85626       if (Array.isArray(selectedIDs)) {
85627         ids = selectedIDs.filter(function(id2) {
85628           return context.hasEntity(id2);
85629         });
85630       }
85631       if (!ids.length) {
85632         context.enter(modeBrowse(context));
85633         return false;
85634       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
85635         context.enter(modeSelect(context, ids));
85636         return false;
85637       }
85638       selectedIDs = ids;
85639       return true;
85640     }
85641     function parentWaysIdsOfSelection(onlyCommonParents) {
85642       var graph = context.graph();
85643       var parents = [];
85644       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85645         var entity = context.hasEntity(selectedIDs[i3]);
85646         if (!entity || entity.geometry(graph) !== "vertex") {
85647           return [];
85648         }
85649         var currParents = graph.parentWays(entity).map(function(w3) {
85650           return w3.id;
85651         });
85652         if (!parents.length) {
85653           parents = currParents;
85654           continue;
85655         }
85656         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
85657         if (!parents.length) {
85658           return [];
85659         }
85660       }
85661       return parents;
85662     }
85663     function childNodeIdsOfSelection(onlyCommon) {
85664       var graph = context.graph();
85665       var childs = [];
85666       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85667         var entity = context.hasEntity(selectedIDs[i3]);
85668         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
85669           return [];
85670         }
85671         var currChilds = graph.childNodes(entity).map(function(node) {
85672           return node.id;
85673         });
85674         if (!childs.length) {
85675           childs = currChilds;
85676           continue;
85677         }
85678         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
85679         if (!childs.length) {
85680           return [];
85681         }
85682       }
85683       return childs;
85684     }
85685     function checkFocusedParent() {
85686       if (_focusedParentWayId) {
85687         var parents = parentWaysIdsOfSelection(true);
85688         if (parents.indexOf(_focusedParentWayId) === -1) _focusedParentWayId = null;
85689       }
85690     }
85691     function parentWayIdForVertexNavigation() {
85692       var parentIds = parentWaysIdsOfSelection(true);
85693       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
85694         return _focusedParentWayId;
85695       }
85696       return parentIds.length ? parentIds[0] : null;
85697     }
85698     mode.selectedIDs = function(val) {
85699       if (!arguments.length) return selectedIDs;
85700       selectedIDs = val;
85701       return mode;
85702     };
85703     mode.zoomToSelected = function() {
85704       context.map().zoomToEase(selectedEntities());
85705     };
85706     mode.newFeature = function(val) {
85707       if (!arguments.length) return _newFeature;
85708       _newFeature = val;
85709       return mode;
85710     };
85711     mode.selectBehavior = function(val) {
85712       if (!arguments.length) return _selectBehavior;
85713       _selectBehavior = val;
85714       return mode;
85715     };
85716     mode.follow = function(val) {
85717       if (!arguments.length) return _follow;
85718       _follow = val;
85719       return mode;
85720     };
85721     function loadOperations() {
85722       _operations.forEach(function(operation2) {
85723         if (operation2.behavior) {
85724           context.uninstall(operation2.behavior);
85725         }
85726       });
85727       _operations = Object.values(operations_exports).map((o2) => o2(context, selectedIDs)).filter((o2) => o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy").concat([
85728         // group copy/downgrade/delete operation together at the end of the list
85729         operationCopy(context, selectedIDs),
85730         operationDowngrade(context, selectedIDs),
85731         operationDelete(context, selectedIDs)
85732       ]);
85733       _operations.filter((operation2) => operation2.available()).forEach((operation2) => {
85734         if (operation2.behavior) {
85735           context.install(operation2.behavior);
85736         }
85737       });
85738       _operations.filter((operation2) => !operation2.available()).forEach((operation2) => {
85739         if (operation2.behavior) {
85740           operation2.behavior.on();
85741         }
85742       });
85743       context.ui().closeEditMenu();
85744     }
85745     mode.operations = function() {
85746       return _operations.filter((operation2) => operation2.available());
85747     };
85748     mode.enter = function() {
85749       if (!checkSelectedIDs()) return;
85750       context.features().forceVisible(selectedIDs);
85751       _modeDragNode.restoreSelectedIDs(selectedIDs);
85752       loadOperations();
85753       if (!_behaviors.length) {
85754         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
85755         _behaviors = [
85756           behaviorPaste(context),
85757           _breatheBehavior,
85758           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
85759           _selectBehavior,
85760           behaviorLasso(context),
85761           _modeDragNode.behavior,
85762           modeDragNote(context).behavior
85763         ];
85764       }
85765       _behaviors.forEach(context.install);
85766       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);
85767       select_default2(document).call(keybinding);
85768       context.ui().sidebar.select(selectedIDs, _newFeature);
85769       context.history().on("change.select", function() {
85770         loadOperations();
85771         selectElements();
85772       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
85773       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
85774         selectElements();
85775         _breatheBehavior.restartIfNeeded(context.surface());
85776       });
85777       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
85778       selectElements();
85779       if (_follow) {
85780         var extent = geoExtent();
85781         var graph = context.graph();
85782         selectedIDs.forEach(function(id2) {
85783           var entity = context.entity(id2);
85784           extent._extend(entity.extent(graph));
85785         });
85786         var loc = extent.center();
85787         context.map().centerEase(loc);
85788         _follow = false;
85789       }
85790       function nudgeSelection(delta) {
85791         return function() {
85792           if (!context.map().withinEditableZoom()) return;
85793           var moveOp = operationMove(context, selectedIDs);
85794           if (moveOp.disabled()) {
85795             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
85796           } else {
85797             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
85798             context.validator().validate();
85799           }
85800         };
85801       }
85802       function scaleSelection(factor) {
85803         return function() {
85804           if (!context.map().withinEditableZoom()) return;
85805           let nodes = utilGetAllNodes(selectedIDs, context.graph());
85806           let isUp = factor > 1;
85807           if (nodes.length <= 1) return;
85808           let extent2 = utilTotalExtent(selectedIDs, context.graph());
85809           function scalingDisabled() {
85810             if (tooSmall()) {
85811               return "too_small";
85812             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
85813               return "too_large";
85814             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
85815               return "not_downloaded";
85816             } else if (selectedIDs.some(context.hasHiddenConnections)) {
85817               return "connected_to_hidden";
85818             }
85819             return false;
85820             function tooSmall() {
85821               if (isUp) return false;
85822               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
85823               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
85824               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
85825             }
85826             function someMissing() {
85827               if (context.inIntro()) return false;
85828               let osm = context.connection();
85829               if (osm) {
85830                 let missing = nodes.filter(function(n3) {
85831                   return !osm.isDataLoaded(n3.loc);
85832                 });
85833                 if (missing.length) {
85834                   missing.forEach(function(loc2) {
85835                     context.loadTileAtLoc(loc2);
85836                   });
85837                   return true;
85838                 }
85839               }
85840               return false;
85841             }
85842             function incompleteRelation(id2) {
85843               let entity = context.entity(id2);
85844               return entity.type === "relation" && !entity.isComplete(context.graph());
85845             }
85846           }
85847           const disabled = scalingDisabled();
85848           if (disabled) {
85849             let multi = selectedIDs.length === 1 ? "single" : "multiple";
85850             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
85851           } else {
85852             const pivot = context.projection(extent2.center());
85853             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
85854             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
85855             context.validator().validate();
85856           }
85857         };
85858       }
85859       function didDoubleUp(d3_event, loc2) {
85860         if (!context.map().withinEditableZoom()) return;
85861         var target = select_default2(d3_event.target);
85862         var datum2 = target.datum();
85863         var entity = datum2 && datum2.properties && datum2.properties.entity;
85864         if (!entity) return;
85865         if (entity instanceof osmWay && target.classed("target")) {
85866           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
85867           var prev = entity.nodes[choice.index - 1];
85868           var next = entity.nodes[choice.index];
85869           context.perform(
85870             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
85871             _t("operations.add.annotation.vertex")
85872           );
85873           context.validator().validate();
85874         } else if (entity.type === "midpoint") {
85875           context.perform(
85876             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
85877             _t("operations.add.annotation.vertex")
85878           );
85879           context.validator().validate();
85880         }
85881       }
85882       function selectElements() {
85883         if (!checkSelectedIDs()) return;
85884         var surface = context.surface();
85885         surface.selectAll(".selected-member").classed("selected-member", false);
85886         surface.selectAll(".selected").classed("selected", false);
85887         surface.selectAll(".related").classed("related", false);
85888         checkFocusedParent();
85889         if (_focusedParentWayId) {
85890           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85891         }
85892         if (context.map().withinEditableZoom()) {
85893           surface.selectAll(utilDeepMemberSelector(
85894             selectedIDs,
85895             context.graph(),
85896             true
85897             /* skipMultipolgonMembers */
85898           )).classed("selected-member", true);
85899           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
85900         }
85901       }
85902       function esc() {
85903         if (context.container().select(".combobox").size()) return;
85904         context.enter(modeBrowse(context));
85905       }
85906       function firstVertex(d3_event) {
85907         d3_event.preventDefault();
85908         var entity = singular();
85909         var parentId = parentWayIdForVertexNavigation();
85910         var way;
85911         if (entity && entity.type === "way") {
85912           way = entity;
85913         } else if (parentId) {
85914           way = context.entity(parentId);
85915         }
85916         _focusedParentWayId = way && way.id;
85917         if (way) {
85918           context.enter(
85919             mode.selectedIDs([way.first()]).follow(true)
85920           );
85921         }
85922       }
85923       function lastVertex(d3_event) {
85924         d3_event.preventDefault();
85925         var entity = singular();
85926         var parentId = parentWayIdForVertexNavigation();
85927         var way;
85928         if (entity && entity.type === "way") {
85929           way = entity;
85930         } else if (parentId) {
85931           way = context.entity(parentId);
85932         }
85933         _focusedParentWayId = way && way.id;
85934         if (way) {
85935           context.enter(
85936             mode.selectedIDs([way.last()]).follow(true)
85937           );
85938         }
85939       }
85940       function previousVertex(d3_event) {
85941         d3_event.preventDefault();
85942         var parentId = parentWayIdForVertexNavigation();
85943         _focusedParentWayId = parentId;
85944         if (!parentId) return;
85945         var way = context.entity(parentId);
85946         var length2 = way.nodes.length;
85947         var curr = way.nodes.indexOf(selectedIDs[0]);
85948         var index = -1;
85949         if (curr > 0) {
85950           index = curr - 1;
85951         } else if (way.isClosed()) {
85952           index = length2 - 2;
85953         }
85954         if (index !== -1) {
85955           context.enter(
85956             mode.selectedIDs([way.nodes[index]]).follow(true)
85957           );
85958         }
85959       }
85960       function nextVertex(d3_event) {
85961         d3_event.preventDefault();
85962         var parentId = parentWayIdForVertexNavigation();
85963         _focusedParentWayId = parentId;
85964         if (!parentId) return;
85965         var way = context.entity(parentId);
85966         var length2 = way.nodes.length;
85967         var curr = way.nodes.indexOf(selectedIDs[0]);
85968         var index = -1;
85969         if (curr < length2 - 1) {
85970           index = curr + 1;
85971         } else if (way.isClosed()) {
85972           index = 0;
85973         }
85974         if (index !== -1) {
85975           context.enter(
85976             mode.selectedIDs([way.nodes[index]]).follow(true)
85977           );
85978         }
85979       }
85980       function focusNextParent(d3_event) {
85981         d3_event.preventDefault();
85982         var parents = parentWaysIdsOfSelection(true);
85983         if (!parents || parents.length < 2) return;
85984         var index = parents.indexOf(_focusedParentWayId);
85985         if (index < 0 || index > parents.length - 2) {
85986           _focusedParentWayId = parents[0];
85987         } else {
85988           _focusedParentWayId = parents[index + 1];
85989         }
85990         var surface = context.surface();
85991         surface.selectAll(".related").classed("related", false);
85992         if (_focusedParentWayId) {
85993           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85994         }
85995       }
85996       function selectParent(d3_event) {
85997         d3_event.preventDefault();
85998         var currentSelectedIds = mode.selectedIDs();
85999         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
86000         if (!parentIds.length) return;
86001         context.enter(
86002           mode.selectedIDs(parentIds)
86003         );
86004         _focusedVertexIds = currentSelectedIds;
86005       }
86006       function selectChild(d3_event) {
86007         d3_event.preventDefault();
86008         var currentSelectedIds = mode.selectedIDs();
86009         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
86010         if (!childIds || !childIds.length) return;
86011         if (currentSelectedIds.length === 1) _focusedParentWayId = currentSelectedIds[0];
86012         context.enter(
86013           mode.selectedIDs(childIds)
86014         );
86015       }
86016     };
86017     mode.exit = function() {
86018       _newFeature = false;
86019       _focusedVertexIds = null;
86020       _operations.forEach((operation2) => {
86021         if (operation2.behavior) {
86022           context.uninstall(operation2.behavior);
86023         }
86024       });
86025       _operations = [];
86026       _behaviors.forEach(context.uninstall);
86027       select_default2(document).call(keybinding.unbind);
86028       context.ui().closeEditMenu();
86029       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
86030       var surface = context.surface();
86031       surface.selectAll(".selected-member").classed("selected-member", false);
86032       surface.selectAll(".selected").classed("selected", false);
86033       surface.selectAll(".highlighted").classed("highlighted", false);
86034       surface.selectAll(".related").classed("related", false);
86035       context.map().on("drawn.select", null);
86036       context.ui().sidebar.hide();
86037       context.features().forceVisible([]);
86038       var entity = singular();
86039       if (_newFeature && entity && entity.type === "relation" && // no tags
86040       Object.keys(entity.tags).length === 0 && // no parent relations
86041       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
86042       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
86043         var deleteAction = actionDeleteRelation(
86044           entity.id,
86045           true
86046           /* don't delete untagged members */
86047         );
86048         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
86049         context.validator().validate();
86050       }
86051     };
86052     return mode;
86053   }
86054   var init_select5 = __esm({
86055     "modules/modes/select.js"() {
86056       "use strict";
86057       init_src5();
86058       init_localizer();
86059       init_add_midpoint();
86060       init_delete_relation();
86061       init_move();
86062       init_scale();
86063       init_breathe();
86064       init_hover();
86065       init_lasso2();
86066       init_paste();
86067       init_select4();
86068       init_move2();
86069       init_geo2();
86070       init_browse();
86071       init_drag_node();
86072       init_drag_note();
86073       init_osm();
86074       init_operations();
86075       init_cmd();
86076       init_util();
86077     }
86078   });
86079
86080   // modules/behavior/lasso.js
86081   var lasso_exports2 = {};
86082   __export(lasso_exports2, {
86083     behaviorLasso: () => behaviorLasso
86084   });
86085   function behaviorLasso(context) {
86086     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
86087     var behavior = function(selection2) {
86088       var lasso;
86089       function pointerdown(d3_event) {
86090         var button = 0;
86091         if (d3_event.button === button && d3_event.shiftKey === true) {
86092           lasso = null;
86093           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
86094           d3_event.stopPropagation();
86095         }
86096       }
86097       function pointermove() {
86098         if (!lasso) {
86099           lasso = uiLasso(context);
86100           context.surface().call(lasso);
86101         }
86102         lasso.p(context.map().mouse());
86103       }
86104       function normalize2(a4, b3) {
86105         return [
86106           [Math.min(a4[0], b3[0]), Math.min(a4[1], b3[1])],
86107           [Math.max(a4[0], b3[0]), Math.max(a4[1], b3[1])]
86108         ];
86109       }
86110       function lassoed() {
86111         if (!lasso) return [];
86112         var graph = context.graph();
86113         var limitToNodes;
86114         if (context.map().editableDataEnabled(
86115           true
86116           /* skipZoomCheck */
86117         ) && context.map().isInWideSelection()) {
86118           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
86119         } else if (!context.map().editableDataEnabled()) {
86120           return [];
86121         }
86122         var bounds = lasso.extent().map(context.projection.invert);
86123         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
86124         var intersects2 = context.history().intersects(extent).filter(function(entity) {
86125           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
86126         });
86127         intersects2.sort(function(node1, node2) {
86128           var parents1 = graph.parentWays(node1);
86129           var parents2 = graph.parentWays(node2);
86130           if (parents1.length && parents2.length) {
86131             var sharedParents = utilArrayIntersection(parents1, parents2);
86132             if (sharedParents.length) {
86133               var sharedParentNodes = sharedParents[0].nodes;
86134               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
86135             } else {
86136               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
86137             }
86138           } else if (parents1.length || parents2.length) {
86139             return parents1.length - parents2.length;
86140           }
86141           return node1.loc[0] - node2.loc[0];
86142         });
86143         return intersects2.map(function(entity) {
86144           return entity.id;
86145         });
86146       }
86147       function pointerup() {
86148         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
86149         if (!lasso) return;
86150         var ids = lassoed();
86151         lasso.close();
86152         if (ids.length) {
86153           context.enter(modeSelect(context, ids));
86154         }
86155       }
86156       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
86157     };
86158     behavior.off = function(selection2) {
86159       selection2.on(_pointerPrefix + "down.lasso", null);
86160     };
86161     return behavior;
86162   }
86163   var init_lasso2 = __esm({
86164     "modules/behavior/lasso.js"() {
86165       "use strict";
86166       init_src5();
86167       init_geo2();
86168       init_select5();
86169       init_lasso();
86170       init_array3();
86171       init_util2();
86172     }
86173   });
86174
86175   // modules/modes/browse.js
86176   var browse_exports = {};
86177   __export(browse_exports, {
86178     modeBrowse: () => modeBrowse
86179   });
86180   function modeBrowse(context) {
86181     var mode = {
86182       button: "browse",
86183       id: "browse",
86184       title: _t.append("modes.browse.title"),
86185       description: _t.append("modes.browse.description")
86186     };
86187     var sidebar;
86188     var _selectBehavior;
86189     var _behaviors = [];
86190     mode.selectBehavior = function(val) {
86191       if (!arguments.length) return _selectBehavior;
86192       _selectBehavior = val;
86193       return mode;
86194     };
86195     mode.enter = function() {
86196       if (!_behaviors.length) {
86197         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
86198         _behaviors = [
86199           behaviorPaste(context),
86200           behaviorHover(context).on("hover", context.ui().sidebar.hover),
86201           _selectBehavior,
86202           behaviorLasso(context),
86203           modeDragNode(context).behavior,
86204           modeDragNote(context).behavior
86205         ];
86206       }
86207       _behaviors.forEach(context.install);
86208       if (document.activeElement && document.activeElement.blur) {
86209         document.activeElement.blur();
86210       }
86211       if (sidebar) {
86212         context.ui().sidebar.show(sidebar);
86213       } else {
86214         context.ui().sidebar.select(null);
86215       }
86216     };
86217     mode.exit = function() {
86218       context.ui().sidebar.hover.cancel();
86219       _behaviors.forEach(context.uninstall);
86220       if (sidebar) {
86221         context.ui().sidebar.hide();
86222       }
86223     };
86224     mode.sidebar = function(_3) {
86225       if (!arguments.length) return sidebar;
86226       sidebar = _3;
86227       return mode;
86228     };
86229     mode.operations = function() {
86230       return [operationPaste(context)];
86231     };
86232     return mode;
86233   }
86234   var init_browse = __esm({
86235     "modules/modes/browse.js"() {
86236       "use strict";
86237       init_localizer();
86238       init_hover();
86239       init_lasso2();
86240       init_paste();
86241       init_select4();
86242       init_drag_node();
86243       init_drag_note();
86244       init_paste2();
86245     }
86246   });
86247
86248   // modules/behavior/add_way.js
86249   var add_way_exports = {};
86250   __export(add_way_exports, {
86251     behaviorAddWay: () => behaviorAddWay
86252   });
86253   function behaviorAddWay(context) {
86254     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
86255     var draw = behaviorDraw(context);
86256     function behavior(surface) {
86257       draw.on("click", function() {
86258         dispatch14.apply("start", this, arguments);
86259       }).on("clickWay", function() {
86260         dispatch14.apply("startFromWay", this, arguments);
86261       }).on("clickNode", function() {
86262         dispatch14.apply("startFromNode", this, arguments);
86263       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
86264       context.map().dblclickZoomEnable(false);
86265       surface.call(draw);
86266     }
86267     behavior.off = function(surface) {
86268       surface.call(draw.off);
86269     };
86270     behavior.cancel = function() {
86271       window.setTimeout(function() {
86272         context.map().dblclickZoomEnable(true);
86273       }, 1e3);
86274       context.enter(modeBrowse(context));
86275     };
86276     return utilRebind(behavior, dispatch14, "on");
86277   }
86278   var init_add_way = __esm({
86279     "modules/behavior/add_way.js"() {
86280       "use strict";
86281       init_src4();
86282       init_draw();
86283       init_browse();
86284       init_rebind();
86285     }
86286   });
86287
86288   // modules/globals.d.ts
86289   var globals_d_exports = {};
86290   var init_globals_d = __esm({
86291     "modules/globals.d.ts"() {
86292       "use strict";
86293     }
86294   });
86295
86296   // modules/ui/panes/index.js
86297   var panes_exports = {};
86298   __export(panes_exports, {
86299     uiPaneBackground: () => uiPaneBackground,
86300     uiPaneHelp: () => uiPaneHelp,
86301     uiPaneIssues: () => uiPaneIssues,
86302     uiPaneMapData: () => uiPaneMapData,
86303     uiPanePreferences: () => uiPanePreferences
86304   });
86305   var init_panes = __esm({
86306     "modules/ui/panes/index.js"() {
86307       "use strict";
86308       init_background3();
86309       init_help();
86310       init_issues();
86311       init_map_data();
86312       init_preferences2();
86313     }
86314   });
86315
86316   // modules/ui/sections/index.js
86317   var sections_exports = {};
86318   __export(sections_exports, {
86319     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
86320     uiSectionBackgroundList: () => uiSectionBackgroundList,
86321     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
86322     uiSectionChanges: () => uiSectionChanges,
86323     uiSectionDataLayers: () => uiSectionDataLayers,
86324     uiSectionEntityIssues: () => uiSectionEntityIssues,
86325     uiSectionFeatureType: () => uiSectionFeatureType,
86326     uiSectionMapFeatures: () => uiSectionMapFeatures,
86327     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
86328     uiSectionOverlayList: () => uiSectionOverlayList,
86329     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
86330     uiSectionPresetFields: () => uiSectionPresetFields,
86331     uiSectionPrivacy: () => uiSectionPrivacy,
86332     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
86333     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
86334     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
86335     uiSectionSelectionList: () => uiSectionSelectionList,
86336     uiSectionValidationIssues: () => uiSectionValidationIssues,
86337     uiSectionValidationOptions: () => uiSectionValidationOptions,
86338     uiSectionValidationRules: () => uiSectionValidationRules,
86339     uiSectionValidationStatus: () => uiSectionValidationStatus
86340   });
86341   var init_sections = __esm({
86342     "modules/ui/sections/index.js"() {
86343       "use strict";
86344       init_background_display_options();
86345       init_background_list();
86346       init_background_offset();
86347       init_changes();
86348       init_data_layers();
86349       init_entity_issues();
86350       init_feature_type();
86351       init_map_features();
86352       init_map_style_options();
86353       init_overlay_list();
86354       init_photo_overlays();
86355       init_preset_fields();
86356       init_privacy();
86357       init_raw_member_editor();
86358       init_raw_membership_editor();
86359       init_raw_tag_editor();
86360       init_selection_list();
86361       init_validation_issues();
86362       init_validation_options();
86363       init_validation_rules();
86364       init_validation_status();
86365     }
86366   });
86367
86368   // modules/ui/settings/index.js
86369   var settings_exports = {};
86370   __export(settings_exports, {
86371     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
86372     uiSettingsCustomData: () => uiSettingsCustomData
86373   });
86374   var init_settings = __esm({
86375     "modules/ui/settings/index.js"() {
86376       "use strict";
86377       init_custom_background();
86378       init_custom_data();
86379     }
86380   });
86381
86382   // import("../**/*") in modules/core/file_fetcher.js
86383   var globImport;
86384   var init_ = __esm({
86385     'import("../**/*") in modules/core/file_fetcher.js'() {
86386       globImport = __glob({
86387         "../actions/add_entity.js": () => Promise.resolve().then(() => (init_add_entity(), add_entity_exports)),
86388         "../actions/add_member.js": () => Promise.resolve().then(() => (init_add_member(), add_member_exports)),
86389         "../actions/add_midpoint.js": () => Promise.resolve().then(() => (init_add_midpoint(), add_midpoint_exports)),
86390         "../actions/add_vertex.js": () => Promise.resolve().then(() => (init_add_vertex(), add_vertex_exports)),
86391         "../actions/change_member.js": () => Promise.resolve().then(() => (init_change_member(), change_member_exports)),
86392         "../actions/change_preset.js": () => Promise.resolve().then(() => (init_change_preset(), change_preset_exports)),
86393         "../actions/change_tags.js": () => Promise.resolve().then(() => (init_change_tags(), change_tags_exports)),
86394         "../actions/circularize.js": () => Promise.resolve().then(() => (init_circularize(), circularize_exports)),
86395         "../actions/connect.js": () => Promise.resolve().then(() => (init_connect(), connect_exports)),
86396         "../actions/copy_entities.js": () => Promise.resolve().then(() => (init_copy_entities(), copy_entities_exports)),
86397         "../actions/delete_member.js": () => Promise.resolve().then(() => (init_delete_member(), delete_member_exports)),
86398         "../actions/delete_members.js": () => Promise.resolve().then(() => (init_delete_members(), delete_members_exports)),
86399         "../actions/delete_multiple.js": () => Promise.resolve().then(() => (init_delete_multiple(), delete_multiple_exports)),
86400         "../actions/delete_node.js": () => Promise.resolve().then(() => (init_delete_node(), delete_node_exports)),
86401         "../actions/delete_relation.js": () => Promise.resolve().then(() => (init_delete_relation(), delete_relation_exports)),
86402         "../actions/delete_way.js": () => Promise.resolve().then(() => (init_delete_way(), delete_way_exports)),
86403         "../actions/discard_tags.js": () => Promise.resolve().then(() => (init_discard_tags(), discard_tags_exports)),
86404         "../actions/disconnect.js": () => Promise.resolve().then(() => (init_disconnect(), disconnect_exports)),
86405         "../actions/extract.js": () => Promise.resolve().then(() => (init_extract(), extract_exports)),
86406         "../actions/index.js": () => Promise.resolve().then(() => (init_actions(), actions_exports)),
86407         "../actions/join.js": () => Promise.resolve().then(() => (init_join2(), join_exports)),
86408         "../actions/merge.js": () => Promise.resolve().then(() => (init_merge5(), merge_exports)),
86409         "../actions/merge_nodes.js": () => Promise.resolve().then(() => (init_merge_nodes(), merge_nodes_exports)),
86410         "../actions/merge_polygon.js": () => Promise.resolve().then(() => (init_merge_polygon(), merge_polygon_exports)),
86411         "../actions/merge_remote_changes.js": () => Promise.resolve().then(() => (init_merge_remote_changes(), merge_remote_changes_exports)),
86412         "../actions/move.js": () => Promise.resolve().then(() => (init_move(), move_exports)),
86413         "../actions/move_member.js": () => Promise.resolve().then(() => (init_move_member(), move_member_exports)),
86414         "../actions/move_node.js": () => Promise.resolve().then(() => (init_move_node(), move_node_exports)),
86415         "../actions/noop.js": () => Promise.resolve().then(() => (init_noop2(), noop_exports)),
86416         "../actions/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize(), orthogonalize_exports)),
86417         "../actions/reflect.js": () => Promise.resolve().then(() => (init_reflect(), reflect_exports)),
86418         "../actions/restrict_turn.js": () => Promise.resolve().then(() => (init_restrict_turn(), restrict_turn_exports)),
86419         "../actions/reverse.js": () => Promise.resolve().then(() => (init_reverse(), reverse_exports)),
86420         "../actions/revert.js": () => Promise.resolve().then(() => (init_revert(), revert_exports)),
86421         "../actions/rotate.js": () => Promise.resolve().then(() => (init_rotate(), rotate_exports)),
86422         "../actions/scale.js": () => Promise.resolve().then(() => (init_scale(), scale_exports)),
86423         "../actions/split.js": () => Promise.resolve().then(() => (init_split(), split_exports)),
86424         "../actions/straighten_nodes.js": () => Promise.resolve().then(() => (init_straighten_nodes(), straighten_nodes_exports)),
86425         "../actions/straighten_way.js": () => Promise.resolve().then(() => (init_straighten_way(), straighten_way_exports)),
86426         "../actions/unrestrict_turn.js": () => Promise.resolve().then(() => (init_unrestrict_turn(), unrestrict_turn_exports)),
86427         "../actions/upgrade_tags.js": () => Promise.resolve().then(() => (init_upgrade_tags(), upgrade_tags_exports)),
86428         "../behavior/add_way.js": () => Promise.resolve().then(() => (init_add_way(), add_way_exports)),
86429         "../behavior/breathe.js": () => Promise.resolve().then(() => (init_breathe(), breathe_exports)),
86430         "../behavior/drag.js": () => Promise.resolve().then(() => (init_drag2(), drag_exports)),
86431         "../behavior/draw.js": () => Promise.resolve().then(() => (init_draw(), draw_exports)),
86432         "../behavior/draw_way.js": () => Promise.resolve().then(() => (init_draw_way(), draw_way_exports)),
86433         "../behavior/edit.js": () => Promise.resolve().then(() => (init_edit(), edit_exports)),
86434         "../behavior/hash.js": () => Promise.resolve().then(() => (init_hash(), hash_exports)),
86435         "../behavior/hover.js": () => Promise.resolve().then(() => (init_hover(), hover_exports)),
86436         "../behavior/index.js": () => Promise.resolve().then(() => (init_behavior(), behavior_exports)),
86437         "../behavior/lasso.js": () => Promise.resolve().then(() => (init_lasso2(), lasso_exports2)),
86438         "../behavior/operation.js": () => Promise.resolve().then(() => (init_operation(), operation_exports)),
86439         "../behavior/paste.js": () => Promise.resolve().then(() => (init_paste(), paste_exports)),
86440         "../behavior/select.js": () => Promise.resolve().then(() => (init_select4(), select_exports)),
86441         "../core/LocationManager.js": () => Promise.resolve().then(() => (init_LocationManager(), LocationManager_exports)),
86442         "../core/context.js": () => Promise.resolve().then(() => (init_context2(), context_exports)),
86443         "../core/difference.js": () => Promise.resolve().then(() => (init_difference(), difference_exports)),
86444         "../core/file_fetcher.js": () => Promise.resolve().then(() => (init_file_fetcher(), file_fetcher_exports)),
86445         "../core/graph.js": () => Promise.resolve().then(() => (init_graph(), graph_exports)),
86446         "../core/history.js": () => Promise.resolve().then(() => (init_history(), history_exports)),
86447         "../core/index.js": () => Promise.resolve().then(() => (init_core(), core_exports)),
86448         "../core/localizer.js": () => Promise.resolve().then(() => (init_localizer(), localizer_exports)),
86449         "../core/preferences.js": () => Promise.resolve().then(() => (init_preferences(), preferences_exports)),
86450         "../core/tree.js": () => Promise.resolve().then(() => (init_tree(), tree_exports)),
86451         "../core/uploader.js": () => Promise.resolve().then(() => (init_uploader(), uploader_exports)),
86452         "../core/validation/index.js": () => Promise.resolve().then(() => (init_validation(), validation_exports)),
86453         "../core/validation/models.js": () => Promise.resolve().then(() => (init_models(), models_exports)),
86454         "../core/validator.js": () => Promise.resolve().then(() => (init_validator(), validator_exports)),
86455         "../geo/extent.js": () => Promise.resolve().then(() => (init_extent(), extent_exports)),
86456         "../geo/geo.js": () => Promise.resolve().then(() => (init_geo(), geo_exports)),
86457         "../geo/geom.js": () => Promise.resolve().then(() => (init_geom(), geom_exports)),
86458         "../geo/index.js": () => Promise.resolve().then(() => (init_geo2(), geo_exports2)),
86459         "../geo/ortho.js": () => Promise.resolve().then(() => (init_ortho(), ortho_exports)),
86460         "../geo/raw_mercator.js": () => Promise.resolve().then(() => (init_raw_mercator(), raw_mercator_exports)),
86461         "../geo/vector.js": () => Promise.resolve().then(() => (init_vector(), vector_exports)),
86462         "../globals.d.ts": () => Promise.resolve().then(() => (init_globals_d(), globals_d_exports)),
86463         "../id.js": () => Promise.resolve().then(() => (init_id2(), id_exports)),
86464         "../index.js": () => Promise.resolve().then(() => (init_index(), index_exports)),
86465         "../modes/add_area.js": () => Promise.resolve().then(() => (init_add_area(), add_area_exports)),
86466         "../modes/add_line.js": () => Promise.resolve().then(() => (init_add_line(), add_line_exports)),
86467         "../modes/add_note.js": () => Promise.resolve().then(() => (init_add_note(), add_note_exports)),
86468         "../modes/add_point.js": () => Promise.resolve().then(() => (init_add_point(), add_point_exports)),
86469         "../modes/browse.js": () => Promise.resolve().then(() => (init_browse(), browse_exports)),
86470         "../modes/drag_node.js": () => Promise.resolve().then(() => (init_drag_node(), drag_node_exports)),
86471         "../modes/drag_note.js": () => Promise.resolve().then(() => (init_drag_note(), drag_note_exports)),
86472         "../modes/draw_area.js": () => Promise.resolve().then(() => (init_draw_area(), draw_area_exports)),
86473         "../modes/draw_line.js": () => Promise.resolve().then(() => (init_draw_line(), draw_line_exports)),
86474         "../modes/index.js": () => Promise.resolve().then(() => (init_modes2(), modes_exports2)),
86475         "../modes/move.js": () => Promise.resolve().then(() => (init_move3(), move_exports3)),
86476         "../modes/rotate.js": () => Promise.resolve().then(() => (init_rotate2(), rotate_exports2)),
86477         "../modes/save.js": () => Promise.resolve().then(() => (init_save2(), save_exports2)),
86478         "../modes/select.js": () => Promise.resolve().then(() => (init_select5(), select_exports2)),
86479         "../modes/select_data.js": () => Promise.resolve().then(() => (init_select_data(), select_data_exports)),
86480         "../modes/select_error.js": () => Promise.resolve().then(() => (init_select_error(), select_error_exports)),
86481         "../modes/select_note.js": () => Promise.resolve().then(() => (init_select_note(), select_note_exports)),
86482         "../operations/circularize.js": () => Promise.resolve().then(() => (init_circularize2(), circularize_exports2)),
86483         "../operations/continue.js": () => Promise.resolve().then(() => (init_continue(), continue_exports)),
86484         "../operations/copy.js": () => Promise.resolve().then(() => (init_copy(), copy_exports)),
86485         "../operations/delete.js": () => Promise.resolve().then(() => (init_delete(), delete_exports)),
86486         "../operations/disconnect.js": () => Promise.resolve().then(() => (init_disconnect2(), disconnect_exports2)),
86487         "../operations/downgrade.js": () => Promise.resolve().then(() => (init_downgrade(), downgrade_exports)),
86488         "../operations/extract.js": () => Promise.resolve().then(() => (init_extract2(), extract_exports2)),
86489         "../operations/index.js": () => Promise.resolve().then(() => (init_operations(), operations_exports)),
86490         "../operations/merge.js": () => Promise.resolve().then(() => (init_merge6(), merge_exports2)),
86491         "../operations/move.js": () => Promise.resolve().then(() => (init_move2(), move_exports2)),
86492         "../operations/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize2(), orthogonalize_exports2)),
86493         "../operations/paste.js": () => Promise.resolve().then(() => (init_paste2(), paste_exports2)),
86494         "../operations/reflect.js": () => Promise.resolve().then(() => (init_reflect2(), reflect_exports2)),
86495         "../operations/reverse.js": () => Promise.resolve().then(() => (init_reverse2(), reverse_exports2)),
86496         "../operations/rotate.js": () => Promise.resolve().then(() => (init_rotate3(), rotate_exports3)),
86497         "../operations/split.js": () => Promise.resolve().then(() => (init_split2(), split_exports2)),
86498         "../operations/straighten.js": () => Promise.resolve().then(() => (init_straighten(), straighten_exports)),
86499         "../osm/changeset.js": () => Promise.resolve().then(() => (init_changeset(), changeset_exports)),
86500         "../osm/deprecated.js": () => Promise.resolve().then(() => (init_deprecated(), deprecated_exports)),
86501         "../osm/entity.js": () => Promise.resolve().then(() => (init_entity(), entity_exports)),
86502         "../osm/index.js": () => Promise.resolve().then(() => (init_osm(), osm_exports)),
86503         "../osm/intersection.js": () => Promise.resolve().then(() => (init_intersection(), intersection_exports)),
86504         "../osm/lanes.js": () => Promise.resolve().then(() => (init_lanes(), lanes_exports)),
86505         "../osm/multipolygon.js": () => Promise.resolve().then(() => (init_multipolygon(), multipolygon_exports)),
86506         "../osm/node.js": () => Promise.resolve().then(() => (init_node2(), node_exports)),
86507         "../osm/note.js": () => Promise.resolve().then(() => (init_note(), note_exports)),
86508         "../osm/qa_item.js": () => Promise.resolve().then(() => (init_qa_item(), qa_item_exports)),
86509         "../osm/relation.js": () => Promise.resolve().then(() => (init_relation(), relation_exports)),
86510         "../osm/tags.js": () => Promise.resolve().then(() => (init_tags(), tags_exports)),
86511         "../osm/way.js": () => Promise.resolve().then(() => (init_way(), way_exports)),
86512         "../presets/category.js": () => Promise.resolve().then(() => (init_category(), category_exports)),
86513         "../presets/collection.js": () => Promise.resolve().then(() => (init_collection(), collection_exports)),
86514         "../presets/field.js": () => Promise.resolve().then(() => (init_field(), field_exports)),
86515         "../presets/index.js": () => Promise.resolve().then(() => (init_presets(), presets_exports)),
86516         "../presets/preset.js": () => Promise.resolve().then(() => (init_preset(), preset_exports)),
86517         "../renderer/background.js": () => Promise.resolve().then(() => (init_background2(), background_exports2)),
86518         "../renderer/background_source.js": () => Promise.resolve().then(() => (init_background_source(), background_source_exports)),
86519         "../renderer/features.js": () => Promise.resolve().then(() => (init_features(), features_exports)),
86520         "../renderer/index.js": () => Promise.resolve().then(() => (init_renderer(), renderer_exports)),
86521         "../renderer/map.js": () => Promise.resolve().then(() => (init_map(), map_exports)),
86522         "../renderer/photos.js": () => Promise.resolve().then(() => (init_photos(), photos_exports)),
86523         "../renderer/tile_layer.js": () => Promise.resolve().then(() => (init_tile_layer(), tile_layer_exports)),
86524         "../services/index.js": () => Promise.resolve().then(() => (init_services(), services_exports)),
86525         "../services/kartaview.js": () => Promise.resolve().then(() => (init_kartaview(), kartaview_exports)),
86526         "../services/keepRight.js": () => Promise.resolve().then(() => (init_keepRight(), keepRight_exports)),
86527         "../services/mapilio.js": () => Promise.resolve().then(() => (init_mapilio(), mapilio_exports)),
86528         "../services/mapillary.js": () => Promise.resolve().then(() => (init_mapillary(), mapillary_exports)),
86529         "../services/maprules.js": () => Promise.resolve().then(() => (init_maprules(), maprules_exports)),
86530         "../services/nominatim.js": () => Promise.resolve().then(() => (init_nominatim(), nominatim_exports)),
86531         "../services/nsi.js": () => Promise.resolve().then(() => (init_nsi(), nsi_exports)),
86532         "../services/osm.js": () => Promise.resolve().then(() => (init_osm2(), osm_exports2)),
86533         "../services/osm_wikibase.js": () => Promise.resolve().then(() => (init_osm_wikibase(), osm_wikibase_exports)),
86534         "../services/osmose.js": () => Promise.resolve().then(() => (init_osmose(), osmose_exports)),
86535         "../services/pannellum_photo.js": () => Promise.resolve().then(() => (init_pannellum_photo(), pannellum_photo_exports)),
86536         "../services/panoramax.js": () => Promise.resolve().then(() => (init_panoramax(), panoramax_exports)),
86537         "../services/plane_photo.js": () => Promise.resolve().then(() => (init_plane_photo(), plane_photo_exports)),
86538         "../services/streetside.js": () => Promise.resolve().then(() => (init_streetside(), streetside_exports)),
86539         "../services/taginfo.js": () => Promise.resolve().then(() => (init_taginfo(), taginfo_exports)),
86540         "../services/vector_tile.js": () => Promise.resolve().then(() => (init_vector_tile2(), vector_tile_exports)),
86541         "../services/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder(), vegbilder_exports)),
86542         "../services/wikidata.js": () => Promise.resolve().then(() => (init_wikidata(), wikidata_exports)),
86543         "../services/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia(), wikipedia_exports)),
86544         "../svg/areas.js": () => Promise.resolve().then(() => (init_areas(), areas_exports)),
86545         "../svg/data.js": () => Promise.resolve().then(() => (init_data2(), data_exports)),
86546         "../svg/debug.js": () => Promise.resolve().then(() => (init_debug(), debug_exports)),
86547         "../svg/defs.js": () => Promise.resolve().then(() => (init_defs(), defs_exports)),
86548         "../svg/geolocate.js": () => Promise.resolve().then(() => (init_geolocate(), geolocate_exports)),
86549         "../svg/helpers.js": () => Promise.resolve().then(() => (init_helpers(), helpers_exports)),
86550         "../svg/icon.js": () => Promise.resolve().then(() => (init_icon(), icon_exports)),
86551         "../svg/index.js": () => Promise.resolve().then(() => (init_svg(), svg_exports)),
86552         "../svg/kartaview_images.js": () => Promise.resolve().then(() => (init_kartaview_images(), kartaview_images_exports)),
86553         "../svg/keepRight.js": () => Promise.resolve().then(() => (init_keepRight2(), keepRight_exports2)),
86554         "../svg/labels.js": () => Promise.resolve().then(() => (init_labels(), labels_exports)),
86555         "../svg/layers.js": () => Promise.resolve().then(() => (init_layers(), layers_exports)),
86556         "../svg/lines.js": () => Promise.resolve().then(() => (init_lines(), lines_exports)),
86557         "../svg/local_photos.js": () => Promise.resolve().then(() => (init_local_photos(), local_photos_exports)),
86558         "../svg/mapilio_images.js": () => Promise.resolve().then(() => (init_mapilio_images(), mapilio_images_exports)),
86559         "../svg/mapillary_images.js": () => Promise.resolve().then(() => (init_mapillary_images(), mapillary_images_exports)),
86560         "../svg/mapillary_map_features.js": () => Promise.resolve().then(() => (init_mapillary_map_features(), mapillary_map_features_exports)),
86561         "../svg/mapillary_position.js": () => Promise.resolve().then(() => (init_mapillary_position(), mapillary_position_exports)),
86562         "../svg/mapillary_signs.js": () => Promise.resolve().then(() => (init_mapillary_signs(), mapillary_signs_exports)),
86563         "../svg/midpoints.js": () => Promise.resolve().then(() => (init_midpoints(), midpoints_exports)),
86564         "../svg/notes.js": () => Promise.resolve().then(() => (init_notes(), notes_exports)),
86565         "../svg/osm.js": () => Promise.resolve().then(() => (init_osm3(), osm_exports3)),
86566         "../svg/osmose.js": () => Promise.resolve().then(() => (init_osmose2(), osmose_exports2)),
86567         "../svg/panoramax_images.js": () => Promise.resolve().then(() => (init_panoramax_images(), panoramax_images_exports)),
86568         "../svg/points.js": () => Promise.resolve().then(() => (init_points(), points_exports)),
86569         "../svg/streetside.js": () => Promise.resolve().then(() => (init_streetside2(), streetside_exports2)),
86570         "../svg/tag_classes.js": () => Promise.resolve().then(() => (init_tag_classes(), tag_classes_exports)),
86571         "../svg/tag_pattern.js": () => Promise.resolve().then(() => (init_tag_pattern(), tag_pattern_exports)),
86572         "../svg/touch.js": () => Promise.resolve().then(() => (init_touch(), touch_exports)),
86573         "../svg/turns.js": () => Promise.resolve().then(() => (init_turns(), turns_exports)),
86574         "../svg/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder2(), vegbilder_exports2)),
86575         "../svg/vertices.js": () => Promise.resolve().then(() => (init_vertices(), vertices_exports)),
86576         "../ui/account.js": () => Promise.resolve().then(() => (init_account(), account_exports)),
86577         "../ui/attribution.js": () => Promise.resolve().then(() => (init_attribution(), attribution_exports)),
86578         "../ui/changeset_editor.js": () => Promise.resolve().then(() => (init_changeset_editor(), changeset_editor_exports)),
86579         "../ui/cmd.js": () => Promise.resolve().then(() => (init_cmd(), cmd_exports)),
86580         "../ui/combobox.js": () => Promise.resolve().then(() => (init_combobox(), combobox_exports)),
86581         "../ui/commit.js": () => Promise.resolve().then(() => (init_commit(), commit_exports)),
86582         "../ui/commit_warnings.js": () => Promise.resolve().then(() => (init_commit_warnings(), commit_warnings_exports)),
86583         "../ui/confirm.js": () => Promise.resolve().then(() => (init_confirm(), confirm_exports)),
86584         "../ui/conflicts.js": () => Promise.resolve().then(() => (init_conflicts(), conflicts_exports)),
86585         "../ui/contributors.js": () => Promise.resolve().then(() => (init_contributors(), contributors_exports)),
86586         "../ui/curtain.js": () => Promise.resolve().then(() => (init_curtain(), curtain_exports)),
86587         "../ui/data_editor.js": () => Promise.resolve().then(() => (init_data_editor(), data_editor_exports)),
86588         "../ui/data_header.js": () => Promise.resolve().then(() => (init_data_header(), data_header_exports)),
86589         "../ui/disclosure.js": () => Promise.resolve().then(() => (init_disclosure(), disclosure_exports)),
86590         "../ui/edit_menu.js": () => Promise.resolve().then(() => (init_edit_menu(), edit_menu_exports)),
86591         "../ui/entity_editor.js": () => Promise.resolve().then(() => (init_entity_editor(), entity_editor_exports)),
86592         "../ui/feature_info.js": () => Promise.resolve().then(() => (init_feature_info(), feature_info_exports)),
86593         "../ui/feature_list.js": () => Promise.resolve().then(() => (init_feature_list(), feature_list_exports)),
86594         "../ui/field.js": () => Promise.resolve().then(() => (init_field2(), field_exports2)),
86595         "../ui/field_help.js": () => Promise.resolve().then(() => (init_field_help(), field_help_exports)),
86596         "../ui/fields/access.js": () => Promise.resolve().then(() => (init_access(), access_exports)),
86597         "../ui/fields/address.js": () => Promise.resolve().then(() => (init_address(), address_exports)),
86598         "../ui/fields/check.js": () => Promise.resolve().then(() => (init_check(), check_exports)),
86599         "../ui/fields/combo.js": () => Promise.resolve().then(() => (init_combo(), combo_exports)),
86600         "../ui/fields/directional_combo.js": () => Promise.resolve().then(() => (init_directional_combo(), directional_combo_exports)),
86601         "../ui/fields/index.js": () => Promise.resolve().then(() => (init_fields(), fields_exports)),
86602         "../ui/fields/input.js": () => Promise.resolve().then(() => (init_input(), input_exports)),
86603         "../ui/fields/lanes.js": () => Promise.resolve().then(() => (init_lanes2(), lanes_exports2)),
86604         "../ui/fields/localized.js": () => Promise.resolve().then(() => (init_localized(), localized_exports)),
86605         "../ui/fields/radio.js": () => Promise.resolve().then(() => (init_radio(), radio_exports)),
86606         "../ui/fields/restrictions.js": () => Promise.resolve().then(() => (init_restrictions(), restrictions_exports)),
86607         "../ui/fields/roadheight.js": () => Promise.resolve().then(() => (init_roadheight(), roadheight_exports)),
86608         "../ui/fields/roadspeed.js": () => Promise.resolve().then(() => (init_roadspeed(), roadspeed_exports)),
86609         "../ui/fields/textarea.js": () => Promise.resolve().then(() => (init_textarea(), textarea_exports)),
86610         "../ui/fields/wikidata.js": () => Promise.resolve().then(() => (init_wikidata2(), wikidata_exports2)),
86611         "../ui/fields/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia2(), wikipedia_exports2)),
86612         "../ui/flash.js": () => Promise.resolve().then(() => (init_flash(), flash_exports)),
86613         "../ui/form_fields.js": () => Promise.resolve().then(() => (init_form_fields(), form_fields_exports)),
86614         "../ui/full_screen.js": () => Promise.resolve().then(() => (init_full_screen(), full_screen_exports)),
86615         "../ui/geolocate.js": () => Promise.resolve().then(() => (init_geolocate2(), geolocate_exports2)),
86616         "../ui/index.js": () => Promise.resolve().then(() => (init_ui(), ui_exports)),
86617         "../ui/info.js": () => Promise.resolve().then(() => (init_info(), info_exports)),
86618         "../ui/init.js": () => Promise.resolve().then(() => (init_init2(), init_exports)),
86619         "../ui/inspector.js": () => Promise.resolve().then(() => (init_inspector(), inspector_exports)),
86620         "../ui/intro/area.js": () => Promise.resolve().then(() => (init_area4(), area_exports)),
86621         "../ui/intro/building.js": () => Promise.resolve().then(() => (init_building(), building_exports)),
86622         "../ui/intro/helper.js": () => Promise.resolve().then(() => (init_helper(), helper_exports)),
86623         "../ui/intro/index.js": () => Promise.resolve().then(() => (init_intro2(), intro_exports2)),
86624         "../ui/intro/intro.js": () => Promise.resolve().then(() => (init_intro(), intro_exports)),
86625         "../ui/intro/line.js": () => Promise.resolve().then(() => (init_line2(), line_exports)),
86626         "../ui/intro/navigation.js": () => Promise.resolve().then(() => (init_navigation(), navigation_exports)),
86627         "../ui/intro/point.js": () => Promise.resolve().then(() => (init_point(), point_exports)),
86628         "../ui/intro/start_editing.js": () => Promise.resolve().then(() => (init_start_editing(), start_editing_exports)),
86629         "../ui/intro/welcome.js": () => Promise.resolve().then(() => (init_welcome(), welcome_exports)),
86630         "../ui/issues_info.js": () => Promise.resolve().then(() => (init_issues_info(), issues_info_exports)),
86631         "../ui/keepRight_details.js": () => Promise.resolve().then(() => (init_keepRight_details(), keepRight_details_exports)),
86632         "../ui/keepRight_editor.js": () => Promise.resolve().then(() => (init_keepRight_editor(), keepRight_editor_exports)),
86633         "../ui/keepRight_header.js": () => Promise.resolve().then(() => (init_keepRight_header(), keepRight_header_exports)),
86634         "../ui/lasso.js": () => Promise.resolve().then(() => (init_lasso(), lasso_exports)),
86635         "../ui/length_indicator.js": () => Promise.resolve().then(() => (init_length_indicator(), length_indicator_exports)),
86636         "../ui/loading.js": () => Promise.resolve().then(() => (init_loading(), loading_exports)),
86637         "../ui/map_in_map.js": () => Promise.resolve().then(() => (init_map_in_map(), map_in_map_exports)),
86638         "../ui/modal.js": () => Promise.resolve().then(() => (init_modal(), modal_exports)),
86639         "../ui/note_comments.js": () => Promise.resolve().then(() => (init_note_comments(), note_comments_exports)),
86640         "../ui/note_editor.js": () => Promise.resolve().then(() => (init_note_editor(), note_editor_exports)),
86641         "../ui/note_header.js": () => Promise.resolve().then(() => (init_note_header(), note_header_exports)),
86642         "../ui/note_report.js": () => Promise.resolve().then(() => (init_note_report(), note_report_exports)),
86643         "../ui/notice.js": () => Promise.resolve().then(() => (init_notice(), notice_exports)),
86644         "../ui/osmose_details.js": () => Promise.resolve().then(() => (init_osmose_details(), osmose_details_exports)),
86645         "../ui/osmose_editor.js": () => Promise.resolve().then(() => (init_osmose_editor(), osmose_editor_exports)),
86646         "../ui/osmose_header.js": () => Promise.resolve().then(() => (init_osmose_header(), osmose_header_exports)),
86647         "../ui/pane.js": () => Promise.resolve().then(() => (init_pane(), pane_exports)),
86648         "../ui/panels/background.js": () => Promise.resolve().then(() => (init_background(), background_exports)),
86649         "../ui/panels/history.js": () => Promise.resolve().then(() => (init_history2(), history_exports2)),
86650         "../ui/panels/index.js": () => Promise.resolve().then(() => (init_panels(), panels_exports)),
86651         "../ui/panels/location.js": () => Promise.resolve().then(() => (init_location(), location_exports)),
86652         "../ui/panels/measurement.js": () => Promise.resolve().then(() => (init_measurement(), measurement_exports)),
86653         "../ui/panes/background.js": () => Promise.resolve().then(() => (init_background3(), background_exports3)),
86654         "../ui/panes/help.js": () => Promise.resolve().then(() => (init_help(), help_exports)),
86655         "../ui/panes/index.js": () => Promise.resolve().then(() => (init_panes(), panes_exports)),
86656         "../ui/panes/issues.js": () => Promise.resolve().then(() => (init_issues(), issues_exports)),
86657         "../ui/panes/map_data.js": () => Promise.resolve().then(() => (init_map_data(), map_data_exports)),
86658         "../ui/panes/preferences.js": () => Promise.resolve().then(() => (init_preferences2(), preferences_exports2)),
86659         "../ui/photoviewer.js": () => Promise.resolve().then(() => (init_photoviewer(), photoviewer_exports)),
86660         "../ui/popover.js": () => Promise.resolve().then(() => (init_popover(), popover_exports)),
86661         "../ui/preset_icon.js": () => Promise.resolve().then(() => (init_preset_icon(), preset_icon_exports)),
86662         "../ui/preset_list.js": () => Promise.resolve().then(() => (init_preset_list(), preset_list_exports)),
86663         "../ui/restore.js": () => Promise.resolve().then(() => (init_restore(), restore_exports)),
86664         "../ui/scale.js": () => Promise.resolve().then(() => (init_scale2(), scale_exports2)),
86665         "../ui/section.js": () => Promise.resolve().then(() => (init_section(), section_exports)),
86666         "../ui/sections/background_display_options.js": () => Promise.resolve().then(() => (init_background_display_options(), background_display_options_exports)),
86667         "../ui/sections/background_list.js": () => Promise.resolve().then(() => (init_background_list(), background_list_exports)),
86668         "../ui/sections/background_offset.js": () => Promise.resolve().then(() => (init_background_offset(), background_offset_exports)),
86669         "../ui/sections/changes.js": () => Promise.resolve().then(() => (init_changes(), changes_exports)),
86670         "../ui/sections/data_layers.js": () => Promise.resolve().then(() => (init_data_layers(), data_layers_exports)),
86671         "../ui/sections/entity_issues.js": () => Promise.resolve().then(() => (init_entity_issues(), entity_issues_exports)),
86672         "../ui/sections/feature_type.js": () => Promise.resolve().then(() => (init_feature_type(), feature_type_exports)),
86673         "../ui/sections/index.js": () => Promise.resolve().then(() => (init_sections(), sections_exports)),
86674         "../ui/sections/map_features.js": () => Promise.resolve().then(() => (init_map_features(), map_features_exports)),
86675         "../ui/sections/map_style_options.js": () => Promise.resolve().then(() => (init_map_style_options(), map_style_options_exports)),
86676         "../ui/sections/overlay_list.js": () => Promise.resolve().then(() => (init_overlay_list(), overlay_list_exports)),
86677         "../ui/sections/photo_overlays.js": () => Promise.resolve().then(() => (init_photo_overlays(), photo_overlays_exports)),
86678         "../ui/sections/preset_fields.js": () => Promise.resolve().then(() => (init_preset_fields(), preset_fields_exports)),
86679         "../ui/sections/privacy.js": () => Promise.resolve().then(() => (init_privacy(), privacy_exports)),
86680         "../ui/sections/raw_member_editor.js": () => Promise.resolve().then(() => (init_raw_member_editor(), raw_member_editor_exports)),
86681         "../ui/sections/raw_membership_editor.js": () => Promise.resolve().then(() => (init_raw_membership_editor(), raw_membership_editor_exports)),
86682         "../ui/sections/raw_tag_editor.js": () => Promise.resolve().then(() => (init_raw_tag_editor(), raw_tag_editor_exports)),
86683         "../ui/sections/selection_list.js": () => Promise.resolve().then(() => (init_selection_list(), selection_list_exports)),
86684         "../ui/sections/validation_issues.js": () => Promise.resolve().then(() => (init_validation_issues(), validation_issues_exports)),
86685         "../ui/sections/validation_options.js": () => Promise.resolve().then(() => (init_validation_options(), validation_options_exports)),
86686         "../ui/sections/validation_rules.js": () => Promise.resolve().then(() => (init_validation_rules(), validation_rules_exports)),
86687         "../ui/sections/validation_status.js": () => Promise.resolve().then(() => (init_validation_status(), validation_status_exports)),
86688         "../ui/settings/custom_background.js": () => Promise.resolve().then(() => (init_custom_background(), custom_background_exports)),
86689         "../ui/settings/custom_data.js": () => Promise.resolve().then(() => (init_custom_data(), custom_data_exports)),
86690         "../ui/settings/index.js": () => Promise.resolve().then(() => (init_settings(), settings_exports)),
86691         "../ui/settings/local_photos.js": () => Promise.resolve().then(() => (init_local_photos2(), local_photos_exports2)),
86692         "../ui/shortcuts.js": () => Promise.resolve().then(() => (init_shortcuts(), shortcuts_exports)),
86693         "../ui/sidebar.js": () => Promise.resolve().then(() => (init_sidebar(), sidebar_exports)),
86694         "../ui/source_switch.js": () => Promise.resolve().then(() => (init_source_switch(), source_switch_exports)),
86695         "../ui/spinner.js": () => Promise.resolve().then(() => (init_spinner(), spinner_exports)),
86696         "../ui/splash.js": () => Promise.resolve().then(() => (init_splash(), splash_exports)),
86697         "../ui/status.js": () => Promise.resolve().then(() => (init_status(), status_exports)),
86698         "../ui/success.js": () => Promise.resolve().then(() => (init_success(), success_exports)),
86699         "../ui/tag_reference.js": () => Promise.resolve().then(() => (init_tag_reference(), tag_reference_exports)),
86700         "../ui/toggle.js": () => Promise.resolve().then(() => (init_toggle(), toggle_exports)),
86701         "../ui/tools/index.js": () => Promise.resolve().then(() => (init_tools(), tools_exports)),
86702         "../ui/tools/modes.js": () => Promise.resolve().then(() => (init_modes(), modes_exports)),
86703         "../ui/tools/notes.js": () => Promise.resolve().then(() => (init_notes2(), notes_exports2)),
86704         "../ui/tools/save.js": () => Promise.resolve().then(() => (init_save(), save_exports)),
86705         "../ui/tools/sidebar_toggle.js": () => Promise.resolve().then(() => (init_sidebar_toggle(), sidebar_toggle_exports)),
86706         "../ui/tools/undo_redo.js": () => Promise.resolve().then(() => (init_undo_redo(), undo_redo_exports)),
86707         "../ui/tooltip.js": () => Promise.resolve().then(() => (init_tooltip(), tooltip_exports)),
86708         "../ui/top_toolbar.js": () => Promise.resolve().then(() => (init_top_toolbar(), top_toolbar_exports)),
86709         "../ui/version.js": () => Promise.resolve().then(() => (init_version(), version_exports)),
86710         "../ui/view_on_keepRight.js": () => Promise.resolve().then(() => (init_view_on_keepRight(), view_on_keepRight_exports)),
86711         "../ui/view_on_osm.js": () => Promise.resolve().then(() => (init_view_on_osm(), view_on_osm_exports)),
86712         "../ui/view_on_osmose.js": () => Promise.resolve().then(() => (init_view_on_osmose(), view_on_osmose_exports)),
86713         "../ui/zoom.js": () => Promise.resolve().then(() => (init_zoom3(), zoom_exports)),
86714         "../ui/zoom_to_selection.js": () => Promise.resolve().then(() => (init_zoom_to_selection(), zoom_to_selection_exports)),
86715         "../util/IntervalTasksQueue.js": () => Promise.resolve().then(() => (init_IntervalTasksQueue(), IntervalTasksQueue_exports)),
86716         "../util/aes.js": () => Promise.resolve().then(() => (init_aes(), aes_exports)),
86717         "../util/array.js": () => Promise.resolve().then(() => (init_array3(), array_exports)),
86718         "../util/bind_once.js": () => Promise.resolve().then(() => (init_bind_once(), bind_once_exports)),
86719         "../util/clean_tags.js": () => Promise.resolve().then(() => (init_clean_tags(), clean_tags_exports)),
86720         "../util/detect.js": () => Promise.resolve().then(() => (init_detect(), detect_exports)),
86721         "../util/dimensions.js": () => Promise.resolve().then(() => (init_dimensions(), dimensions_exports)),
86722         "../util/double_up.js": () => Promise.resolve().then(() => (init_double_up(), double_up_exports)),
86723         "../util/get_set_value.js": () => Promise.resolve().then(() => (init_get_set_value(), get_set_value_exports)),
86724         "../util/index.js": () => Promise.resolve().then(() => (init_util(), util_exports)),
86725         "../util/jxon.js": () => Promise.resolve().then(() => (init_jxon(), jxon_exports)),
86726         "../util/keybinding.js": () => Promise.resolve().then(() => (init_keybinding(), keybinding_exports)),
86727         "../util/object.js": () => Promise.resolve().then(() => (init_object2(), object_exports)),
86728         "../util/rebind.js": () => Promise.resolve().then(() => (init_rebind(), rebind_exports)),
86729         "../util/session_mutex.js": () => Promise.resolve().then(() => (init_session_mutex(), session_mutex_exports)),
86730         "../util/svg_paths_rtl_fix.js": () => Promise.resolve().then(() => (init_svg_paths_rtl_fix(), svg_paths_rtl_fix_exports)),
86731         "../util/tiler.js": () => Promise.resolve().then(() => (init_tiler(), tiler_exports)),
86732         "../util/trigger_event.js": () => Promise.resolve().then(() => (init_trigger_event(), trigger_event_exports)),
86733         "../util/units.js": () => Promise.resolve().then(() => (init_units(), units_exports)),
86734         "../util/util.js": () => Promise.resolve().then(() => (init_util2(), util_exports2)),
86735         "../util/utilDisplayLabel.js": () => Promise.resolve().then(() => (init_utilDisplayLabel(), utilDisplayLabel_exports)),
86736         "../util/zoom_pan.js": () => Promise.resolve().then(() => (init_zoom_pan(), zoom_pan_exports)),
86737         "../validations/almost_junction.js": () => Promise.resolve().then(() => (init_almost_junction(), almost_junction_exports)),
86738         "../validations/close_nodes.js": () => Promise.resolve().then(() => (init_close_nodes(), close_nodes_exports)),
86739         "../validations/crossing_ways.js": () => Promise.resolve().then(() => (init_crossing_ways(), crossing_ways_exports)),
86740         "../validations/disconnected_way.js": () => Promise.resolve().then(() => (init_disconnected_way(), disconnected_way_exports)),
86741         "../validations/help_request.js": () => Promise.resolve().then(() => (init_help_request(), help_request_exports)),
86742         "../validations/impossible_oneway.js": () => Promise.resolve().then(() => (init_impossible_oneway(), impossible_oneway_exports)),
86743         "../validations/incompatible_source.js": () => Promise.resolve().then(() => (init_incompatible_source(), incompatible_source_exports)),
86744         "../validations/index.js": () => Promise.resolve().then(() => (init_validations(), validations_exports)),
86745         "../validations/invalid_format.js": () => Promise.resolve().then(() => (init_invalid_format(), invalid_format_exports)),
86746         "../validations/maprules.js": () => Promise.resolve().then(() => (init_maprules2(), maprules_exports2)),
86747         "../validations/mismatched_geometry.js": () => Promise.resolve().then(() => (init_mismatched_geometry(), mismatched_geometry_exports)),
86748         "../validations/missing_role.js": () => Promise.resolve().then(() => (init_missing_role(), missing_role_exports)),
86749         "../validations/missing_tag.js": () => Promise.resolve().then(() => (init_missing_tag(), missing_tag_exports)),
86750         "../validations/mutually_exclusive_tags.js": () => Promise.resolve().then(() => (init_mutually_exclusive_tags(), mutually_exclusive_tags_exports)),
86751         "../validations/osm_api_limits.js": () => Promise.resolve().then(() => (init_osm_api_limits(), osm_api_limits_exports)),
86752         "../validations/outdated_tags.js": () => Promise.resolve().then(() => (init_outdated_tags(), outdated_tags_exports)),
86753         "../validations/private_data.js": () => Promise.resolve().then(() => (init_private_data(), private_data_exports)),
86754         "../validations/suspicious_name.js": () => Promise.resolve().then(() => (init_suspicious_name(), suspicious_name_exports)),
86755         "../validations/unsquare_way.js": () => Promise.resolve().then(() => (init_unsquare_way(), unsquare_way_exports))
86756       });
86757     }
86758   });
86759
86760   // modules/core/file_fetcher.js
86761   var file_fetcher_exports = {};
86762   __export(file_fetcher_exports, {
86763     coreFileFetcher: () => coreFileFetcher,
86764     fileFetcher: () => _mainFileFetcher
86765   });
86766   function coreFileFetcher() {
86767     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
86768     const v3 = (0, import_vparse2.default)(ociVersion);
86769     const ociVersionMinor = `${v3.major}.${v3.minor}`;
86770     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
86771     let _this = {};
86772     let _inflight4 = {};
86773     let _fileMap = {
86774       "address_formats": "data/address_formats.min.json",
86775       "imagery": "data/imagery.min.json",
86776       "intro_graph": "data/intro_graph.min.json",
86777       "keepRight": "data/keepRight.min.json",
86778       "languages": "data/languages.min.json",
86779       "locales": "locales/index.min.json",
86780       "phone_formats": "data/phone_formats.min.json",
86781       "qa_data": "data/qa_data.min.json",
86782       "shortcuts": "data/shortcuts.min.json",
86783       "territory_languages": "data/territory_languages.min.json",
86784       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
86785       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
86786       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
86787       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
86788       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
86789       "discarded": presetsCdnUrl + "dist/discarded.min.json",
86790       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
86791       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
86792       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
86793       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
86794       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.2") + "data/wikipedia.min.json"
86795     };
86796     let _cachedData = {};
86797     _this.cache = () => _cachedData;
86798     _this.get = (which) => {
86799       if (_cachedData[which]) {
86800         return Promise.resolve(_cachedData[which]);
86801       }
86802       const file = _fileMap[which];
86803       const url = file && _this.asset(file);
86804       if (!url) {
86805         return Promise.reject(`Unknown data file for "${which}"`);
86806       }
86807       if (url.includes("{presets_version}")) {
86808         return _this.get("presets_package").then((result) => {
86809           const presetsVersion2 = result.version;
86810           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
86811         });
86812       } else {
86813         return getUrl(url, which);
86814       }
86815     };
86816     function getUrl(url, which) {
86817       let prom = _inflight4[url];
86818       if (!prom) {
86819         _inflight4[url] = prom = (window.VITEST ? globImport(`../${url}`) : fetch(url)).then((response) => {
86820           if (window.VITEST) return response.default;
86821           if (!response.ok || !response.json) {
86822             throw new Error(response.status + " " + response.statusText);
86823           }
86824           if (response.status === 204 || response.status === 205) return;
86825           return response.json();
86826         }).then((result) => {
86827           delete _inflight4[url];
86828           if (!result) {
86829             throw new Error(`No data loaded for "${which}"`);
86830           }
86831           _cachedData[which] = result;
86832           return result;
86833         }).catch((err) => {
86834           delete _inflight4[url];
86835           throw err;
86836         });
86837       }
86838       return prom;
86839     }
86840     _this.fileMap = function(val) {
86841       if (!arguments.length) return _fileMap;
86842       _fileMap = val;
86843       return _this;
86844     };
86845     let _assetPath = "";
86846     _this.assetPath = function(val) {
86847       if (!arguments.length) return _assetPath;
86848       _assetPath = val;
86849       return _this;
86850     };
86851     let _assetMap = {};
86852     _this.assetMap = function(val) {
86853       if (!arguments.length) return _assetMap;
86854       _assetMap = val;
86855       return _this;
86856     };
86857     _this.asset = (val) => {
86858       if (/^http(s)?:\/\//i.test(val)) return val;
86859       const filename = _assetPath + val;
86860       return _assetMap[filename] || filename;
86861     };
86862     return _this;
86863   }
86864   var import_vparse2, _mainFileFetcher;
86865   var init_file_fetcher = __esm({
86866     "modules/core/file_fetcher.js"() {
86867       "use strict";
86868       import_vparse2 = __toESM(require_vparse());
86869       init_id();
86870       init_package();
86871       init_();
86872       _mainFileFetcher = coreFileFetcher();
86873     }
86874   });
86875
86876   // modules/core/localizer.js
86877   var localizer_exports = {};
86878   __export(localizer_exports, {
86879     coreLocalizer: () => coreLocalizer,
86880     localizer: () => _mainLocalizer,
86881     t: () => _t
86882   });
86883   function coreLocalizer() {
86884     let localizer = {};
86885     let _dataLanguages = {};
86886     let _dataLocales = {};
86887     let _localeStrings = {};
86888     let _localeCode = "en-US";
86889     let _localeCodes = ["en-US", "en"];
86890     let _languageCode = "en";
86891     let _textDirection = "ltr";
86892     let _usesMetric = false;
86893     let _languageNames = {};
86894     let _scriptNames = {};
86895     localizer.localeCode = () => _localeCode;
86896     localizer.localeCodes = () => _localeCodes;
86897     localizer.languageCode = () => _languageCode;
86898     localizer.textDirection = () => _textDirection;
86899     localizer.usesMetric = () => _usesMetric;
86900     localizer.languageNames = () => _languageNames;
86901     localizer.scriptNames = () => _scriptNames;
86902     let _preferredLocaleCodes = [];
86903     localizer.preferredLocaleCodes = function(codes) {
86904       if (!arguments.length) return _preferredLocaleCodes;
86905       if (typeof codes === "string") {
86906         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
86907       } else {
86908         _preferredLocaleCodes = codes;
86909       }
86910       return localizer;
86911     };
86912     var _loadPromise;
86913     localizer.ensureLoaded = () => {
86914       if (_loadPromise) return _loadPromise;
86915       let filesToFetch = [
86916         "languages",
86917         // load the list of languages
86918         "locales"
86919         // load the list of supported locales
86920       ];
86921       const localeDirs = {
86922         general: "locales",
86923         tagging: presetsCdnUrl + "dist/translations"
86924       };
86925       let fileMap = _mainFileFetcher.fileMap();
86926       for (let scopeId in localeDirs) {
86927         const key = `locales_index_${scopeId}`;
86928         if (!fileMap[key]) {
86929           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
86930         }
86931         filesToFetch.push(key);
86932       }
86933       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
86934         _dataLanguages = results[0];
86935         _dataLocales = results[1];
86936         let indexes = results.slice(2);
86937         _localeCodes = localizer.localesToUseFrom(_dataLocales);
86938         _localeCode = _localeCodes[0];
86939         let loadStringsPromises = [];
86940         indexes.forEach((index, i3) => {
86941           const fullCoverageIndex = _localeCodes.findIndex(function(locale3) {
86942             return index[locale3] && index[locale3].pct === 1;
86943           });
86944           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
86945             let scopeId = Object.keys(localeDirs)[i3];
86946             let directory = Object.values(localeDirs)[i3];
86947             if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
86948           });
86949         });
86950         return Promise.all(loadStringsPromises);
86951       }).then(() => {
86952         updateForCurrentLocale();
86953       }).catch((err) => console.error(err));
86954     };
86955     localizer.localesToUseFrom = (supportedLocales) => {
86956       const requestedLocales = [
86957         ..._preferredLocaleCodes || [],
86958         ...utilDetect().browserLocales,
86959         // List of locales preferred by the browser in priority order.
86960         "en"
86961         // fallback to English since it's the only guaranteed complete language
86962       ];
86963       let toUse = [];
86964       for (const locale3 of requestedLocales) {
86965         if (supportedLocales[locale3]) toUse.push(locale3);
86966         if ("Intl" in window && "Locale" in window.Intl) {
86967           const localeObj = new Intl.Locale(locale3);
86968           const withoutScript = `${localeObj.language}-${localeObj.region}`;
86969           const base = localeObj.language;
86970           if (supportedLocales[withoutScript]) toUse.push(withoutScript);
86971           if (supportedLocales[base]) toUse.push(base);
86972         } else if (locale3.includes("-")) {
86973           let langPart = locale3.split("-")[0];
86974           if (supportedLocales[langPart]) toUse.push(langPart);
86975         }
86976       }
86977       return utilArrayUniq(toUse);
86978     };
86979     function updateForCurrentLocale() {
86980       if (!_localeCode) return;
86981       _languageCode = _localeCode.split("-")[0];
86982       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
86983       const hash2 = utilStringQs(window.location.hash);
86984       if (hash2.rtl === "true") {
86985         _textDirection = "rtl";
86986       } else if (hash2.rtl === "false") {
86987         _textDirection = "ltr";
86988       } else {
86989         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
86990       }
86991       let locale3 = _localeCode;
86992       if (locale3.toLowerCase() === "en-us") locale3 = "en";
86993       _languageNames = _localeStrings.general[locale3].languageNames || _localeStrings.general[_languageCode].languageNames;
86994       _scriptNames = _localeStrings.general[locale3].scriptNames || _localeStrings.general[_languageCode].scriptNames;
86995       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
86996     }
86997     localizer.loadLocale = (locale3, scopeId, directory) => {
86998       if (locale3.toLowerCase() === "en-us") locale3 = "en";
86999       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale3]) {
87000         return Promise.resolve(locale3);
87001       }
87002       let fileMap = _mainFileFetcher.fileMap();
87003       const key = `locale_${scopeId}_${locale3}`;
87004       if (!fileMap[key]) {
87005         fileMap[key] = `${directory}/${locale3}.min.json`;
87006       }
87007       return _mainFileFetcher.get(key).then((d2) => {
87008         if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
87009         _localeStrings[scopeId][locale3] = d2[locale3];
87010         return locale3;
87011       });
87012     };
87013     localizer.pluralRule = function(number3) {
87014       return pluralRule(number3, _localeCode);
87015     };
87016     function pluralRule(number3, localeCode) {
87017       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
87018       if (rules) {
87019         return rules.select(number3);
87020       }
87021       if (number3 === 1) return "one";
87022       return "other";
87023     }
87024     localizer.tInfo = function(origStringId, replacements, locale3) {
87025       let stringId = origStringId.trim();
87026       let scopeId = "general";
87027       if (stringId[0] === "_") {
87028         let split = stringId.split(".");
87029         scopeId = split[0].slice(1);
87030         stringId = split.slice(1).join(".");
87031       }
87032       locale3 = locale3 || _localeCode;
87033       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
87034       let stringsKey = locale3;
87035       if (stringsKey.toLowerCase() === "en-us") stringsKey = "en";
87036       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
87037       while (result !== void 0 && path.length) {
87038         result = result[path.pop()];
87039       }
87040       if (result !== void 0) {
87041         if (replacements) {
87042           if (typeof result === "object" && Object.keys(result).length) {
87043             const number3 = Object.values(replacements).find(function(value) {
87044               return typeof value === "number";
87045             });
87046             if (number3 !== void 0) {
87047               const rule = pluralRule(number3, locale3);
87048               if (result[rule]) {
87049                 result = result[rule];
87050               } else {
87051                 result = Object.values(result)[0];
87052               }
87053             }
87054           }
87055           if (typeof result === "string") {
87056             for (let key in replacements) {
87057               let value = replacements[key];
87058               if (typeof value === "number") {
87059                 if (value.toLocaleString) {
87060                   value = value.toLocaleString(locale3, {
87061                     style: "decimal",
87062                     useGrouping: true,
87063                     minimumFractionDigits: 0
87064                   });
87065                 } else {
87066                   value = value.toString();
87067                 }
87068               }
87069               const token = `{${key}}`;
87070               const regex = new RegExp(token, "g");
87071               result = result.replace(regex, value);
87072             }
87073           }
87074         }
87075         if (typeof result === "string") {
87076           return {
87077             text: result,
87078             locale: locale3
87079           };
87080         }
87081       }
87082       let index = _localeCodes.indexOf(locale3);
87083       if (index >= 0 && index < _localeCodes.length - 1) {
87084         let fallback = _localeCodes[index + 1];
87085         return localizer.tInfo(origStringId, replacements, fallback);
87086       }
87087       if (replacements && "default" in replacements) {
87088         return {
87089           text: replacements.default,
87090           locale: null
87091         };
87092       }
87093       const missing = `Missing ${locale3} translation: ${origStringId}`;
87094       if (typeof console !== "undefined") console.error(missing);
87095       return {
87096         text: missing,
87097         locale: "en"
87098       };
87099     };
87100     localizer.hasTextForStringId = function(stringId) {
87101       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
87102     };
87103     localizer.t = function(stringId, replacements, locale3) {
87104       return localizer.tInfo(stringId, replacements, locale3).text;
87105     };
87106     localizer.t.html = function(stringId, replacements, locale3) {
87107       replacements = Object.assign({}, replacements);
87108       for (var k3 in replacements) {
87109         if (typeof replacements[k3] === "string") {
87110           replacements[k3] = escape_default(replacements[k3]);
87111         }
87112         if (typeof replacements[k3] === "object" && typeof replacements[k3].html === "string") {
87113           replacements[k3] = replacements[k3].html;
87114         }
87115       }
87116       const info = localizer.tInfo(stringId, replacements, locale3);
87117       if (info.text) {
87118         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
87119       } else {
87120         return "";
87121       }
87122     };
87123     localizer.t.append = function(stringId, replacements, locale3) {
87124       const ret = function(selection2) {
87125         const info = localizer.tInfo(stringId, replacements, locale3);
87126         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
87127       };
87128       ret.stringId = stringId;
87129       return ret;
87130     };
87131     localizer.t.addOrUpdate = function(stringId, replacements, locale3) {
87132       const ret = function(selection2) {
87133         const info = localizer.tInfo(stringId, replacements, locale3);
87134         const span = selection2.selectAll("span.localized-text").data([info]);
87135         const enter = span.enter().append("span").classed("localized-text", true);
87136         span.merge(enter).attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
87137       };
87138       ret.stringId = stringId;
87139       return ret;
87140     };
87141     localizer.languageName = (code, options) => {
87142       if (_languageNames && _languageNames[code]) {
87143         return _languageNames[code];
87144       }
87145       if (options && options.localOnly) return null;
87146       const langInfo = _dataLanguages[code];
87147       if (langInfo) {
87148         if (langInfo.nativeName) {
87149           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
87150         } else if (langInfo.base && langInfo.script) {
87151           const base = langInfo.base;
87152           if (_languageNames && _languageNames[base]) {
87153             const scriptCode = langInfo.script;
87154             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
87155             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
87156           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
87157             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
87158           }
87159         }
87160       }
87161       return code;
87162     };
87163     localizer.floatFormatter = (locale3) => {
87164       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
87165         return (number3, fractionDigits) => {
87166           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
87167         };
87168       } else {
87169         return (number3, fractionDigits) => number3.toLocaleString(locale3, {
87170           minimumFractionDigits: fractionDigits,
87171           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
87172         });
87173       }
87174     };
87175     localizer.floatParser = (locale3) => {
87176       const polyfill = (string) => +string.trim();
87177       if (!("Intl" in window && "NumberFormat" in Intl)) return polyfill;
87178       const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
87179       if (!("formatToParts" in format2)) return polyfill;
87180       const parts = format2.formatToParts(-12345.6);
87181       const numerals = Array.from({ length: 10 }).map((_3, i3) => format2.format(i3));
87182       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
87183       const literalPart = parts.find((d2) => d2.type === "literal");
87184       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
87185       const groupPart = parts.find((d2) => d2.type === "group");
87186       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
87187       const decimalPart = parts.find((d2) => d2.type === "decimal");
87188       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
87189       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
87190       const getIndex = (d2) => index.get(d2);
87191       return (string) => {
87192         string = string.trim();
87193         if (literal) string = string.replace(literal, "");
87194         if (group) string = string.replace(group, "");
87195         if (decimal) string = string.replace(decimal, ".");
87196         string = string.replace(numeral, getIndex);
87197         return string ? +string : NaN;
87198       };
87199     };
87200     localizer.decimalPlaceCounter = (locale3) => {
87201       var literal, group, decimal;
87202       if ("Intl" in window && "NumberFormat" in Intl) {
87203         const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
87204         if ("formatToParts" in format2) {
87205           const parts = format2.formatToParts(-12345.6);
87206           const literalPart = parts.find((d2) => d2.type === "literal");
87207           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
87208           const groupPart = parts.find((d2) => d2.type === "group");
87209           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
87210           const decimalPart = parts.find((d2) => d2.type === "decimal");
87211           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
87212         }
87213       }
87214       return (string) => {
87215         string = string.trim();
87216         if (literal) string = string.replace(literal, "");
87217         if (group) string = string.replace(group, "");
87218         const parts = string.split(decimal || ".");
87219         return parts && parts[1] && parts[1].length || 0;
87220       };
87221     };
87222     return localizer;
87223   }
87224   var _mainLocalizer, _t;
87225   var init_localizer = __esm({
87226     "modules/core/localizer.js"() {
87227       "use strict";
87228       init_lodash();
87229       init_file_fetcher();
87230       init_detect();
87231       init_util();
87232       init_array3();
87233       init_id();
87234       _mainLocalizer = coreLocalizer();
87235       _t = _mainLocalizer.t;
87236     }
87237   });
87238
87239   // modules/util/util.js
87240   var util_exports2 = {};
87241   __export(util_exports2, {
87242     utilAsyncMap: () => utilAsyncMap,
87243     utilCleanOsmString: () => utilCleanOsmString,
87244     utilCombinedTags: () => utilCombinedTags,
87245     utilCompareIDs: () => utilCompareIDs,
87246     utilDeepMemberSelector: () => utilDeepMemberSelector,
87247     utilDisplayName: () => utilDisplayName,
87248     utilDisplayNameForPath: () => utilDisplayNameForPath,
87249     utilDisplayType: () => utilDisplayType,
87250     utilEditDistance: () => utilEditDistance,
87251     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
87252     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
87253     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
87254     utilEntityRoot: () => utilEntityRoot,
87255     utilEntitySelector: () => utilEntitySelector,
87256     utilFastMouse: () => utilFastMouse,
87257     utilFunctor: () => utilFunctor,
87258     utilGetAllNodes: () => utilGetAllNodes,
87259     utilHashcode: () => utilHashcode,
87260     utilHighlightEntities: () => utilHighlightEntities,
87261     utilNoAuto: () => utilNoAuto,
87262     utilOldestID: () => utilOldestID,
87263     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
87264     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
87265     utilQsString: () => utilQsString,
87266     utilSafeClassName: () => utilSafeClassName,
87267     utilSetTransform: () => utilSetTransform,
87268     utilStringQs: () => utilStringQs,
87269     utilTagDiff: () => utilTagDiff,
87270     utilTagText: () => utilTagText,
87271     utilTotalExtent: () => utilTotalExtent,
87272     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
87273     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
87274     utilUniqueDomId: () => utilUniqueDomId,
87275     utilWrap: () => utilWrap
87276   });
87277   function utilTagText(entity) {
87278     var obj = entity && entity.tags || {};
87279     return Object.keys(obj).map(function(k3) {
87280       return k3 + "=" + obj[k3];
87281     }).join(", ");
87282   }
87283   function utilTotalExtent(array2, graph) {
87284     var extent = geoExtent();
87285     var val, entity;
87286     for (var i3 = 0; i3 < array2.length; i3++) {
87287       val = array2[i3];
87288       entity = typeof val === "string" ? graph.hasEntity(val) : val;
87289       if (entity) {
87290         extent._extend(entity.extent(graph));
87291       }
87292     }
87293     return extent;
87294   }
87295   function utilTagDiff(oldTags, newTags) {
87296     var tagDiff = [];
87297     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
87298     keys2.forEach(function(k3) {
87299       var oldVal = oldTags[k3];
87300       var newVal = newTags[k3];
87301       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
87302         tagDiff.push({
87303           type: "-",
87304           key: k3,
87305           oldVal,
87306           newVal,
87307           display: "- " + k3 + "=" + oldVal
87308         });
87309       }
87310       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
87311         tagDiff.push({
87312           type: "+",
87313           key: k3,
87314           oldVal,
87315           newVal,
87316           display: "+ " + k3 + "=" + newVal
87317         });
87318       }
87319     });
87320     return tagDiff;
87321   }
87322   function utilEntitySelector(ids) {
87323     return ids.length ? "." + ids.join(",.") : "nothing";
87324   }
87325   function utilEntityOrMemberSelector(ids, graph) {
87326     var seen = new Set(ids);
87327     ids.forEach(collectShallowDescendants);
87328     return utilEntitySelector(Array.from(seen));
87329     function collectShallowDescendants(id2) {
87330       var entity = graph.hasEntity(id2);
87331       if (!entity || entity.type !== "relation") return;
87332       entity.members.map(function(member) {
87333         return member.id;
87334       }).forEach(function(id3) {
87335         seen.add(id3);
87336       });
87337     }
87338   }
87339   function utilEntityOrDeepMemberSelector(ids, graph) {
87340     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
87341   }
87342   function utilEntityAndDeepMemberIDs(ids, graph) {
87343     var seen = /* @__PURE__ */ new Set();
87344     ids.forEach(collectDeepDescendants);
87345     return Array.from(seen);
87346     function collectDeepDescendants(id2) {
87347       if (seen.has(id2)) return;
87348       seen.add(id2);
87349       var entity = graph.hasEntity(id2);
87350       if (!entity || entity.type !== "relation") return;
87351       entity.members.map(function(member) {
87352         return member.id;
87353       }).forEach(collectDeepDescendants);
87354     }
87355   }
87356   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
87357     var idsSet = new Set(ids);
87358     var seen = /* @__PURE__ */ new Set();
87359     var returners = /* @__PURE__ */ new Set();
87360     ids.forEach(collectDeepDescendants);
87361     return utilEntitySelector(Array.from(returners));
87362     function collectDeepDescendants(id2) {
87363       if (seen.has(id2)) return;
87364       seen.add(id2);
87365       if (!idsSet.has(id2)) {
87366         returners.add(id2);
87367       }
87368       var entity = graph.hasEntity(id2);
87369       if (!entity || entity.type !== "relation") return;
87370       if (skipMultipolgonMembers && entity.isMultipolygon()) return;
87371       entity.members.map(function(member) {
87372         return member.id;
87373       }).forEach(collectDeepDescendants);
87374     }
87375   }
87376   function utilHighlightEntities(ids, highlighted, context) {
87377     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
87378   }
87379   function utilGetAllNodes(ids, graph) {
87380     var seen = /* @__PURE__ */ new Set();
87381     var nodes = /* @__PURE__ */ new Set();
87382     ids.forEach(collectNodes);
87383     return Array.from(nodes);
87384     function collectNodes(id2) {
87385       if (seen.has(id2)) return;
87386       seen.add(id2);
87387       var entity = graph.hasEntity(id2);
87388       if (!entity) return;
87389       if (entity.type === "node") {
87390         nodes.add(entity);
87391       } else if (entity.type === "way") {
87392         entity.nodes.forEach(collectNodes);
87393       } else {
87394         entity.members.map(function(member) {
87395           return member.id;
87396         }).forEach(collectNodes);
87397       }
87398     }
87399   }
87400   function utilDisplayName(entity, hideNetwork) {
87401     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
87402     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
87403     var tags = {
87404       addr: entity.tags["addr:housenumber"] || entity.tags["addr:housename"],
87405       direction: entity.tags.direction,
87406       from: entity.tags.from,
87407       name,
87408       network: hideNetwork ? void 0 : entity.tags.cycle_network || entity.tags.network,
87409       ref: entity.tags.ref,
87410       to: entity.tags.to,
87411       via: entity.tags.via
87412     };
87413     if (entity.tags.route && entity.tags.name && entity.tags.name.match(/[→⇒↔⇔]|[-=]>/)) {
87414       return entity.tags.name;
87415     }
87416     if (!entity.tags.route && name) {
87417       return name;
87418     }
87419     if (tags.addr) {
87420       return tags.addr;
87421     }
87422     var keyComponents = [];
87423     if (tags.network) {
87424       keyComponents.push("network");
87425     }
87426     if (tags.ref) {
87427       keyComponents.push("ref");
87428     }
87429     if (tags.name) {
87430       keyComponents.push("name");
87431     }
87432     if (entity.tags.route) {
87433       if (tags.direction) {
87434         keyComponents.push("direction");
87435       } else if (tags.from && tags.to) {
87436         keyComponents.push("from");
87437         keyComponents.push("to");
87438         if (tags.via) {
87439           keyComponents.push("via");
87440         }
87441       }
87442     }
87443     if (keyComponents.length) {
87444       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
87445     }
87446     return name;
87447   }
87448   function utilDisplayNameForPath(entity) {
87449     var name = utilDisplayName(entity);
87450     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
87451     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
87452     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
87453       name = fixRTLTextForSvg(name);
87454     }
87455     return name;
87456   }
87457   function utilDisplayType(id2) {
87458     return {
87459       n: _t("inspector.node"),
87460       w: _t("inspector.way"),
87461       r: _t("inspector.relation")
87462     }[id2.charAt(0)];
87463   }
87464   function utilEntityRoot(entityType) {
87465     return {
87466       node: "n",
87467       way: "w",
87468       relation: "r"
87469     }[entityType];
87470   }
87471   function utilCombinedTags(entityIDs, graph) {
87472     var tags = {};
87473     var tagCounts = {};
87474     var allKeys = /* @__PURE__ */ new Set();
87475     var allTags = [];
87476     var entities = entityIDs.map(function(entityID) {
87477       return graph.hasEntity(entityID);
87478     }).filter(Boolean);
87479     entities.forEach(function(entity) {
87480       var keys2 = Object.keys(entity.tags).filter(Boolean);
87481       keys2.forEach(function(key2) {
87482         allKeys.add(key2);
87483       });
87484     });
87485     entities.forEach(function(entity) {
87486       allTags.push(entity.tags);
87487       allKeys.forEach(function(key2) {
87488         var value = entity.tags[key2];
87489         if (!tags.hasOwnProperty(key2)) {
87490           tags[key2] = value;
87491         } else {
87492           if (!Array.isArray(tags[key2])) {
87493             if (tags[key2] !== value) {
87494               tags[key2] = [tags[key2], value];
87495             }
87496           } else {
87497             if (tags[key2].indexOf(value) === -1) {
87498               tags[key2].push(value);
87499             }
87500           }
87501         }
87502         var tagHash = key2 + "=" + value;
87503         if (!tagCounts[tagHash]) tagCounts[tagHash] = 0;
87504         tagCounts[tagHash] += 1;
87505       });
87506     });
87507     for (var key in tags) {
87508       if (!Array.isArray(tags[key])) continue;
87509       tags[key] = tags[key].sort(function(val12, val2) {
87510         var key2 = key2;
87511         var count2 = tagCounts[key2 + "=" + val2];
87512         var count1 = tagCounts[key2 + "=" + val12];
87513         if (count2 !== count1) {
87514           return count2 - count1;
87515         }
87516         if (val2 && val12) {
87517           return val12.localeCompare(val2);
87518         }
87519         return val12 ? 1 : -1;
87520       });
87521     }
87522     tags = Object.defineProperty(tags, Symbol.for("allTags"), { enumerable: false, value: allTags });
87523     return tags;
87524   }
87525   function utilStringQs(str) {
87526     str = str.replace(/^[#?]{0,2}/, "");
87527     return Object.fromEntries(new URLSearchParams(str));
87528   }
87529   function utilQsString(obj, softEncode) {
87530     let str = new URLSearchParams(obj).toString();
87531     if (softEncode) {
87532       str = str.replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
87533     }
87534     return str;
87535   }
87536   function utilPrefixDOMProperty(property) {
87537     var prefixes2 = ["webkit", "ms", "moz", "o"];
87538     var i3 = -1;
87539     var n3 = prefixes2.length;
87540     var s2 = document.body;
87541     if (property in s2) return property;
87542     property = property.slice(0, 1).toUpperCase() + property.slice(1);
87543     while (++i3 < n3) {
87544       if (prefixes2[i3] + property in s2) {
87545         return prefixes2[i3] + property;
87546       }
87547     }
87548     return false;
87549   }
87550   function utilPrefixCSSProperty(property) {
87551     var prefixes2 = ["webkit", "ms", "Moz", "O"];
87552     var i3 = -1;
87553     var n3 = prefixes2.length;
87554     var s2 = document.body.style;
87555     if (property.toLowerCase() in s2) {
87556       return property.toLowerCase();
87557     }
87558     while (++i3 < n3) {
87559       if (prefixes2[i3] + property in s2) {
87560         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
87561       }
87562     }
87563     return false;
87564   }
87565   function utilSetTransform(el, x2, y2, scale) {
87566     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
87567     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
87568     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
87569   }
87570   function utilEditDistance(a4, b3) {
87571     a4 = (0, import_diacritics3.remove)(a4.toLowerCase());
87572     b3 = (0, import_diacritics3.remove)(b3.toLowerCase());
87573     if (a4.length === 0) return b3.length;
87574     if (b3.length === 0) return a4.length;
87575     var matrix = [];
87576     var i3, j3;
87577     for (i3 = 0; i3 <= b3.length; i3++) {
87578       matrix[i3] = [i3];
87579     }
87580     for (j3 = 0; j3 <= a4.length; j3++) {
87581       matrix[0][j3] = j3;
87582     }
87583     for (i3 = 1; i3 <= b3.length; i3++) {
87584       for (j3 = 1; j3 <= a4.length; j3++) {
87585         if (b3.charAt(i3 - 1) === a4.charAt(j3 - 1)) {
87586           matrix[i3][j3] = matrix[i3 - 1][j3 - 1];
87587         } else {
87588           matrix[i3][j3] = Math.min(
87589             matrix[i3 - 1][j3 - 1] + 1,
87590             // substitution
87591             Math.min(
87592               matrix[i3][j3 - 1] + 1,
87593               // insertion
87594               matrix[i3 - 1][j3] + 1
87595             )
87596           );
87597         }
87598       }
87599     }
87600     return matrix[b3.length][a4.length];
87601   }
87602   function utilFastMouse(container) {
87603     var rect = container.getBoundingClientRect();
87604     var rectLeft = rect.left;
87605     var rectTop = rect.top;
87606     var clientLeft = +container.clientLeft;
87607     var clientTop = +container.clientTop;
87608     return function(e3) {
87609       return [
87610         e3.clientX - rectLeft - clientLeft,
87611         e3.clientY - rectTop - clientTop
87612       ];
87613     };
87614   }
87615   function utilAsyncMap(inputs, func, callback) {
87616     var remaining = inputs.length;
87617     var results = [];
87618     var errors = [];
87619     inputs.forEach(function(d2, i3) {
87620       func(d2, function done(err, data) {
87621         errors[i3] = err;
87622         results[i3] = data;
87623         remaining--;
87624         if (!remaining) callback(errors, results);
87625       });
87626     });
87627   }
87628   function utilWrap(index, length2) {
87629     if (index < 0) {
87630       index += Math.ceil(-index / length2) * length2;
87631     }
87632     return index % length2;
87633   }
87634   function utilFunctor(value) {
87635     if (typeof value === "function") return value;
87636     return function() {
87637       return value;
87638     };
87639   }
87640   function utilNoAuto(selection2) {
87641     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
87642     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");
87643   }
87644   function utilHashcode(str) {
87645     var hash2 = 0;
87646     if (str.length === 0) {
87647       return hash2;
87648     }
87649     for (var i3 = 0; i3 < str.length; i3++) {
87650       var char = str.charCodeAt(i3);
87651       hash2 = (hash2 << 5) - hash2 + char;
87652       hash2 = hash2 & hash2;
87653     }
87654     return hash2;
87655   }
87656   function utilSafeClassName(str) {
87657     return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
87658   }
87659   function utilUniqueDomId(val) {
87660     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
87661   }
87662   function utilUnicodeCharsCount(str) {
87663     return Array.from(str).length;
87664   }
87665   function utilUnicodeCharsTruncated(str, limit) {
87666     return Array.from(str).slice(0, limit).join("");
87667   }
87668   function toNumericID(id2) {
87669     var match = id2.match(/^[cnwr](-?\d+)$/);
87670     if (match) {
87671       return parseInt(match[1], 10);
87672     }
87673     return NaN;
87674   }
87675   function compareNumericIDs(left, right) {
87676     if (isNaN(left) && isNaN(right)) return -1;
87677     if (isNaN(left)) return 1;
87678     if (isNaN(right)) return -1;
87679     if (Math.sign(left) !== Math.sign(right)) return -Math.sign(left);
87680     if (Math.sign(left) < 0) return Math.sign(right - left);
87681     return Math.sign(left - right);
87682   }
87683   function utilCompareIDs(left, right) {
87684     return compareNumericIDs(toNumericID(left), toNumericID(right));
87685   }
87686   function utilOldestID(ids) {
87687     if (ids.length === 0) {
87688       return void 0;
87689     }
87690     var oldestIDIndex = 0;
87691     var oldestID = toNumericID(ids[0]);
87692     for (var i3 = 1; i3 < ids.length; i3++) {
87693       var num = toNumericID(ids[i3]);
87694       if (compareNumericIDs(oldestID, num) === 1) {
87695         oldestIDIndex = i3;
87696         oldestID = num;
87697       }
87698     }
87699     return ids[oldestIDIndex];
87700   }
87701   function utilCleanOsmString(val, maxChars) {
87702     if (val === void 0 || val === null) {
87703       val = "";
87704     } else {
87705       val = val.toString();
87706     }
87707     val = val.trim();
87708     if (val.normalize) val = val.normalize("NFC");
87709     return utilUnicodeCharsTruncated(val, maxChars);
87710   }
87711   var import_diacritics3, transformProperty;
87712   var init_util2 = __esm({
87713     "modules/util/util.js"() {
87714       "use strict";
87715       import_diacritics3 = __toESM(require_diacritics());
87716       init_svg_paths_rtl_fix();
87717       init_localizer();
87718       init_array3();
87719       init_detect();
87720       init_extent();
87721     }
87722   });
87723
87724   // modules/osm/entity.js
87725   var entity_exports = {};
87726   __export(entity_exports, {
87727     osmEntity: () => osmEntity
87728   });
87729   function osmEntity(attrs) {
87730     if (this instanceof osmEntity) return;
87731     if (attrs && attrs.type) {
87732       return osmEntity[attrs.type].apply(this, arguments);
87733     } else if (attrs && attrs.id) {
87734       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
87735     }
87736     return new osmEntity().initialize(arguments);
87737   }
87738   var init_entity = __esm({
87739     "modules/osm/entity.js"() {
87740       "use strict";
87741       init_index();
87742       init_tags();
87743       init_array3();
87744       init_util2();
87745       osmEntity.id = function(type2) {
87746         return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
87747       };
87748       osmEntity.id.next = {
87749         changeset: -1,
87750         node: -1,
87751         way: -1,
87752         relation: -1
87753       };
87754       osmEntity.id.fromOSM = function(type2, id2) {
87755         return type2[0] + id2;
87756       };
87757       osmEntity.id.toOSM = function(id2) {
87758         var match = id2.match(/^[cnwr](-?\d+)$/);
87759         if (match) {
87760           return match[1];
87761         }
87762         return "";
87763       };
87764       osmEntity.id.type = function(id2) {
87765         return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
87766       };
87767       osmEntity.key = function(entity) {
87768         return entity.id + "v" + (entity.v || 0);
87769       };
87770       osmEntity.prototype = {
87771         /** @type {Tags} */
87772         tags: {},
87773         /** @type {String} */
87774         id: void 0,
87775         initialize: function(sources) {
87776           for (var i3 = 0; i3 < sources.length; ++i3) {
87777             var source = sources[i3];
87778             for (var prop in source) {
87779               if (Object.prototype.hasOwnProperty.call(source, prop)) {
87780                 if (source[prop] === void 0) {
87781                   delete this[prop];
87782                 } else {
87783                   this[prop] = source[prop];
87784                 }
87785               }
87786             }
87787           }
87788           if (!this.id && this.type) {
87789             this.id = osmEntity.id(this.type);
87790           }
87791           if (!this.hasOwnProperty("visible")) {
87792             this.visible = true;
87793           }
87794           if (debug) {
87795             Object.freeze(this);
87796             Object.freeze(this.tags);
87797             if (this.loc) Object.freeze(this.loc);
87798             if (this.nodes) Object.freeze(this.nodes);
87799             if (this.members) Object.freeze(this.members);
87800           }
87801           return this;
87802         },
87803         copy: function(resolver, copies) {
87804           if (copies[this.id]) return copies[this.id];
87805           var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
87806           copies[this.id] = copy2;
87807           return copy2;
87808         },
87809         osmId: function() {
87810           return osmEntity.id.toOSM(this.id);
87811         },
87812         isNew: function() {
87813           var osmId = osmEntity.id.toOSM(this.id);
87814           return osmId.length === 0 || osmId[0] === "-";
87815         },
87816         update: function(attrs) {
87817           return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
87818         },
87819         /**
87820          *
87821          * @param {Tags} tags tags to merge into this entity's tags
87822          * @param {Tags} setTags (optional) a set of tags to overwrite in this entity's tags
87823          * @returns {iD.OsmEntity}
87824          */
87825         mergeTags: function(tags, setTags = {}) {
87826           const merged = Object.assign({}, this.tags);
87827           let changed = false;
87828           for (const k3 in tags) {
87829             if (setTags.hasOwnProperty(k3)) continue;
87830             const t12 = this.tags[k3];
87831             const t2 = tags[k3];
87832             if (!t12) {
87833               changed = true;
87834               merged[k3] = t2;
87835             } else if (t12 !== t2) {
87836               changed = true;
87837               merged[k3] = utilUnicodeCharsTruncated(
87838                 utilArrayUnion(t12.split(/;\s*/), t2.split(/;\s*/)).join(";"),
87839                 255
87840                 // avoid exceeding character limit; see also context.maxCharsForTagValue()
87841               );
87842             }
87843           }
87844           for (const k3 in setTags) {
87845             if (this.tags[k3] !== setTags[k3]) {
87846               changed = true;
87847               merged[k3] = setTags[k3];
87848             }
87849           }
87850           return changed ? this.update({ tags: merged }) : this;
87851         },
87852         intersects: function(extent, resolver) {
87853           return this.extent(resolver).intersects(extent);
87854         },
87855         hasNonGeometryTags: function() {
87856           return Object.keys(this.tags).some(function(k3) {
87857             return k3 !== "area";
87858           });
87859         },
87860         hasParentRelations: function(resolver) {
87861           return resolver.parentRelations(this).length > 0;
87862         },
87863         hasInterestingTags: function() {
87864           return Object.keys(this.tags).some(osmIsInterestingTag);
87865         },
87866         isDegenerate: function() {
87867           return true;
87868         }
87869       };
87870     }
87871   });
87872
87873   // modules/osm/way.js
87874   var way_exports = {};
87875   __export(way_exports, {
87876     osmWay: () => osmWay
87877   });
87878   function osmWay() {
87879     if (!(this instanceof osmWay)) {
87880       return new osmWay().initialize(arguments);
87881     } else if (arguments.length) {
87882       this.initialize(arguments);
87883     }
87884   }
87885   function noRepeatNodes(node, i3, arr) {
87886     return i3 === 0 || node !== arr[i3 - 1];
87887   }
87888   var prototype3;
87889   var init_way = __esm({
87890     "modules/osm/way.js"() {
87891       "use strict";
87892       init_src2();
87893       init_geo2();
87894       init_entity();
87895       init_lanes();
87896       init_tags();
87897       init_util();
87898       osmEntity.way = osmWay;
87899       osmWay.prototype = Object.create(osmEntity.prototype);
87900       prototype3 = {
87901         type: "way",
87902         nodes: [],
87903         copy: function(resolver, copies) {
87904           if (copies[this.id]) return copies[this.id];
87905           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
87906           var nodes = this.nodes.map(function(id2) {
87907             return resolver.entity(id2).copy(resolver, copies).id;
87908           });
87909           copy2 = copy2.update({ nodes });
87910           copies[this.id] = copy2;
87911           return copy2;
87912         },
87913         extent: function(resolver) {
87914           return resolver.transient(this, "extent", function() {
87915             var extent = geoExtent();
87916             for (var i3 = 0; i3 < this.nodes.length; i3++) {
87917               var node = resolver.hasEntity(this.nodes[i3]);
87918               if (node) {
87919                 extent._extend(node.extent());
87920               }
87921             }
87922             return extent;
87923           });
87924         },
87925         first: function() {
87926           return this.nodes[0];
87927         },
87928         last: function() {
87929           return this.nodes[this.nodes.length - 1];
87930         },
87931         contains: function(node) {
87932           return this.nodes.indexOf(node) >= 0;
87933         },
87934         affix: function(node) {
87935           if (this.nodes[0] === node) return "prefix";
87936           if (this.nodes[this.nodes.length - 1] === node) return "suffix";
87937         },
87938         layer: function() {
87939           if (isFinite(this.tags.layer)) {
87940             return Math.max(-10, Math.min(+this.tags.layer, 10));
87941           }
87942           if (this.tags.covered === "yes") return -1;
87943           if (this.tags.location === "overground") return 1;
87944           if (this.tags.location === "underground") return -1;
87945           if (this.tags.location === "underwater") return -10;
87946           if (this.tags.power === "line") return 10;
87947           if (this.tags.power === "minor_line") return 10;
87948           if (this.tags.aerialway) return 10;
87949           if (this.tags.bridge) return 1;
87950           if (this.tags.cutting) return -1;
87951           if (this.tags.tunnel) return -1;
87952           if (this.tags.waterway) return -1;
87953           if (this.tags.man_made === "pipeline") return -10;
87954           if (this.tags.boundary) return -10;
87955           return 0;
87956         },
87957         // the approximate width of the line based on its tags except its `width` tag
87958         impliedLineWidthMeters: function() {
87959           var averageWidths = {
87960             highway: {
87961               // width is for single lane
87962               motorway: 5,
87963               motorway_link: 5,
87964               trunk: 4.5,
87965               trunk_link: 4.5,
87966               primary: 4,
87967               secondary: 4,
87968               tertiary: 4,
87969               primary_link: 4,
87970               secondary_link: 4,
87971               tertiary_link: 4,
87972               unclassified: 4,
87973               road: 4,
87974               living_street: 4,
87975               bus_guideway: 4,
87976               busway: 4,
87977               pedestrian: 4,
87978               residential: 3.5,
87979               service: 3.5,
87980               track: 3,
87981               cycleway: 2.5,
87982               bridleway: 2,
87983               corridor: 2,
87984               steps: 2,
87985               path: 1.5,
87986               footway: 1.5,
87987               ladder: 0.5
87988             },
87989             railway: {
87990               // width includes ties and rail bed, not just track gauge
87991               rail: 2.5,
87992               light_rail: 2.5,
87993               tram: 2.5,
87994               subway: 2.5,
87995               monorail: 2.5,
87996               funicular: 2.5,
87997               disused: 2.5,
87998               preserved: 2.5,
87999               miniature: 1.5,
88000               narrow_gauge: 1.5
88001             },
88002             waterway: {
88003               river: 50,
88004               canal: 25,
88005               stream: 5,
88006               tidal_channel: 5,
88007               fish_pass: 2.5,
88008               drain: 2.5,
88009               ditch: 1.5
88010             }
88011           };
88012           for (var key in averageWidths) {
88013             if (this.tags[key] && averageWidths[key][this.tags[key]]) {
88014               var width = averageWidths[key][this.tags[key]];
88015               if (key === "highway") {
88016                 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
88017                 if (!laneCount) laneCount = this.isOneWay() ? 1 : 2;
88018                 return width * laneCount;
88019               }
88020               return width;
88021             }
88022           }
88023           return null;
88024         },
88025         /** @returns {boolean} for example, if `oneway=yes` */
88026         isOneWayForwards() {
88027           if (this.tags.oneway === "no") return false;
88028           return !!utilCheckTagDictionary(this.tags, osmOneWayForwardTags);
88029         },
88030         /** @returns {boolean} for example, if `oneway=-1` */
88031         isOneWayBackwards() {
88032           if (this.tags.oneway === "no") return false;
88033           return !!utilCheckTagDictionary(this.tags, osmOneWayBackwardTags);
88034         },
88035         /** @returns {boolean} for example, if `oneway=alternating` */
88036         isBiDirectional() {
88037           if (this.tags.oneway === "no") return false;
88038           return !!utilCheckTagDictionary(this.tags, osmOneWayBiDirectionalTags);
88039         },
88040         /** @returns {boolean} */
88041         isOneWay() {
88042           if (this.tags.oneway === "no") return false;
88043           return !!utilCheckTagDictionary(this.tags, osmOneWayTags);
88044         },
88045         // Some identifier for tag that implies that this way is "sided",
88046         // i.e. the right side is the 'inside' (e.g. the right side of a
88047         // natural=cliff is lower).
88048         sidednessIdentifier: function() {
88049           for (const realKey in this.tags) {
88050             const value = this.tags[realKey];
88051             const key = osmRemoveLifecyclePrefix(realKey);
88052             if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
88053               if (osmRightSideIsInsideTags[key][value] === true) {
88054                 return key;
88055               } else {
88056                 return osmRightSideIsInsideTags[key][value];
88057               }
88058             }
88059           }
88060           return null;
88061         },
88062         isSided: function() {
88063           if (this.tags.two_sided === "yes") {
88064             return false;
88065           }
88066           return this.sidednessIdentifier() !== null;
88067         },
88068         lanes: function() {
88069           return osmLanes(this);
88070         },
88071         isClosed: function() {
88072           return this.nodes.length > 1 && this.first() === this.last();
88073         },
88074         isConvex: function(resolver) {
88075           if (!this.isClosed() || this.isDegenerate()) return null;
88076           var nodes = utilArrayUniq(resolver.childNodes(this));
88077           var coords = nodes.map(function(n3) {
88078             return n3.loc;
88079           });
88080           var curr = 0;
88081           var prev = 0;
88082           for (var i3 = 0; i3 < coords.length; i3++) {
88083             var o2 = coords[(i3 + 1) % coords.length];
88084             var a4 = coords[i3];
88085             var b3 = coords[(i3 + 2) % coords.length];
88086             var res = geoVecCross(a4, b3, o2);
88087             curr = res > 0 ? 1 : res < 0 ? -1 : 0;
88088             if (curr === 0) {
88089               continue;
88090             } else if (prev && curr !== prev) {
88091               return false;
88092             }
88093             prev = curr;
88094           }
88095           return true;
88096         },
88097         // returns an object with the tag that implies this is an area, if any
88098         tagSuggestingArea: function() {
88099           return osmTagSuggestingArea(this.tags);
88100         },
88101         isArea: function() {
88102           if (this.tags.area === "yes") return true;
88103           if (!this.isClosed() || this.tags.area === "no") return false;
88104           return this.tagSuggestingArea() !== null;
88105         },
88106         isDegenerate: function() {
88107           return new Set(this.nodes).size < (this.isClosed() ? 3 : 2);
88108         },
88109         areAdjacent: function(n1, n22) {
88110           for (var i3 = 0; i3 < this.nodes.length; i3++) {
88111             if (this.nodes[i3] === n1) {
88112               if (this.nodes[i3 - 1] === n22) return true;
88113               if (this.nodes[i3 + 1] === n22) return true;
88114             }
88115           }
88116           return false;
88117         },
88118         geometry: function(graph) {
88119           return graph.transient(this, "geometry", function() {
88120             return this.isArea() ? "area" : "line";
88121           });
88122         },
88123         // returns an array of objects representing the segments between the nodes in this way
88124         segments: function(graph) {
88125           function segmentExtent(graph2) {
88126             var n1 = graph2.hasEntity(this.nodes[0]);
88127             var n22 = graph2.hasEntity(this.nodes[1]);
88128             return n1 && n22 && geoExtent([
88129               [
88130                 Math.min(n1.loc[0], n22.loc[0]),
88131                 Math.min(n1.loc[1], n22.loc[1])
88132               ],
88133               [
88134                 Math.max(n1.loc[0], n22.loc[0]),
88135                 Math.max(n1.loc[1], n22.loc[1])
88136               ]
88137             ]);
88138           }
88139           return graph.transient(this, "segments", function() {
88140             var segments = [];
88141             for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
88142               segments.push({
88143                 id: this.id + "-" + i3,
88144                 wayId: this.id,
88145                 index: i3,
88146                 nodes: [this.nodes[i3], this.nodes[i3 + 1]],
88147                 extent: segmentExtent
88148               });
88149             }
88150             return segments;
88151           });
88152         },
88153         // If this way is not closed, append the beginning node to the end of the nodelist to close it.
88154         close: function() {
88155           if (this.isClosed() || !this.nodes.length) return this;
88156           var nodes = this.nodes.slice();
88157           nodes = nodes.filter(noRepeatNodes);
88158           nodes.push(nodes[0]);
88159           return this.update({ nodes });
88160         },
88161         // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
88162         unclose: function() {
88163           if (!this.isClosed()) return this;
88164           var nodes = this.nodes.slice();
88165           var connector = this.first();
88166           var i3 = nodes.length - 1;
88167           while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88168             nodes.splice(i3, 1);
88169             i3 = nodes.length - 1;
88170           }
88171           nodes = nodes.filter(noRepeatNodes);
88172           return this.update({ nodes });
88173         },
88174         // Adds a node (id) in front of the node which is currently at position index.
88175         // If index is undefined, the node will be added to the end of the way for linear ways,
88176         //   or just before the final connecting node for circular ways.
88177         // Consecutive duplicates are eliminated including existing ones.
88178         // Circularity is always preserved when adding a node.
88179         addNode: function(id2, index) {
88180           var nodes = this.nodes.slice();
88181           var isClosed = this.isClosed();
88182           var max3 = isClosed ? nodes.length - 1 : nodes.length;
88183           if (index === void 0) {
88184             index = max3;
88185           }
88186           if (index < 0 || index > max3) {
88187             throw new RangeError("index " + index + " out of range 0.." + max3);
88188           }
88189           if (isClosed) {
88190             var connector = this.first();
88191             var i3 = 1;
88192             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
88193               nodes.splice(i3, 1);
88194               if (index > i3) index--;
88195             }
88196             i3 = nodes.length - 1;
88197             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88198               nodes.splice(i3, 1);
88199               if (index > i3) index--;
88200               i3 = nodes.length - 1;
88201             }
88202           }
88203           nodes.splice(index, 0, id2);
88204           nodes = nodes.filter(noRepeatNodes);
88205           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88206             nodes.push(nodes[0]);
88207           }
88208           return this.update({ nodes });
88209         },
88210         // Replaces the node which is currently at position index with the given node (id).
88211         // Consecutive duplicates are eliminated including existing ones.
88212         // Circularity is preserved when updating a node.
88213         updateNode: function(id2, index) {
88214           var nodes = this.nodes.slice();
88215           var isClosed = this.isClosed();
88216           var max3 = nodes.length - 1;
88217           if (index === void 0 || index < 0 || index > max3) {
88218             throw new RangeError("index " + index + " out of range 0.." + max3);
88219           }
88220           if (isClosed) {
88221             var connector = this.first();
88222             var i3 = 1;
88223             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
88224               nodes.splice(i3, 1);
88225               if (index > i3) index--;
88226             }
88227             i3 = nodes.length - 1;
88228             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88229               nodes.splice(i3, 1);
88230               if (index === i3) index = 0;
88231               i3 = nodes.length - 1;
88232             }
88233           }
88234           nodes.splice(index, 1, id2);
88235           nodes = nodes.filter(noRepeatNodes);
88236           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88237             nodes.push(nodes[0]);
88238           }
88239           return this.update({ nodes });
88240         },
88241         // Replaces each occurrence of node id needle with replacement.
88242         // Consecutive duplicates are eliminated including existing ones.
88243         // Circularity is preserved.
88244         replaceNode: function(needleID, replacementID) {
88245           var nodes = this.nodes.slice();
88246           var isClosed = this.isClosed();
88247           for (var i3 = 0; i3 < nodes.length; i3++) {
88248             if (nodes[i3] === needleID) {
88249               nodes[i3] = replacementID;
88250             }
88251           }
88252           nodes = nodes.filter(noRepeatNodes);
88253           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88254             nodes.push(nodes[0]);
88255           }
88256           return this.update({ nodes });
88257         },
88258         // Removes each occurrence of node id.
88259         // Consecutive duplicates are eliminated including existing ones.
88260         // Circularity is preserved.
88261         removeNode: function(id2) {
88262           var nodes = this.nodes.slice();
88263           var isClosed = this.isClosed();
88264           nodes = nodes.filter(function(node) {
88265             return node !== id2;
88266           }).filter(noRepeatNodes);
88267           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88268             nodes.push(nodes[0]);
88269           }
88270           return this.update({ nodes });
88271         },
88272         asJXON: function(changeset_id) {
88273           var r2 = {
88274             way: {
88275               "@id": this.osmId(),
88276               "@version": this.version || 0,
88277               nd: this.nodes.map(function(id2) {
88278                 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
88279               }, this),
88280               tag: Object.keys(this.tags).map(function(k3) {
88281                 return { keyAttributes: { k: k3, v: this.tags[k3] } };
88282               }, this)
88283             }
88284           };
88285           if (changeset_id) {
88286             r2.way["@changeset"] = changeset_id;
88287           }
88288           return r2;
88289         },
88290         asGeoJSON: function(resolver) {
88291           return resolver.transient(this, "GeoJSON", function() {
88292             var coordinates = resolver.childNodes(this).map(function(n3) {
88293               return n3.loc;
88294             });
88295             if (this.isArea() && this.isClosed()) {
88296               return {
88297                 type: "Polygon",
88298                 coordinates: [coordinates]
88299               };
88300             } else {
88301               return {
88302                 type: "LineString",
88303                 coordinates
88304               };
88305             }
88306           });
88307         },
88308         area: function(resolver) {
88309           return resolver.transient(this, "area", function() {
88310             var nodes = resolver.childNodes(this);
88311             var json = {
88312               type: "Polygon",
88313               coordinates: [nodes.map(function(n3) {
88314                 return n3.loc;
88315               })]
88316             };
88317             if (!this.isClosed() && nodes.length) {
88318               json.coordinates[0].push(nodes[0].loc);
88319             }
88320             var area = area_default(json);
88321             if (area > 2 * Math.PI) {
88322               json.coordinates[0] = json.coordinates[0].reverse();
88323               area = area_default(json);
88324             }
88325             return isNaN(area) ? 0 : area;
88326           });
88327         }
88328       };
88329       Object.assign(osmWay.prototype, prototype3);
88330     }
88331   });
88332
88333   // modules/osm/multipolygon.js
88334   var multipolygon_exports = {};
88335   __export(multipolygon_exports, {
88336     osmJoinWays: () => osmJoinWays
88337   });
88338   function osmJoinWays(toJoin, graph) {
88339     function resolve(member) {
88340       return graph.childNodes(graph.entity(member.id));
88341     }
88342     function reverse(item2) {
88343       var action = actionReverse(item2.id, { reverseOneway: true });
88344       sequences.actions.push(action);
88345       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
88346     }
88347     toJoin = toJoin.filter(function(member) {
88348       return member.type === "way" && graph.hasEntity(member.id);
88349     });
88350     var i3;
88351     var joinAsMembers = true;
88352     for (i3 = 0; i3 < toJoin.length; i3++) {
88353       if (toJoin[i3] instanceof osmWay) {
88354         joinAsMembers = false;
88355         break;
88356       }
88357     }
88358     var sequences = [];
88359     sequences.actions = [];
88360     while (toJoin.length) {
88361       var item = toJoin.shift();
88362       var currWays = [item];
88363       var currNodes = resolve(item).slice();
88364       while (toJoin.length) {
88365         var start2 = currNodes[0];
88366         var end = currNodes[currNodes.length - 1];
88367         var fn = null;
88368         var nodes = null;
88369         for (i3 = 0; i3 < toJoin.length; i3++) {
88370           item = toJoin[i3];
88371           nodes = resolve(item);
88372           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
88373             currWays[0] = reverse(currWays[0]);
88374             currNodes.reverse();
88375             start2 = currNodes[0];
88376             end = currNodes[currNodes.length - 1];
88377           }
88378           if (nodes[0] === end) {
88379             fn = currNodes.push;
88380             nodes = nodes.slice(1);
88381             break;
88382           } else if (nodes[nodes.length - 1] === end) {
88383             fn = currNodes.push;
88384             nodes = nodes.slice(0, -1).reverse();
88385             item = reverse(item);
88386             break;
88387           } else if (nodes[nodes.length - 1] === start2) {
88388             fn = currNodes.unshift;
88389             nodes = nodes.slice(0, -1);
88390             break;
88391           } else if (nodes[0] === start2) {
88392             fn = currNodes.unshift;
88393             nodes = nodes.slice(1).reverse();
88394             item = reverse(item);
88395             break;
88396           } else {
88397             fn = nodes = null;
88398           }
88399         }
88400         if (!nodes) {
88401           break;
88402         }
88403         fn.apply(currWays, [item]);
88404         fn.apply(currNodes, nodes);
88405         toJoin.splice(i3, 1);
88406       }
88407       currWays.nodes = currNodes;
88408       sequences.push(currWays);
88409     }
88410     return sequences;
88411   }
88412   var init_multipolygon = __esm({
88413     "modules/osm/multipolygon.js"() {
88414       "use strict";
88415       init_reverse();
88416       init_way();
88417     }
88418   });
88419
88420   // modules/actions/add_member.js
88421   var add_member_exports = {};
88422   __export(add_member_exports, {
88423     actionAddMember: () => actionAddMember
88424   });
88425   function actionAddMember(relationId, member, memberIndex) {
88426     return function action(graph) {
88427       var relation = graph.entity(relationId);
88428       var isPTv2 = /stop|platform/.test(member.role);
88429       if (member.type === "way" && !isPTv2) {
88430         graph = addWayMember(relation, graph);
88431       } else {
88432         if (isPTv2 && isNaN(memberIndex)) {
88433           memberIndex = 0;
88434         }
88435         graph = graph.replace(relation.addMember(member, memberIndex));
88436       }
88437       return graph;
88438     };
88439     function addWayMember(relation, graph) {
88440       var groups, item, i3, j3, k3;
88441       var PTv2members = [];
88442       var members = [];
88443       for (i3 = 0; i3 < relation.members.length; i3++) {
88444         var m3 = relation.members[i3];
88445         if (/stop|platform/.test(m3.role)) {
88446           PTv2members.push(m3);
88447         } else {
88448           members.push(m3);
88449         }
88450       }
88451       relation = relation.update({ members });
88452       groups = utilArrayGroupBy(relation.members, "type");
88453       groups.way = groups.way || [];
88454       groups.way.push(member);
88455       members = withIndex(groups.way);
88456       var joined = osmJoinWays(members, graph);
88457       for (i3 = 0; i3 < joined.length; i3++) {
88458         var segment = joined[i3];
88459         var nodes = segment.nodes.slice();
88460         var startIndex = segment[0].index;
88461         for (j3 = 0; j3 < members.length; j3++) {
88462           if (members[j3].index === startIndex) {
88463             break;
88464           }
88465         }
88466         for (k3 = 0; k3 < segment.length; k3++) {
88467           item = segment[k3];
88468           var way = graph.entity(item.id);
88469           if (k3 > 0) {
88470             if (j3 + k3 >= members.length || item.index !== members[j3 + k3].index) {
88471               moveMember(members, item.index, j3 + k3);
88472             }
88473           }
88474           nodes.splice(0, way.nodes.length - 1);
88475         }
88476       }
88477       var wayMembers = [];
88478       for (i3 = 0; i3 < members.length; i3++) {
88479         item = members[i3];
88480         if (item.index === -1) continue;
88481         wayMembers.push(utilObjectOmit(item, ["index"]));
88482       }
88483       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
88484       return graph.replace(relation.update({ members: newMembers }));
88485       function moveMember(arr, findIndex, toIndex) {
88486         var i4;
88487         for (i4 = 0; i4 < arr.length; i4++) {
88488           if (arr[i4].index === findIndex) {
88489             break;
88490           }
88491         }
88492         var item2 = Object.assign({}, arr[i4]);
88493         arr[i4].index = -1;
88494         delete item2.index;
88495         arr.splice(toIndex, 0, item2);
88496       }
88497       function withIndex(arr) {
88498         var result = new Array(arr.length);
88499         for (var i4 = 0; i4 < arr.length; i4++) {
88500           result[i4] = Object.assign({}, arr[i4]);
88501           result[i4].index = i4;
88502         }
88503         return result;
88504       }
88505     }
88506   }
88507   var init_add_member = __esm({
88508     "modules/actions/add_member.js"() {
88509       "use strict";
88510       init_multipolygon();
88511       init_util();
88512     }
88513   });
88514
88515   // modules/actions/index.js
88516   var actions_exports = {};
88517   __export(actions_exports, {
88518     actionAddEntity: () => actionAddEntity,
88519     actionAddMember: () => actionAddMember,
88520     actionAddMidpoint: () => actionAddMidpoint,
88521     actionAddVertex: () => actionAddVertex,
88522     actionChangeMember: () => actionChangeMember,
88523     actionChangePreset: () => actionChangePreset,
88524     actionChangeTags: () => actionChangeTags,
88525     actionCircularize: () => actionCircularize,
88526     actionConnect: () => actionConnect,
88527     actionCopyEntities: () => actionCopyEntities,
88528     actionDeleteMember: () => actionDeleteMember,
88529     actionDeleteMultiple: () => actionDeleteMultiple,
88530     actionDeleteNode: () => actionDeleteNode,
88531     actionDeleteRelation: () => actionDeleteRelation,
88532     actionDeleteWay: () => actionDeleteWay,
88533     actionDiscardTags: () => actionDiscardTags,
88534     actionDisconnect: () => actionDisconnect,
88535     actionExtract: () => actionExtract,
88536     actionJoin: () => actionJoin,
88537     actionMerge: () => actionMerge,
88538     actionMergeNodes: () => actionMergeNodes,
88539     actionMergePolygon: () => actionMergePolygon,
88540     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
88541     actionMove: () => actionMove,
88542     actionMoveMember: () => actionMoveMember,
88543     actionMoveNode: () => actionMoveNode,
88544     actionNoop: () => actionNoop,
88545     actionOrthogonalize: () => actionOrthogonalize,
88546     actionReflect: () => actionReflect,
88547     actionRestrictTurn: () => actionRestrictTurn,
88548     actionReverse: () => actionReverse,
88549     actionRevert: () => actionRevert,
88550     actionRotate: () => actionRotate,
88551     actionScale: () => actionScale,
88552     actionSplit: () => actionSplit,
88553     actionStraightenNodes: () => actionStraightenNodes,
88554     actionStraightenWay: () => actionStraightenWay,
88555     actionUnrestrictTurn: () => actionUnrestrictTurn,
88556     actionUpgradeTags: () => actionUpgradeTags
88557   });
88558   var init_actions = __esm({
88559     "modules/actions/index.js"() {
88560       "use strict";
88561       init_add_entity();
88562       init_add_member();
88563       init_add_midpoint();
88564       init_add_vertex();
88565       init_change_member();
88566       init_change_preset();
88567       init_change_tags();
88568       init_circularize();
88569       init_connect();
88570       init_copy_entities();
88571       init_delete_member();
88572       init_delete_multiple();
88573       init_delete_node();
88574       init_delete_relation();
88575       init_delete_way();
88576       init_discard_tags();
88577       init_disconnect();
88578       init_extract();
88579       init_join2();
88580       init_merge5();
88581       init_merge_nodes();
88582       init_merge_polygon();
88583       init_merge_remote_changes();
88584       init_move();
88585       init_move_member();
88586       init_move_node();
88587       init_noop2();
88588       init_orthogonalize();
88589       init_restrict_turn();
88590       init_reverse();
88591       init_revert();
88592       init_rotate();
88593       init_scale();
88594       init_split();
88595       init_straighten_nodes();
88596       init_straighten_way();
88597       init_unrestrict_turn();
88598       init_reflect();
88599       init_upgrade_tags();
88600     }
88601   });
88602
88603   // modules/index.js
88604   var index_exports = {};
88605   __export(index_exports, {
88606     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
88607     LocationManager: () => LocationManager,
88608     QAItem: () => QAItem,
88609     actionAddEntity: () => actionAddEntity,
88610     actionAddMember: () => actionAddMember,
88611     actionAddMidpoint: () => actionAddMidpoint,
88612     actionAddVertex: () => actionAddVertex,
88613     actionChangeMember: () => actionChangeMember,
88614     actionChangePreset: () => actionChangePreset,
88615     actionChangeTags: () => actionChangeTags,
88616     actionCircularize: () => actionCircularize,
88617     actionConnect: () => actionConnect,
88618     actionCopyEntities: () => actionCopyEntities,
88619     actionDeleteMember: () => actionDeleteMember,
88620     actionDeleteMultiple: () => actionDeleteMultiple,
88621     actionDeleteNode: () => actionDeleteNode,
88622     actionDeleteRelation: () => actionDeleteRelation,
88623     actionDeleteWay: () => actionDeleteWay,
88624     actionDiscardTags: () => actionDiscardTags,
88625     actionDisconnect: () => actionDisconnect,
88626     actionExtract: () => actionExtract,
88627     actionJoin: () => actionJoin,
88628     actionMerge: () => actionMerge,
88629     actionMergeNodes: () => actionMergeNodes,
88630     actionMergePolygon: () => actionMergePolygon,
88631     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
88632     actionMove: () => actionMove,
88633     actionMoveMember: () => actionMoveMember,
88634     actionMoveNode: () => actionMoveNode,
88635     actionNoop: () => actionNoop,
88636     actionOrthogonalize: () => actionOrthogonalize,
88637     actionReflect: () => actionReflect,
88638     actionRestrictTurn: () => actionRestrictTurn,
88639     actionReverse: () => actionReverse,
88640     actionRevert: () => actionRevert,
88641     actionRotate: () => actionRotate,
88642     actionScale: () => actionScale,
88643     actionSplit: () => actionSplit,
88644     actionStraightenNodes: () => actionStraightenNodes,
88645     actionStraightenWay: () => actionStraightenWay,
88646     actionUnrestrictTurn: () => actionUnrestrictTurn,
88647     actionUpgradeTags: () => actionUpgradeTags,
88648     behaviorAddWay: () => behaviorAddWay,
88649     behaviorBreathe: () => behaviorBreathe,
88650     behaviorDrag: () => behaviorDrag,
88651     behaviorDraw: () => behaviorDraw,
88652     behaviorDrawWay: () => behaviorDrawWay,
88653     behaviorEdit: () => behaviorEdit,
88654     behaviorHash: () => behaviorHash,
88655     behaviorHover: () => behaviorHover,
88656     behaviorLasso: () => behaviorLasso,
88657     behaviorOperation: () => behaviorOperation,
88658     behaviorPaste: () => behaviorPaste,
88659     behaviorSelect: () => behaviorSelect,
88660     coreContext: () => coreContext,
88661     coreDifference: () => coreDifference,
88662     coreFileFetcher: () => coreFileFetcher,
88663     coreGraph: () => coreGraph,
88664     coreHistory: () => coreHistory,
88665     coreLocalizer: () => coreLocalizer,
88666     coreTree: () => coreTree,
88667     coreUploader: () => coreUploader,
88668     coreValidator: () => coreValidator,
88669     d3: () => d3,
88670     debug: () => debug,
88671     dmsCoordinatePair: () => dmsCoordinatePair,
88672     dmsMatcher: () => dmsMatcher,
88673     fileFetcher: () => _mainFileFetcher,
88674     geoAngle: () => geoAngle,
88675     geoChooseEdge: () => geoChooseEdge,
88676     geoEdgeEqual: () => geoEdgeEqual,
88677     geoExtent: () => geoExtent,
88678     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
88679     geoHasLineIntersections: () => geoHasLineIntersections,
88680     geoHasSelfIntersections: () => geoHasSelfIntersections,
88681     geoLatToMeters: () => geoLatToMeters,
88682     geoLineIntersection: () => geoLineIntersection,
88683     geoLonToMeters: () => geoLonToMeters,
88684     geoMetersToLat: () => geoMetersToLat,
88685     geoMetersToLon: () => geoMetersToLon,
88686     geoMetersToOffset: () => geoMetersToOffset,
88687     geoOffsetToMeters: () => geoOffsetToMeters,
88688     geoOrthoCalcScore: () => geoOrthoCalcScore,
88689     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
88690     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
88691     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
88692     geoPathHasIntersections: () => geoPathHasIntersections,
88693     geoPathIntersections: () => geoPathIntersections,
88694     geoPathLength: () => geoPathLength,
88695     geoPointInPolygon: () => geoPointInPolygon,
88696     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
88697     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
88698     geoRawMercator: () => geoRawMercator,
88699     geoRotate: () => geoRotate,
88700     geoScaleToZoom: () => geoScaleToZoom,
88701     geoSphericalClosestNode: () => geoSphericalClosestNode,
88702     geoSphericalDistance: () => geoSphericalDistance,
88703     geoVecAdd: () => geoVecAdd,
88704     geoVecAngle: () => geoVecAngle,
88705     geoVecCross: () => geoVecCross,
88706     geoVecDot: () => geoVecDot,
88707     geoVecEqual: () => geoVecEqual,
88708     geoVecFloor: () => geoVecFloor,
88709     geoVecInterp: () => geoVecInterp,
88710     geoVecLength: () => geoVecLength,
88711     geoVecLengthSquare: () => geoVecLengthSquare,
88712     geoVecNormalize: () => geoVecNormalize,
88713     geoVecNormalizedDot: () => geoVecNormalizedDot,
88714     geoVecProject: () => geoVecProject,
88715     geoVecScale: () => geoVecScale,
88716     geoVecSubtract: () => geoVecSubtract,
88717     geoViewportEdge: () => geoViewportEdge,
88718     geoZoomToScale: () => geoZoomToScale,
88719     likelyRawNumberFormat: () => likelyRawNumberFormat,
88720     localizer: () => _mainLocalizer,
88721     locationManager: () => _sharedLocationManager,
88722     modeAddArea: () => modeAddArea,
88723     modeAddLine: () => modeAddLine,
88724     modeAddNote: () => modeAddNote,
88725     modeAddPoint: () => modeAddPoint,
88726     modeBrowse: () => modeBrowse,
88727     modeDragNode: () => modeDragNode,
88728     modeDragNote: () => modeDragNote,
88729     modeDrawArea: () => modeDrawArea,
88730     modeDrawLine: () => modeDrawLine,
88731     modeMove: () => modeMove,
88732     modeRotate: () => modeRotate,
88733     modeSave: () => modeSave,
88734     modeSelect: () => modeSelect,
88735     modeSelectData: () => modeSelectData,
88736     modeSelectError: () => modeSelectError,
88737     modeSelectNote: () => modeSelectNote,
88738     operationCircularize: () => operationCircularize,
88739     operationContinue: () => operationContinue,
88740     operationCopy: () => operationCopy,
88741     operationDelete: () => operationDelete,
88742     operationDisconnect: () => operationDisconnect,
88743     operationDowngrade: () => operationDowngrade,
88744     operationExtract: () => operationExtract,
88745     operationMerge: () => operationMerge,
88746     operationMove: () => operationMove,
88747     operationOrthogonalize: () => operationOrthogonalize,
88748     operationPaste: () => operationPaste,
88749     operationReflectLong: () => operationReflectLong,
88750     operationReflectShort: () => operationReflectShort,
88751     operationReverse: () => operationReverse,
88752     operationRotate: () => operationRotate,
88753     operationSplit: () => operationSplit,
88754     operationStraighten: () => operationStraighten,
88755     osmAreaKeys: () => osmAreaKeys,
88756     osmChangeset: () => osmChangeset,
88757     osmEntity: () => osmEntity,
88758     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
88759     osmInferRestriction: () => osmInferRestriction,
88760     osmIntersection: () => osmIntersection,
88761     osmIsInterestingTag: () => osmIsInterestingTag,
88762     osmJoinWays: () => osmJoinWays,
88763     osmLanes: () => osmLanes,
88764     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
88765     osmNode: () => osmNode,
88766     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
88767     osmNote: () => osmNote,
88768     osmPavedTags: () => osmPavedTags,
88769     osmPointTags: () => osmPointTags,
88770     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
88771     osmRelation: () => osmRelation,
88772     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
88773     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
88774     osmSetAreaKeys: () => osmSetAreaKeys,
88775     osmSetPointTags: () => osmSetPointTags,
88776     osmSetVertexTags: () => osmSetVertexTags,
88777     osmTagSuggestingArea: () => osmTagSuggestingArea,
88778     osmTurn: () => osmTurn,
88779     osmVertexTags: () => osmVertexTags,
88780     osmWay: () => osmWay,
88781     prefs: () => corePreferences,
88782     presetCategory: () => presetCategory,
88783     presetCollection: () => presetCollection,
88784     presetField: () => presetField,
88785     presetIndex: () => presetIndex,
88786     presetManager: () => _mainPresetIndex,
88787     presetPreset: () => presetPreset,
88788     rendererBackground: () => rendererBackground,
88789     rendererBackgroundSource: () => rendererBackgroundSource,
88790     rendererFeatures: () => rendererFeatures,
88791     rendererMap: () => rendererMap,
88792     rendererPhotos: () => rendererPhotos,
88793     rendererTileLayer: () => rendererTileLayer,
88794     serviceKartaview: () => kartaview_default,
88795     serviceKeepRight: () => keepRight_default,
88796     serviceMapRules: () => maprules_default,
88797     serviceMapilio: () => mapilio_default,
88798     serviceMapillary: () => mapillary_default,
88799     serviceNominatim: () => nominatim_default,
88800     serviceNsi: () => nsi_default,
88801     serviceOsm: () => osm_default,
88802     serviceOsmWikibase: () => osm_wikibase_default,
88803     serviceOsmose: () => osmose_default,
88804     servicePanoramax: () => panoramax_default,
88805     serviceStreetside: () => streetside_default,
88806     serviceTaginfo: () => taginfo_default,
88807     serviceVectorTile: () => vector_tile_default,
88808     serviceVegbilder: () => vegbilder_default,
88809     serviceWikidata: () => wikidata_default,
88810     serviceWikipedia: () => wikipedia_default,
88811     services: () => services,
88812     setDebug: () => setDebug,
88813     svgAreas: () => svgAreas,
88814     svgData: () => svgData,
88815     svgDebug: () => svgDebug,
88816     svgDefs: () => svgDefs,
88817     svgGeolocate: () => svgGeolocate,
88818     svgIcon: () => svgIcon,
88819     svgKartaviewImages: () => svgKartaviewImages,
88820     svgKeepRight: () => svgKeepRight,
88821     svgLabels: () => svgLabels,
88822     svgLayers: () => svgLayers,
88823     svgLines: () => svgLines,
88824     svgMapilioImages: () => svgMapilioImages,
88825     svgMapillaryImages: () => svgMapillaryImages,
88826     svgMapillarySigns: () => svgMapillarySigns,
88827     svgMarkerSegments: () => svgMarkerSegments,
88828     svgMidpoints: () => svgMidpoints,
88829     svgNotes: () => svgNotes,
88830     svgOsm: () => svgOsm,
88831     svgPanoramaxImages: () => svgPanoramaxImages,
88832     svgPassiveVertex: () => svgPassiveVertex,
88833     svgPath: () => svgPath,
88834     svgPointTransform: () => svgPointTransform,
88835     svgPoints: () => svgPoints,
88836     svgRelationMemberTags: () => svgRelationMemberTags,
88837     svgSegmentWay: () => svgSegmentWay,
88838     svgStreetside: () => svgStreetside,
88839     svgTagClasses: () => svgTagClasses,
88840     svgTagPattern: () => svgTagPattern,
88841     svgTouch: () => svgTouch,
88842     svgTurns: () => svgTurns,
88843     svgVegbilder: () => svgVegbilder,
88844     svgVertices: () => svgVertices,
88845     t: () => _t,
88846     uiAccount: () => uiAccount,
88847     uiAttribution: () => uiAttribution,
88848     uiChangesetEditor: () => uiChangesetEditor,
88849     uiCmd: () => uiCmd,
88850     uiCombobox: () => uiCombobox,
88851     uiCommit: () => uiCommit,
88852     uiCommitWarnings: () => uiCommitWarnings,
88853     uiConfirm: () => uiConfirm,
88854     uiConflicts: () => uiConflicts,
88855     uiContributors: () => uiContributors,
88856     uiCurtain: () => uiCurtain,
88857     uiDataEditor: () => uiDataEditor,
88858     uiDataHeader: () => uiDataHeader,
88859     uiDisclosure: () => uiDisclosure,
88860     uiEditMenu: () => uiEditMenu,
88861     uiEntityEditor: () => uiEntityEditor,
88862     uiFeatureInfo: () => uiFeatureInfo,
88863     uiFeatureList: () => uiFeatureList,
88864     uiField: () => uiField,
88865     uiFieldAccess: () => uiFieldAccess,
88866     uiFieldAddress: () => uiFieldAddress,
88867     uiFieldCheck: () => uiFieldCheck,
88868     uiFieldColour: () => uiFieldText,
88869     uiFieldCombo: () => uiFieldCombo,
88870     uiFieldDefaultCheck: () => uiFieldCheck,
88871     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
88872     uiFieldEmail: () => uiFieldText,
88873     uiFieldHelp: () => uiFieldHelp,
88874     uiFieldIdentifier: () => uiFieldText,
88875     uiFieldLanes: () => uiFieldLanes,
88876     uiFieldLocalized: () => uiFieldLocalized,
88877     uiFieldManyCombo: () => uiFieldCombo,
88878     uiFieldMultiCombo: () => uiFieldCombo,
88879     uiFieldNetworkCombo: () => uiFieldCombo,
88880     uiFieldNumber: () => uiFieldText,
88881     uiFieldOnewayCheck: () => uiFieldCheck,
88882     uiFieldRadio: () => uiFieldRadio,
88883     uiFieldRestrictions: () => uiFieldRestrictions,
88884     uiFieldRoadheight: () => uiFieldRoadheight,
88885     uiFieldRoadspeed: () => uiFieldRoadspeed,
88886     uiFieldSemiCombo: () => uiFieldCombo,
88887     uiFieldStructureRadio: () => uiFieldRadio,
88888     uiFieldTel: () => uiFieldText,
88889     uiFieldText: () => uiFieldText,
88890     uiFieldTextarea: () => uiFieldTextarea,
88891     uiFieldTypeCombo: () => uiFieldCombo,
88892     uiFieldUrl: () => uiFieldText,
88893     uiFieldWikidata: () => uiFieldWikidata,
88894     uiFieldWikipedia: () => uiFieldWikipedia,
88895     uiFields: () => uiFields,
88896     uiFlash: () => uiFlash,
88897     uiFormFields: () => uiFormFields,
88898     uiFullScreen: () => uiFullScreen,
88899     uiGeolocate: () => uiGeolocate,
88900     uiInfo: () => uiInfo,
88901     uiInfoPanels: () => uiInfoPanels,
88902     uiInit: () => uiInit,
88903     uiInspector: () => uiInspector,
88904     uiIntro: () => uiIntro,
88905     uiIssuesInfo: () => uiIssuesInfo,
88906     uiKeepRightDetails: () => uiKeepRightDetails,
88907     uiKeepRightEditor: () => uiKeepRightEditor,
88908     uiKeepRightHeader: () => uiKeepRightHeader,
88909     uiLasso: () => uiLasso,
88910     uiLengthIndicator: () => uiLengthIndicator,
88911     uiLoading: () => uiLoading,
88912     uiMapInMap: () => uiMapInMap,
88913     uiModal: () => uiModal,
88914     uiNoteComments: () => uiNoteComments,
88915     uiNoteEditor: () => uiNoteEditor,
88916     uiNoteHeader: () => uiNoteHeader,
88917     uiNoteReport: () => uiNoteReport,
88918     uiNotice: () => uiNotice,
88919     uiPaneBackground: () => uiPaneBackground,
88920     uiPaneHelp: () => uiPaneHelp,
88921     uiPaneIssues: () => uiPaneIssues,
88922     uiPaneMapData: () => uiPaneMapData,
88923     uiPanePreferences: () => uiPanePreferences,
88924     uiPanelBackground: () => uiPanelBackground,
88925     uiPanelHistory: () => uiPanelHistory,
88926     uiPanelLocation: () => uiPanelLocation,
88927     uiPanelMeasurement: () => uiPanelMeasurement,
88928     uiPopover: () => uiPopover,
88929     uiPresetIcon: () => uiPresetIcon,
88930     uiPresetList: () => uiPresetList,
88931     uiRestore: () => uiRestore,
88932     uiScale: () => uiScale,
88933     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
88934     uiSectionBackgroundList: () => uiSectionBackgroundList,
88935     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
88936     uiSectionChanges: () => uiSectionChanges,
88937     uiSectionDataLayers: () => uiSectionDataLayers,
88938     uiSectionEntityIssues: () => uiSectionEntityIssues,
88939     uiSectionFeatureType: () => uiSectionFeatureType,
88940     uiSectionMapFeatures: () => uiSectionMapFeatures,
88941     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
88942     uiSectionOverlayList: () => uiSectionOverlayList,
88943     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
88944     uiSectionPresetFields: () => uiSectionPresetFields,
88945     uiSectionPrivacy: () => uiSectionPrivacy,
88946     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
88947     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
88948     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
88949     uiSectionSelectionList: () => uiSectionSelectionList,
88950     uiSectionValidationIssues: () => uiSectionValidationIssues,
88951     uiSectionValidationOptions: () => uiSectionValidationOptions,
88952     uiSectionValidationRules: () => uiSectionValidationRules,
88953     uiSectionValidationStatus: () => uiSectionValidationStatus,
88954     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
88955     uiSettingsCustomData: () => uiSettingsCustomData,
88956     uiSidebar: () => uiSidebar,
88957     uiSourceSwitch: () => uiSourceSwitch,
88958     uiSpinner: () => uiSpinner,
88959     uiSplash: () => uiSplash,
88960     uiStatus: () => uiStatus,
88961     uiSuccess: () => uiSuccess,
88962     uiTagReference: () => uiTagReference,
88963     uiToggle: () => uiToggle,
88964     uiTooltip: () => uiTooltip,
88965     uiVersion: () => uiVersion,
88966     uiViewOnKeepRight: () => uiViewOnKeepRight,
88967     uiViewOnOSM: () => uiViewOnOSM,
88968     uiZoom: () => uiZoom,
88969     utilAesDecrypt: () => utilAesDecrypt,
88970     utilAesEncrypt: () => utilAesEncrypt,
88971     utilArrayChunk: () => utilArrayChunk,
88972     utilArrayDifference: () => utilArrayDifference,
88973     utilArrayFlatten: () => utilArrayFlatten,
88974     utilArrayGroupBy: () => utilArrayGroupBy,
88975     utilArrayIdentical: () => utilArrayIdentical,
88976     utilArrayIntersection: () => utilArrayIntersection,
88977     utilArrayUnion: () => utilArrayUnion,
88978     utilArrayUniq: () => utilArrayUniq,
88979     utilArrayUniqBy: () => utilArrayUniqBy,
88980     utilAsyncMap: () => utilAsyncMap,
88981     utilCheckTagDictionary: () => utilCheckTagDictionary,
88982     utilCleanOsmString: () => utilCleanOsmString,
88983     utilCleanTags: () => utilCleanTags,
88984     utilCombinedTags: () => utilCombinedTags,
88985     utilCompareIDs: () => utilCompareIDs,
88986     utilDeepMemberSelector: () => utilDeepMemberSelector,
88987     utilDetect: () => utilDetect,
88988     utilDisplayName: () => utilDisplayName,
88989     utilDisplayNameForPath: () => utilDisplayNameForPath,
88990     utilDisplayType: () => utilDisplayType,
88991     utilEditDistance: () => utilEditDistance,
88992     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
88993     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
88994     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
88995     utilEntityRoot: () => utilEntityRoot,
88996     utilEntitySelector: () => utilEntitySelector,
88997     utilFastMouse: () => utilFastMouse,
88998     utilFunctor: () => utilFunctor,
88999     utilGetAllNodes: () => utilGetAllNodes,
89000     utilGetSetValue: () => utilGetSetValue,
89001     utilHashcode: () => utilHashcode,
89002     utilHighlightEntities: () => utilHighlightEntities,
89003     utilKeybinding: () => utilKeybinding,
89004     utilNoAuto: () => utilNoAuto,
89005     utilObjectOmit: () => utilObjectOmit,
89006     utilOldestID: () => utilOldestID,
89007     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
89008     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
89009     utilQsString: () => utilQsString,
89010     utilRebind: () => utilRebind,
89011     utilSafeClassName: () => utilSafeClassName,
89012     utilSessionMutex: () => utilSessionMutex,
89013     utilSetTransform: () => utilSetTransform,
89014     utilStringQs: () => utilStringQs,
89015     utilTagDiff: () => utilTagDiff,
89016     utilTagText: () => utilTagText,
89017     utilTiler: () => utilTiler,
89018     utilTotalExtent: () => utilTotalExtent,
89019     utilTriggerEvent: () => utilTriggerEvent,
89020     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
89021     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
89022     utilUniqueDomId: () => utilUniqueDomId,
89023     utilWrap: () => utilWrap,
89024     validationAlmostJunction: () => validationAlmostJunction,
89025     validationCloseNodes: () => validationCloseNodes,
89026     validationCrossingWays: () => validationCrossingWays,
89027     validationDisconnectedWay: () => validationDisconnectedWay,
89028     validationFormatting: () => validationFormatting,
89029     validationHelpRequest: () => validationHelpRequest,
89030     validationImpossibleOneway: () => validationImpossibleOneway,
89031     validationIncompatibleSource: () => validationIncompatibleSource,
89032     validationMaprules: () => validationMaprules,
89033     validationMismatchedGeometry: () => validationMismatchedGeometry,
89034     validationMissingRole: () => validationMissingRole,
89035     validationMissingTag: () => validationMissingTag,
89036     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
89037     validationOsmApiLimits: () => validationOsmApiLimits,
89038     validationOutdatedTags: () => validationOutdatedTags,
89039     validationPrivateData: () => validationPrivateData,
89040     validationSuspiciousName: () => validationSuspiciousName,
89041     validationUnsquareWay: () => validationUnsquareWay
89042   });
89043   var debug, setDebug, d3;
89044   var init_index = __esm({
89045     "modules/index.js"() {
89046       "use strict";
89047       init_actions();
89048       init_behavior();
89049       init_core();
89050       init_geo2();
89051       init_modes2();
89052       init_operations();
89053       init_osm();
89054       init_presets();
89055       init_renderer();
89056       init_services();
89057       init_svg();
89058       init_fields();
89059       init_intro2();
89060       init_panels();
89061       init_panes();
89062       init_sections();
89063       init_settings();
89064       init_ui();
89065       init_util();
89066       init_validations();
89067       init_src31();
89068       debug = false;
89069       setDebug = (newValue) => {
89070         debug = newValue;
89071       };
89072       d3 = {
89073         dispatch: dispatch_default,
89074         geoMercator: mercator_default,
89075         geoProjection: projection,
89076         polygonArea: area_default3,
89077         polygonCentroid: centroid_default2,
89078         select: select_default2,
89079         selectAll: selectAll_default2,
89080         timerFlush
89081       };
89082     }
89083   });
89084
89085   // modules/id.js
89086   var id_exports = {};
89087   var init_id2 = __esm({
89088     "modules/id.js"() {
89089       init_fetch();
89090       init_polyfill_patch_fetch();
89091       init_index();
89092       window.requestIdleCallback = window.requestIdleCallback || function(cb) {
89093         var start2 = Date.now();
89094         return window.requestAnimationFrame(function() {
89095           cb({
89096             didTimeout: false,
89097             timeRemaining: function() {
89098               return Math.max(0, 50 - (Date.now() - start2));
89099             }
89100           });
89101         });
89102       };
89103       window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
89104         window.cancelAnimationFrame(id2);
89105       };
89106       window.iD = index_exports;
89107     }
89108   });
89109   init_id2();
89110 })();
89111 //# sourceMappingURL=iD.js.map